forked from scala-js/scala-js
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Redesign primitive numeric types in the IR.
* Add types for `char`, `byte` and `short` in the IR. * Remove the subtyping relationships between primitive types, for example `int <: double`. Instead of the subtyping relationships, we introduce explicit widening conversions as `UnaryOp`s. In order to avoid widening `int`s to `double`s for the purpose of comparing them, we separate `Num_<` and friends into `Int_<` and `Double_<`. For floats, we do introduce the conversions in that case. There is one subtlety for `char` (`CharType`): it is *not* a subtype of `any`. That's because `char`s must always be boxed in `j.l.Character` when they are assigned to an `any`. This fixes scala-js#3085, and provides a cleaner solution to the old issues scala-js#2184 and scala-js#2780.
- Loading branch information
Showing
20 changed files
with
1,125 additions
and
740 deletions.
There are no files selected for viewing
489 changes: 227 additions & 262 deletions
489
compiler/src/main/scala/org/scalajs/core/compiler/GenJSCode.scala
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.