Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Advance the support for Scala.js #7113

Closed
sjrd opened this issue Aug 27, 2019 · 8 comments
Closed

Advance the support for Scala.js #7113

sjrd opened this issue Aug 27, 2019 · 8 comments

Comments

@sjrd
Copy link
Member

sjrd commented Aug 27, 2019

Dotty contains preliminary support for Scala.js under the flag -scalajs. Or rather, it contains the infrastructure for preliminary support. It is far from being actually usable, but this is where you can help!

I have written a tutorial that walks you through a few steps that you can do to further the support of Scala.js in Dotty. Even if you do not typically contribute to a compiler, this can be your chance. It is not very difficult, given that there already exists an extensive test suite, as well as a working implementation for scalac.

Read the tutorial, and get going!

@cquiroz
Copy link
Contributor

cquiroz commented Aug 28, 2019

I noted that often when adding and then removing a test suite I'd get errors like it was still trying to compile the removed test suite

I solved it by explicitly deleting the files with
rm -Rf tests/out/bootstrap/sjsJUnitTests

@neshkeev
Copy link
Contributor

The following two tests from javalib.lang fail without dotty alteration (the rest of the tests from the package are added in #7255):

  1. javalib/lang/ClassTest.scala: error log link
  2. javalib/lang/StringTest.scala: error log link

@neshkeev
Copy link
Contributor

neshkeev commented Sep 19, 2019

All the tests from javalib.math have been enabled, no failing tests were discovered #7272

@neshkeev
Copy link
Contributor

neshkeev commented Sep 19, 2019

The following test from the javalib.net fails:

  1. javalib/net/URITest.scala: error log link

The second test in the group javalib/net/URLDecoderTest.scala has been enabled #7273

@Lacaranian
Copy link
Contributor

Lacaranian commented Oct 6, 2019

I may dig into that URITest failure.

Edit: Looking at some of the other failures as well.

@neshkeev
Copy link
Contributor

neshkeev commented Oct 6, 2019

@Lacaranian , good, please do it

Lacaranian referenced this issue in Lacaranian/dotty Oct 7, 2019
- Fix an issue where non-null parameters with default arguments of null
  would generate default parameter functions returning a type of null,
  which is unknown to the ScalaJS backend. Use the type of the non-null
  parameter as the return type
- Enable the URITest for Scala.js, which was blocked by the previous
  issue
Lacaranian referenced this issue in Lacaranian/dotty Oct 8, 2019
- Fix the encoding of the NullClass and NothingClass in JSEncoding to
  correctly map to the corresponding Scala.js IR Symbols
- Enable the URITest for Scala.js, which was blocked by the previous
  issue
Lacaranian referenced this issue in Lacaranian/dotty Oct 13, 2019
- Fix the encoding of the NullClass and NothingClass in JSEncoding to
  correctly map to the corresponding Scala.js IR Symbols
- Enable the URITest for Scala.js, which was blocked by the previous
  issue
Lacaranian referenced this issue in Lacaranian/dotty Oct 13, 2019
- Fix an issue where BoxedUnit's TYPE member was not being correctly
  rewritten as java.lang.Void in Scala.js IR
- Enable the ClassTest for Scala.js, which uses the
  scala.runtime.BoxedUnit.TYPE value in one of its tests
Lacaranian referenced this issue in Lacaranian/dotty Oct 13, 2019
- Fix an issue where BoxedUnit's TYPE member was not being correctly
  rewritten as java.lang.Void in Scala.js IR
- Enable the ClassTest for Scala.js, which uses the
  scala.runtime.BoxedUnit.TYPE value in one of its tests
Lacaranian referenced this issue in Lacaranian/dotty Oct 13, 2019
- Fix an issue where BoxedUnit's TYPE member was not being correctly
  rewritten as java.lang.Void in Scala.js IR
- Enable the ClassTest for Scala.js, which uses the
  scala.runtime.BoxedUnit.TYPE value in one of its tests
Lacaranian referenced this issue in Lacaranian/dotty Oct 13, 2019
- `scala.runtime.BoxedUnit.TYPE` is now intercepted by `JSCodeGen` as a
  primitive for `ClassOf(ClassRef("V"))`, which Scala.js recognizes as
  `java.lang.Void`
- Enable the javalib/lang/ClassTest for Scala.js, which contains a test
  that uses `BoxedUnit.TYPE`
Lacaranian referenced this issue in Lacaranian/dotty Oct 13, 2019
- Fix the encoding of the NullClass and NothingClass in JSEncoding to
  correctly map to the corresponding Scala.js IR Symbols
- Enable the URITest for Scala.js, which was blocked by the previous
  issue
Lacaranian referenced this issue in Lacaranian/dotty Oct 13, 2019
- Fix the encoding of the `NullClass` and `NothingClass` in `JSEncoding` to
  correctly map to the corresponding Scala.js IR Symbols
- Enable the `javalib/net/URITest` for Scala.js, which uses default
  arguments with `null` values, which in turn are used as the return
  type of the default getters.
Lacaranian referenced this issue in Lacaranian/dotty Oct 21, 2019
In order to return from a tail recursive tree in Scala.js IR, a label
must be placed outside the loop to serve as a jump/break point. While
a fresh return label had been generated for such methods (in the
LocalNameGenerator), it had not been placed at the top level of its
method, and was otherwise unused.

After generating a method's body, if a enclosing return label had been
generated, use it to wrap the method body (just as Scala 2's JS codegen
does) for such breaks.

Enable the tests of ReadersTest.scala of the Scala.js test suite, of
which InputStreamReaderTest used a tail-recursive method that depended
on this fix.
Lacaranian referenced this issue in Lacaranian/dotty Oct 22, 2019
In order to use an explicit return statement in Scala.js IR, a label
must be placed wrapping the whole function body to serve as a jump/break
point for all control structures inside the function. While a fresh return
label had been generated for such methods (in the LocalNameGenerator),
it had not been placed at the top level of its method, and was otherwise
unused. This affected the tree created by the TailRec MiniPhase, as well
as user-written early return statements.

After generating a method's body, if a enclosing return label had been
generated, use it to wrap the method body (just as Scala 2's JS codegen
does) for such breaks.

Enable the tests of ReadersTest.scala of the Scala.js test suite, of
which InputStreamReaderTest used a tail-recursive method that depended
on this fix.
Lacaranian referenced this issue in Lacaranian/dotty Oct 22, 2019
In order to use an explicit return statement in Scala.js IR, a label
must be placed wrapping the whole function body to serve as a jump/break
point for all control structures inside the function. While a fresh return
label had been generated for such methods (in the LocalNameGenerator),
it had not been placed at the top level of its method, and was otherwise
unused. This affected the tree created by the TailRec MiniPhase, as well
as user-written early return statements.

After generating a method's body, if a enclosing return label had been
generated, use it to wrap the method body (just as Scala 2's JS codegen
does) for such breaks.

Enable the tests of ReadersTest.scala of the Scala.js test suite, of
which InputStreamReaderTest used a tail-recursive method that depended
on this fix.
Lacaranian referenced this issue in Lacaranian/dotty Oct 22, 2019
…types

- Fix the encoding of the `NullClass` and `NothingClass` in `JSEncoding` to
  correctly map to the corresponding Scala.js IR Symbols
- Enable the `javalib/net/URITest` for Scala.js, which uses default
  arguments with `null` values, which in turn are used as the return
  type of the default getters.
Lacaranian referenced this issue in Lacaranian/dotty Oct 22, 2019
- `scala.runtime.BoxedUnit.TYPE` is now intercepted by `JSCodeGen` as a
  primitive for `ClassOf(ClassRef("V"))`, which Scala.js recognizes as
  `java.lang.Void`
- Enable the javalib/lang/ClassTest for Scala.js, which contains a test
  that uses `BoxedUnit.TYPE`
sjrd referenced this issue Oct 22, 2019
Partial fix for lampepfl#7113: Fix Scala.js codegen for Explicit Returns
Lacaranian referenced this issue in Lacaranian/dotty Oct 23, 2019
- `scala.runtime.BoxedUnit.TYPE` is now intercepted by `JSCodeGen` as a
  primitive for `ClassOf(ClassRef("V"))`, which Scala.js recognizes as
  `java.lang.Void`
- Enable the javalib/lang/ClassTest for Scala.js, which contains a test
  that uses `BoxedUnit.TYPE`
sjrd referenced this issue Oct 23, 2019
Partial fix for lampepfl#7113: Fix Scala.js codegen for BoxedUnit.TYPE
Lacaranian referenced this issue in Lacaranian/dotty Oct 26, 2019
…types

- Fix the encoding of the `NullClass` and `NothingClass` in `JSEncoding` to
  correctly map to the corresponding Scala.js IR Symbols
- Enable the `javalib/net/URITest` for Scala.js, which uses default
  arguments with `null` values, which in turn are used as the return
  type of the default getters.
Lacaranian referenced this issue in Lacaranian/dotty Oct 28, 2019
…types

- Fix the encoding of the `NullClass` and `NothingClass` in `JSEncoding` to
  correctly map to the corresponding Scala.js IR Symbols
- Enable the `javalib/net/URITest` for Scala.js, which uses default
  arguments with `null` values, which in turn are used as the return
  type of the default getters.
Lacaranian referenced this issue in Lacaranian/dotty Oct 28, 2019
…ions with arguments

To be able to use the `expected` and `timeout` annotation arguments in
JUnit @test annotations, add handling for these arguments by supplying
them as arguments to the resolved constructor for the JUnit test class.

Enable the JUnitAnnotationsParamTest, which depends on this
functionality.
Lacaranian referenced this issue in Lacaranian/dotty Oct 28, 2019
…ions with arguments

To be able to use the `expected` and `timeout` annotation arguments in
JUnit @test annotations, add handling for these arguments by supplying
them as arguments to the resolved constructor for the JUnit test class.

Enable the JUnitAnnotationsParamTest, which depends on this
functionality.
Lacaranian referenced this issue in Lacaranian/dotty Oct 28, 2019
…ions with arguments

To be able to use the `expected` and `timeout` annotation arguments in
JUnit @test annotations, add handling for these arguments by supplying
them as arguments to the resolved constructor for the JUnit test class.

Enable the JUnitAnnotationsParamTest, which depends on this
functionality.
Lacaranian referenced this issue in Lacaranian/dotty Oct 28, 2019
Partial fix for lampepfl#7113

To be able to use the `expected` and `timeout` annotation arguments in
JUnit @test annotations, add handling for these arguments by supplying
them as arguments to the resolved constructor for the JUnit test class.

Enable the JUnitAnnotationsParamTest, which depends on this
functionality.
Lacaranian referenced this issue in Lacaranian/dotty Oct 29, 2019
Partial fix for lampepfl#7113

To be able to use the `expected` and `timeout` annotation arguments in
JUnit @test annotations, add handling for these arguments by supplying
them as arguments to the resolved constructor for the JUnit test class.

Enable the JUnitAnnotationsParamTest, which depends on this
functionality.
Lacaranian referenced this issue in Lacaranian/dotty Nov 13, 2019
…types

- Fix the encoding of the `NullClass` and `NothingClass` in `JSEncoding` to
  correctly map to the corresponding Scala.js IR Symbols
- Enable the `javalib/net/URITest` for Scala.js, which uses default
  arguments with `null` values, which in turn are used as the return
  type of the default getters.
sjrd referenced this issue Nov 13, 2019
Partial fix for lampepfl#7113: Fix Scala.js codegen for Null/Nothing types
abgruszecki referenced this issue in dotty-staging/dotty Dec 5, 2019
Partial fix for lampepfl#7113

To be able to use the `expected` and `timeout` annotation arguments in
JUnit @test annotations, add handling for these arguments by supplying
them as arguments to the resolved constructor for the JUnit test class.

Enable the JUnitAnnotationsParamTest, which depends on this
functionality.
squid314 referenced this issue in squid314/dotty May 9, 2020
Partial fix for lampepfl#7113

Just enabling the tests which already passed. It looks like the upstream
tests need updating for the Set pieces.
@sjrd sjrd modified the milestones: 0.18 Tech Preview, 3.0.0-M1 Sep 22, 2020
@sjrd
Copy link
Member Author

sjrd commented Sep 22, 2020

Thanks to all of you who have contributed to the support of Scala.js in Dotty.

Since I've been allocated time at the Scala Center to finish it, it is now almost done, and so I think this issue can be closed.

@sjrd sjrd closed this as completed Sep 22, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants