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

Scala.js: java.lang.AssertionError: assertion failed: Invalid functional interface trait FunctionXXL reached the back-end #16801

Closed
pshirshov opened this issue Feb 1, 2023 · 3 comments
Assignees
Labels
area:scala.js itype:bug stat:needs triage Every issue needs to have an "area" and "itype" label

Comments

@pshirshov
Copy link
Contributor

Compiler fails on a lambda with long argument list.

Repro: https://scastie.scala-lang.org/tkeR8yJBROetPhTS2Hjz8w

Stack:

[error] java.lang.AssertionError: assertion failed: Invalid functional interface trait FunctionXXL reached the back-end
[error] 	at scala.runtime.Scala3RunTime$.assertFailed(Scala3RunTime.scala:8)
[error] 	at dotty.tools.backend.sjs.JSCodeGen.genClosure(JSCodeGen.scala:3511)
[error] 	at dotty.tools.backend.sjs.JSCodeGen.genStatOrExpr(JSCodeGen.scala:1913)
[error] 	at dotty.tools.backend.sjs.JSCodeGen.genStatOrExpr(JSCodeGen.scala:1845)
[error] 	at dotty.tools.backend.sjs.JSCodeGen.genExpr(JSCodeGen.scala:1637)
[error] 	at dotty.tools.backend.sjs.JSCodeGen.genStatOrExpr(JSCodeGen.scala:1717)
[error] 	at dotty.tools.backend.sjs.JSCodeGen.genStat(JSCodeGen.scala:1615)
[error] 	at dotty.tools.backend.sjs.JSCodeGen.$anonfun$46(JSCodeGen.scala:1845)
[error] 	at scala.collection.immutable.List.map(List.scala:246)
[error] 	at dotty.tools.backend.sjs.JSCodeGen.genStatOrExpr(JSCodeGen.scala:1845)
[error] 	at dotty.tools.backend.sjs.JSCodeGen.genExpr(JSCodeGen.scala:1637)
[error] 	at dotty.tools.backend.sjs.JSCodeGen.genStatOrExpr(JSCodeGen.scala:1857)
[error] 	at dotty.tools.backend.sjs.JSCodeGen.genExpr(JSCodeGen.scala:1637)
[error] 	at dotty.tools.backend.sjs.JSCodeGen.genStatOrExpr(JSCodeGen.scala:1857)
[error] 	at dotty.tools.backend.sjs.JSCodeGen.genExpr(JSCodeGen.scala:1637)
[error] 	at dotty.tools.backend.sjs.JSCodeGen.genStatOrExpr(JSCodeGen.scala:1717)
[error] 	at dotty.tools.backend.sjs.JSCodeGen.genStat(JSCodeGen.scala:1615)
[error] 	at dotty.tools.backend.sjs.JSCodeGen.$anonfun$46(JSCodeGen.scala:1845)
[error] 	at scala.collection.immutable.List.map(List.scala:246)
[error] 	at dotty.tools.backend.sjs.JSCodeGen.genStatOrExpr(JSCodeGen.scala:1845)
[error] 	at dotty.tools.backend.sjs.JSCodeGen.genExpr(JSCodeGen.scala:1637)
[error] 	at dotty.tools.backend.sjs.JSCodeGen.genBody$1(JSCodeGen.scala:1567)
[error] 	at dotty.tools.backend.sjs.JSCodeGen.genMethodDef(JSCodeGen.scala:1572)
[error] 	at dotty.tools.backend.sjs.JSCodeGen.genMethodWithCurrentLocalNameScope$$anonfun$1(JSCodeGen.scala:1539)
[error] 	at dotty.tools.backend.sjs.JSCodeGen.withPerMethodBodyState$$anonfun$1(JSCodeGen.scala:106)
[error] 	at dotty.tools.backend.sjs.ScopedVar$.withScopedVars(ScopedVar.scala:33)
[error] 	at dotty.tools.backend.sjs.JSCodeGen.withPerMethodBodyState(JSCodeGen.scala:107)
[error] 	at dotty.tools.backend.sjs.JSCodeGen.genMethodWithCurrentLocalNameScope(JSCodeGen.scala:1545)
[error] 	at dotty.tools.backend.sjs.JSCodeGen.genMethod$$anonfun$1(JSCodeGen.scala:1399)
[error] 	at dotty.tools.backend.sjs.ScopedVar$.withScopedVars(ScopedVar.scala:33)
[error] 	at dotty.tools.backend.sjs.JSCodeGen.genMethod(JSCodeGen.scala:1400)
[error] 	at dotty.tools.backend.sjs.JSCodeGen.genScalaClass$$anonfun$2(JSCodeGen.scala:368)
[error] 	at scala.collection.immutable.List.foreach(List.scala:333)
[error] 	at dotty.tools.backend.sjs.JSCodeGen.genScalaClass(JSCodeGen.scala:373)
[error] 	at dotty.tools.backend.sjs.JSCodeGen.genCompilationUnit$$anonfun$3$$anonfun$1(JSCodeGen.scala:238)
[error] 	at dotty.tools.backend.sjs.ScopedVar$.withScopedVars(ScopedVar.scala:33)
[error] 	at dotty.tools.backend.sjs.JSCodeGen.genCompilationUnit$$anonfun$3(JSCodeGen.scala:242)
[error] 	at scala.runtime.function.JProcedure1.apply(JProcedure1.java:15)
[error] 	at scala.runtime.function.JProcedure1.apply(JProcedure1.java:10)
[error] 	at scala.collection.immutable.List.foreach(List.scala:333)
[error] 	at dotty.tools.backend.sjs.JSCodeGen.genCompilationUnit(JSCodeGen.scala:244)
[error] 	at dotty.tools.backend.sjs.JSCodeGen.run(JSCodeGen.scala:156)
[error] 	at dotty.tools.backend.sjs.GenSJSIR.run(GenSJSIR.scala:18)
[error] 	at dotty.tools.dotc.core.Phases$Phase.runOn$$anonfun$1(Phases.scala:316)
[error] 	at scala.collection.immutable.List.map(List.scala:250)
[error] 	at dotty.tools.dotc.core.Phases$Phase.runOn(Phases.scala:320)
[error] 	at dotty.tools.dotc.Run.runPhases$1$$anonfun$1(Run.scala:233)
[error] 	at scala.runtime.function.JProcedure1.apply(JProcedure1.java:15)
[error] 	at scala.runtime.function.JProcedure1.apply(JProcedure1.java:10)
[error] 	at scala.collection.ArrayOps$.foreach$extension(ArrayOps.scala:1321)
[error] 	at dotty.tools.dotc.Run.runPhases$1(Run.scala:244)
[error] 	at dotty.tools.dotc.Run.compileUnits$$anonfun$1(Run.scala:252)
[error] 	at dotty.tools.dotc.Run.compileUnits$$anonfun$adapted$1(Run.scala:261)
[error] 	at dotty.tools.dotc.util.Stats$.maybeMonitored(Stats.scala:68)
[error] 	at dotty.tools.dotc.Run.compileUnits(Run.scala:261)
[error] 	at dotty.tools.dotc.Run.compileSources(Run.scala:185)
[error] 	at dotty.tools.dotc.Run.compile(Run.scala:169)
[error] 	at dotty.tools.dotc.Driver.doCompile(Driver.scala:35)
[error] 	at dotty.tools.xsbt.CompilerBridgeDriver.run(CompilerBridgeDriver.java:88)
[error] 	at dotty.tools.xsbt.CompilerBridge.run(CompilerBridge.java:22)
[error] 	at sbt.internal.inc.AnalyzingCompiler.compile(AnalyzingCompiler.scala:91)
[error] 	at sbt.internal.inc.MixedAnalyzingCompiler.$anonfun$compile$7(MixedAnalyzingCompiler.scala:193)
[error] 	at scala.runtime.java8.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.java:23)
[error] 	at sbt.internal.inc.MixedAnalyzingCompiler.timed(MixedAnalyzingCompiler.scala:248)
[error] 	at sbt.internal.inc.MixedAnalyzingCompiler.$anonfun$compile$4(MixedAnalyzingCompiler.scala:183)
[error] 	at sbt.internal.inc.MixedAnalyzingCompiler.$anonfun$compile$4$adapted(MixedAnalyzingCompiler.scala:163)
[error] 	at sbt.internal.inc.JarUtils$.withPreviousJar(JarUtils.scala:239)
[error] 	at sbt.internal.inc.MixedAnalyzingCompiler.compileScala$1(MixedAnalyzingCompiler.scala:163)
[error] 	at sbt.internal.inc.MixedAnalyzingCompiler.compile(MixedAnalyzingCompiler.scala:211)
[error] 	at sbt.internal.inc.IncrementalCompilerImpl.$anonfun$compileInternal$1(IncrementalCompilerImpl.scala:534)
[error] 	at sbt.internal.inc.IncrementalCompilerImpl.$anonfun$compileInternal$1$adapted(IncrementalCompilerImpl.scala:534)
[error] 	at sbt.internal.inc.Incremental$.$anonfun$apply$5(Incremental.scala:179)
[error] 	at sbt.internal.inc.Incremental$.$anonfun$apply$5$adapted(Incremental.scala:177)
[error] 	at sbt.internal.inc.Incremental$$anon$2.run(Incremental.scala:463)
[error] 	at sbt.internal.inc.IncrementalCommon$CycleState.next(IncrementalCommon.scala:116)
[error] 	at sbt.internal.inc.IncrementalCommon$$anon$1.next(IncrementalCommon.scala:56)
[error] 	at sbt.internal.inc.IncrementalCommon$$anon$1.next(IncrementalCommon.scala:52)
[error] 	at sbt.internal.inc.IncrementalCommon.cycle(IncrementalCommon.scala:263)
[error] 	at sbt.internal.inc.Incremental$.$anonfun$incrementalCompile$8(Incremental.scala:418)
[error] 	at sbt.internal.inc.Incremental$.withClassfileManager(Incremental.scala:506)
[error] 	at sbt.internal.inc.Incremental$.incrementalCompile(Incremental.scala:405)
[error] 	at sbt.internal.inc.Incremental$.apply(Incremental.scala:171)
[error] 	at sbt.internal.inc.IncrementalCompilerImpl.compileInternal(IncrementalCompilerImpl.scala:534)
[error] 	at sbt.internal.inc.IncrementalCompilerImpl.$anonfun$compileIncrementally$1(IncrementalCompilerImpl.scala:488)
[error] 	at sbt.internal.inc.IncrementalCompilerImpl.handleCompilationError(IncrementalCompilerImpl.scala:332)
[error] 	at sbt.internal.inc.IncrementalCompilerImpl.compileIncrementally(IncrementalCompilerImpl.scala:425)
[error] 	at sbt.internal.inc.IncrementalCompilerImpl.compile(IncrementalCompilerImpl.scala:137)
[error] 	at sbt.Defaults$.compileIncrementalTaskImpl(Defaults.scala:2363)
[error] 	at sbt.Defaults$.$anonfun$compileIncrementalTask$2(Defaults.scala:2313)
[error] 	at sbt.internal.server.BspCompileTask$.$anonfun$compute$1(BspCompileTask.scala:30)
[error] 	at sbt.internal.io.Retry$.apply(Retry.scala:46)
[error] 	at sbt.internal.io.Retry$.apply(Retry.scala:28)
[error] 	at sbt.internal.io.Retry$.apply(Retry.scala:23)
[error] 	at sbt.internal.server.BspCompileTask$.compute(BspCompileTask.scala:30)
[error] 	at sbt.Defaults$.$anonfun$compileIncrementalTask$1(Defaults.scala:2311)
[error] 	at scala.Function1.$anonfun$compose$1(Function1.scala:49)
[error] 	at sbt.internal.util.$tilde$greater.$anonfun$$u2219$1(TypeFunctions.scala:62)
[error] 	at sbt.std.Transform$$anon$4.work(Transform.scala:68)
[error] 	at sbt.Execute.$anonfun$submit$2(Execute.scala:282)
[error] 	at sbt.internal.util.ErrorHandling$.wideConvert(ErrorHandling.scala:23)
[error] 	at sbt.Execute.work(Execute.scala:291)
[error] 	at sbt.Execute.$anonfun$submit$1(Execute.scala:282)
[error] 	at sbt.ConcurrentRestrictions$$anon$4.$anonfun$submitValid$1(ConcurrentRestrictions.scala:265)
[error] 	at sbt.CompletionService$$anon$2.call(CompletionService.scala:64)
[error] 	at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
[error] 	at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:539)
[error] 	at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
[error] 	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
[error] 	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
[error] 	at java.base/java.lang.Thread.run(Thread.java:833)

ScalaJS developers say that this is a dotty problem.

@pshirshov pshirshov added itype:bug stat:needs triage Every issue needs to have an "area" and "itype" label labels Feb 1, 2023
@sjrd sjrd self-assigned this Feb 1, 2023
@sjrd
Copy link
Member

sjrd commented Feb 1, 2023

Thanks for the report here.

@sjrd sjrd changed the title ScalaJS and Scala 3: java.lang.AssertionError: assertion failed: Invalid functional interface trait FunctionXXL reached the back-end Scala.js: java.lang.AssertionError: assertion failed: Invalid functional interface trait FunctionXXL reached the back-end Feb 2, 2023
sjrd added a commit to dotty-staging/dotty that referenced this issue Feb 2, 2023
sjrd added a commit to dotty-staging/dotty that referenced this issue Feb 2, 2023
@sjrd sjrd closed this as completed in d28641c Feb 3, 2023
@pshirshov
Copy link
Contributor Author

Thanks. Is there any chance it may be released soon?

@sjrd
Copy link
Member

sjrd commented Feb 3, 2023

Look up the Scala 3 release schedule. I'm not in charge. There's supposed to be a release every 6 weeks (first RC, then 6 weeks later the stable version).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:scala.js itype:bug stat:needs triage Every issue needs to have an "area" and "itype" label
Projects
None yet
Development

No branches or pull requests

2 participants