Comments (4)
This is working as designed. The behavior is indeed a consequence of value-based type tests for numeric types. The fact that it behaves like Int
instead of Byte
/Short
is the better trade-off. As mentioned in the issue description, portable behavior is recoverable by converting to Int
; if we had chosen the other way around, no workaround would exist for the Int
behavior.
from scala-js.
Hrm. I was going to write that this is a direct consequence of "Runtime type tests are based on values" documented here: https://www.scala-js.org/doc/semantics.html
However, one would expect the JVM result in this case. It seems that the relevant code simply only considers ints and longs:
scala-js/javalib/src/main/scala/java/util/Formatter.scala
Lines 433 to 442 in b5158b2
I vaguely recall that we needed to make this decision a long time ago, but I do not remember why we settled on this. I'll try and dig in the commit history.
from scala-js.
Commit removing the handling of Byte/Short: 000fb14 / #434
from scala-js.
Also Duplicate of #2206.
from scala-js.
Related Issues (20)
- Investigate Fishy Record Names in Optimizer Core HOT 2
- Prevent implicit conversion of A | Null to A | B HOT 1
- Wrong pretty-printing of JS tree that *starts* with an object lit
- Error while running `sbt`: bad constant pool index: 0 at pos: 48445 using Java version 21.0.1 HOT 3
- Race condition in AnalyzerRun.WorkTracker during `allowComplete()`.
- scala.util.Try does not catch `ClassCastException` HOT 1
- ConflictingTopLevelExport error reports incomplete error message
- linkerJS2_13/test spuriously fails too often on the CI (Killed)
- Locals stored as private symbols on non-native JS types breaks JS semantics HOT 3
- Improve GCC/ Minifier documentation HOT 10
- Analyzer never marks Interfaces with isAnySubclassInstantiated.
- Generated modules export unnecessary symbols HOT 4
- Excess modules are generated HOT 11
- Synthesized reflective proxies have wrong This type for hijacked classes
- FewestModules OOMs with dynamic dependencies HOT 5
- Scala 2.13's `scala.util.RandomTest.testShuffle()` crashes V8 on WebAssembly HOT 2
- Make Scala.js Wasm backend suitable for standalone Wasm VMs HOT 2
- [Wasm] Add option to use `js-string-builtins` for using JS string to implement string
- 1.16.0 does not work `sbt run` with Scala 2.13.12 or lower versions due to SIP-51
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from scala-js.