Skip to content

Scala.JS sandbox is broken #1574

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

Closed
felixmulder opened this issue Oct 10, 2016 · 3 comments
Closed

Scala.JS sandbox is broken #1574

felixmulder opened this issue Oct 10, 2016 · 3 comments

Comments

@felixmulder
Copy link
Contributor

On master doing: sbt sjsSandbox/compile results in:

[info] Loading project definition from /home/fixel/Projects/dotty-master/project
[info] Set current project to dotty (in build file:/home/fixel/Projects/dotty-master/)
> sjsSandbox/compile
[info] Resolving org.scala-js#scalajs-ir_2.11;0.6.8 ...
[info] Compiling 1 Scala sources to /home/fixel/Projects/dotty-master/sandbox/scalajs/target/scala-2.11/classes...
[error] exception occurred while compiling /home/fixel/Projects/dotty-master/sandbox/scalajs/hello.scala
[error] Exception in thread "main" java.lang.AssertionError: assertion failed: phase getClass has unmet requirement: class dotty.tools.dotc.transform.FunctionalInterfaces should precede this phase
[error]     at scala.Predef$.assert(Predef.scala:165)
[error]     at dotty.tools.dotc.core.Phases$PhasesBase$class.checkRequirements$1(Phases.scala:164)
[error]     at dotty.tools.dotc.core.Phases$PhasesBase$$anonfun$usePhases$2.apply(Phases.scala:177)
[error]     at dotty.tools.dotc.core.Phases$PhasesBase$$anonfun$usePhases$2.apply(Phases.scala:176)
[error]     at scala.collection.IndexedSeqOptimized$class.foreach(IndexedSeqOptimized.scala:33)
[error]     at scala.collection.mutable.ArrayOps$ofRef.foreach(ArrayOps.scala:186)
[error]     at dotty.tools.dotc.core.Phases$PhasesBase$class.usePhases(Phases.scala:176)
[error]     at dotty.tools.dotc.core.Contexts$ContextBase.usePhases(Contexts.scala:527)
[error]     at dotty.tools.dotc.Run$$anonfun$compileUnits$1.apply$mcV$sp(Run.scala:66)
[error]     at dotty.tools.dotc.Run$$anonfun$compileUnits$1.apply(Run.scala:62)
[error]     at dotty.tools.dotc.Run$$anonfun$compileUnits$1.apply(Run.scala:62)
[error]     at dotty.tools.dotc.util.Stats$.monitorHeartBeat(Stats.scala:76)
[error]     at dotty.tools.dotc.Run.compileUnits(Run.scala:62)
[error]     at dotty.tools.dotc.Run.compileSources(Run.scala:59)
[error]     at dotty.tools.dotc.Run.compile(Run.scala:43)
[error]     at dotty.tools.dotc.Driver.doCompile(Driver.scala:26)
[error]     at dotty.tools.dotc.Driver.process(Driver.scala:124)
[error]     at dotty.tools.dotc.Driver.process(Driver.scala:93)
[error]     at dotty.tools.dotc.Driver.process(Driver.scala:105)
[error]     at dotty.tools.dotc.Driver.main(Driver.scala:132)
[error]     at dotty.tools.dotc.Main.main(Main.scala)
[trace] Stack trace suppressed: run last sjsSandbox/compile:compile for the full output.
[error] (sjsSandbox/compile:compile) Nonzero exit code returned from runner: 1
[error] Total time: 4 s, completed Oct 10, 2016 9:53:55 AM

ping: @sjrd

@nicolasstucki
Copy link
Contributor

Currently it results in

[error] 
[error] bad option '-scalajs' was ignored
[error] 
[error] result of /Users/nicolasstucki/GitHub/dotty/sandbox/scalajs/src/hello.scala after TreeTransform:{moveStatic, expandPrivate, selectStatic, collectEntryPoints, collectSuperCalls, dropInlined, labelDef}:
[error] 
[error] package hello {
[error]   @scala.annotation.internal.SourceFile(
[error]     "/Users/nicolasstucki/GitHub/dotty/sandbox/scalajs/src/hello.scala"
[error]   ) <trait> trait MyTrait extends Object { 
[error]     def $init$(): Unit = ()
[error]     <accessor> def x(): Int
[error]     protected def initial$x(): Int = 5
[error]     def foo(y: Int): Int = this.x()
[error]   }
[error]   @scala.annotation.internal.SourceFile(
[error]     "/Users/nicolasstucki/GitHub/dotty/sandbox/scalajs/src/hello.scala"
[error]   ) final module class world$ extends Object with scala.scalajs.js.JSApp with 
[error]     hello
[error]   .MyTrait { 
[error]     def <init>(): Unit = 
[error]       {
[error]         super()
[error]         scala.scalajs.js.JSApp$class#$init$(this)
[error]         hello.world.x = super[MyTrait].initial$x()
[error]         ()
[error]       }
[error]     private val x: Int
[error]     <accessor> def x(): Int = hello.world.x
[error]     def $js$exported$meth$main(): Object = 
[error]       scala.scalajs.js.JSApp$class#$js$exported$meth$main(this)
[error]     def main(): Unit = 
[error]       {
[error]         println("hello dotty.js!")
[error]         println(scala.Int.box(hello.world.foo(4)))
[error]       }
[error]   }
[error]   final lazy module val world: hello.world$ = new hello.world$()
[error] }
[error] 
[error] one warning found

@felixmulder
Copy link
Contributor Author

felixmulder commented May 19, 2017

It has been taken out of the main sources. The backend currently sits in ./compiler/scalaJS (not indexed by sbt) waiting for @sjrd's return.

smarter added a commit to dotty-staging/dotty that referenced this issue Nov 15, 2017
This partially reverts 06a3d47 to bring
back Dotty.js from the dead. Many things are broken still, but this is
enough to do some experiments:
- The backend was initially removed because of scala#1574, I don't see why
  GetClass has a requirement on FunctionalInterfaces, so I just removed
  it ¯\_(ツ)_/¯
- Scala.js was upgraded to 0.6.19. More recent versions of Scala.js cannot be
  used because they require sbt 0.13.16 and we're blocked by
  sbt/sbt#3460, this won't be an issue anymore
  once we switch to sbt 1 (see scala#3441)
- GenSJSIR was hacked to compile with 0.6.19 but is missing most of the
  changes to the Scala.js backend phase for Scala 2 that happend
  since it was initially ported to Dotty from Scala.js 0.6.8
- scalajs-ir does not compile with Dotty anymore, see comments in Build.scala
- The Scala.js backend explodes when extending a Scala 2 trait because
  of the way LinkScala2Impls transforms supercalls to these traits.
  Luckily, we don't need to extend js.JSApp anymore to make a Hello World :P.
smarter added a commit to dotty-staging/dotty that referenced this issue Nov 15, 2017
This partially reverts 06a3d47 to bring
back Dotty.js from the dead. Many things are broken still, but this is
enough to do some experiments:
- The backend was initially removed because of scala#1574, I don't see why
  GetClass has a requirement on FunctionalInterfaces, so I just removed
  it ¯\_(ツ)_/¯
- Scala.js was upgraded to 0.6.19. More recent versions of Scala.js cannot be
  used because they require sbt 0.13.16 and we're blocked by
  sbt/sbt#3460, this won't be an issue anymore
  once we switch to sbt 1 (see scala#3441)
- GenSJSIR was hacked to compile with 0.6.19 but is missing most of the
  changes to the Scala.js backend phase for Scala 2 that happened
  since it was initially ported to Dotty from Scala.js 0.6.8
- scalajs-ir does not compile with Dotty anymore, see comments in Build.scala
- The Scala.js backend explodes when extending a Scala 2 trait because
  of the way LinkScala2Impls transforms supercalls to these traits.
  Luckily, we don't need to extend js.JSApp anymore to make a Hello World :P.
smarter added a commit to dotty-staging/dotty that referenced this issue Nov 15, 2017
This partially reverts 06a3d47 to bring
back Dotty.js from the dead. Many things are broken still, but this is
enough to do some experiments:
- The backend was initially removed because of scala#1574, I don't see why
  GetClass has a requirement on FunctionalInterfaces, so I just removed
  it ¯\_(ツ)_/¯
- Scala.js was upgraded to 0.6.19. More recent versions of Scala.js cannot be
  used because they require sbt 0.13.16 and we're blocked by
  sbt/sbt#3460, this won't be an issue anymore
  once we switch to sbt 1 (see scala#3441)
- GenSJSIR was hacked to compile with 0.6.19 but is missing most of the
  changes to the Scala.js backend phase for Scala 2 that happened
  since it was initially ported to Dotty from Scala.js 0.6.8
- scalajs-ir does not compile with Dotty anymore, see comments in Build.scala
- The Scala.js backend explodes when extending a Scala 2 trait because
  of the way LinkScala2Impls transforms supercalls to these traits.
  Luckily, we don't need to extend js.JSApp anymore to make a Hello World :P.

I verified that the following works:
    sbt sjsSandbox/run
But I don't know if anything else does!
sjrd pushed a commit to sjrd/dotty that referenced this issue Sep 22, 2018
This partially reverts 06a3d47 to bring
back Dotty.js from the dead. Many things are broken still, but this is
enough to do some experiments:
- The backend was initially removed because of scala#1574, I don't see why
  GetClass has a requirement on FunctionalInterfaces, so I just removed
  it ¯\_(ツ)_/¯
- Scala.js was upgraded to 0.6.19. More recent versions of Scala.js cannot be
  used because they require sbt 0.13.16 and we're blocked by
  sbt/sbt#3460, this won't be an issue anymore
  once we switch to sbt 1 (see scala#3441)
- GenSJSIR was hacked to compile with 0.6.19 but is missing most of the
  changes to the Scala.js backend phase for Scala 2 that happened
  since it was initially ported to Dotty from Scala.js 0.6.8
- scalajs-ir does not compile with Dotty anymore, see comments in Build.scala
- The Scala.js backend explodes when extending a Scala 2 trait because
  of the way LinkScala2Impls transforms supercalls to these traits.
  Luckily, we don't need to extend js.JSApp anymore to make a Hello World :P.

I verified that the following works:
    sbt sjsSandbox/run
But I don't know if anything else does!
sjrd pushed a commit to dotty-staging/dotty that referenced this issue Nov 8, 2018
This partially reverts 06a3d47 to bring
back Dotty.js from the dead. Many things are broken still, but this is
enough to do some experiments:
- The backend was initially removed because of scala#1574, I don't see why
  GetClass has a requirement on FunctionalInterfaces, so I just removed
  it ¯\_(ツ)_/¯
- Scala.js was upgraded to 0.6.19. More recent versions of Scala.js cannot be
  used because they require sbt 0.13.16 and we're blocked by
  sbt/sbt#3460, this won't be an issue anymore
  once we switch to sbt 1 (see scala#3441)
- GenSJSIR was hacked to compile with 0.6.19 but is missing most of the
  changes to the Scala.js backend phase for Scala 2 that happened
  since it was initially ported to Dotty from Scala.js 0.6.8
- scalajs-ir does not compile with Dotty anymore, see comments in Build.scala
- The Scala.js backend explodes when extending a Scala 2 trait because
  of the way LinkScala2Impls transforms supercalls to these traits.
  Luckily, we don't need to extend js.JSApp anymore to make a Hello World :P.

I verified that the following works:
    sbt sjsSandbox/run
But I don't know if anything else does!
sjrd pushed a commit to dotty-staging/dotty that referenced this issue Nov 9, 2018
This partially reverts 06a3d47 to bring
back Dotty.js from the dead.

- Scala.js was upgraded to 1.0.0-M6, and the back-end was updated
  to reflect changes that have happened in the Scala 2 back-end
  since the initial implementation of the Dotty.js back-end.
- The backend was initially removed because of scala#1574, I don't see why
  GetClass has a requirement on FunctionalInterfaces, so I just removed
  it ¯\_(ツ)_/¯
- The Scala.js backend explodes when extending a Scala 2 trait
  because of the way LinkScala2Impls transforms supercalls to
  these traits. Luckily, we don't need to extend js.JSApp anymore
  to make a Hello World :P.

The following command works, and is added to the CI:

    sbt sjsSandbox/run

This generally remains a WIP. There are still a lot of
Scala.js-specific features which are not supported, notably exports
and non-native JS classes.
@nicolasstucki
Copy link
Contributor

FIxed with #5143

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

2 participants