Skip to content

Using 'lambda' in a method name triggers an assertion failure in the compiler #10857

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

Open
LPTK opened this issue Apr 29, 2018 · 3 comments
Open
Milestone

Comments

@LPTK
Copy link

LPTK commented Apr 29, 2018

The bug looks very arcane, and I did not manage to reduce it to a simple self-contained example. Here is a permanent link to the place where the problematic method is defined, in my code base.

Try renaming lamImpl to lambdaImpl. When compiling such code (with sbt compile), an assertion is raised with the following message:

$ sbt compile
[info] Loading global plugins from user/.sbt/0.13/plugins
[info] Loading project definition from squid/project
[info] Set current project to squid (in build file:squid/)
[info] Executing in batch mode. For better performance use sbt's shell
[info] Compiling 1 Scala source to squid/core/target/scala-2.12/classes...
java.lang.AssertionError: assertion failed:
  MetaBases$MirrorBase$$anonfun$lambdaImpl$2
     while compiling: squid/core/src/main/scala/squid/quasi/MetaBases.scala
        during phase: jvm
     library version: version 2.12.5
    compiler version: version 2.12.5
  reconstructed args: -deprecation -Xplugin:user/.ivy2/cache/org.scalamacros/paradise_2.12.5/jars/paradise_2.12.5-2.1.0.jar -feature -language:postfixOps -language:implicitConversions -language:higherKinds -classpath squid/core/target/scala-2.12/classes:squid/core_macros/target/scala-2.12/classes:user/.ivy2/cache/org.scala-lang/scala-compiler/jars/scala-compiler-2.12.5.jar:user/.ivy2/cache/org.scala-lang/scala-reflect/jars/scala-reflect-2.12.5.jar:user/.ivy2/cache/org.scala-lang.modules/scala-xml_2.12/bundles/scala-xml_2.12-1.0.6.jar:user/.ivy2/cache/org.scalactic/scalactic_2.12/bundles/scalactic_2.12-3.0.5.jar -unchecked -bootclasspath /Library/Java/JavaVirtualMachines/jdk1.8.0_65.jdk/Contents/Home/jre/lib/resources.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_65.jdk/Contents/Home/jre/lib/rt.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_65.jdk/Contents/Home/jre/lib/sunrsasign.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_65.jdk/Contents/Home/jre/lib/jsse.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_65.jdk/Contents/Home/jre/lib/jce.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_65.jdk/Contents/Home/jre/lib/charsets.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_65.jdk/Contents/Home/jre/lib/jfr.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_65.jdk/Contents/Home/jre/classes:user/.ivy2/cache/org.scala-lang/scala-library/jars/scala-library-2.12.5.jar

  last tree to typer: TypeTree(class Universe)
       tree position: line 406 of squid/core/src/main/scala/squid/quasi/MetaBases.scala
            tree tpe: scala.reflect.api.Universe
              symbol: abstract class Universe in package api
   symbol definition: abstract class Universe extends Symbols with Types with FlagSets with Scopes with Names with Trees with Constants with Annotations with Positions with Exprs with TypeTags with ImplicitTags with StandardDefinitions with StandardNames with StandardLiftables with Mirrors with Printers with Liftables with Quasiquotes with Internals (a ClassSymbol)
      symbol package: scala.reflect.api
       symbol owners: class Universe
           call site: constructor MetaBases$Runtime$ScalaReflectionBase in object MetaBases$Runtime$ScalaReflectionBase in package quasi

== Source file context for tree position ==

   403
   404 object MetaBases {
   405
   406   object Runtime extends MetaBases {
   407     val u: sru.type = sru
   408
   409     private var varCount = 0
	at scala.reflect.internal.SymbolTable.throwAssertionError(SymbolTable.scala:163)
	at scala.tools.nsc.backend.jvm.BCodeHelpers.isAnonymousOrLocalClass(BCodeHelpers.scala:77)
	at scala.tools.nsc.backend.jvm.BCodeHelpers.enclosingMethodAttribute(BCodeHelpers.scala:199)
	at scala.tools.nsc.backend.jvm.BCodeSkelBuilder$PlainSkelBuilder.initJClass(BCodeSkelBuilder.scala:140)
	at scala.tools.nsc.backend.jvm.BCodeSkelBuilder$PlainSkelBuilder.genPlainClass(BCodeSkelBuilder.scala:95)
	at scala.tools.nsc.backend.jvm.CodeGen.genClass(CodeGen.scala:69)
	at scala.tools.nsc.backend.jvm.CodeGen.genClassDef$1(CodeGen.scala:31)
	at scala.tools.nsc.backend.jvm.CodeGen.$anonfun$genUnit$3(CodeGen.scala:54)
	at scala.tools.nsc.backend.jvm.CodeGen.genClassDefs$1(CodeGen.scala:54)
	at scala.tools.nsc.backend.jvm.CodeGen.$anonfun$genUnit$2(CodeGen.scala:53)
	at scala.tools.nsc.backend.jvm.CodeGen.genClassDefs$1(CodeGen.scala:53)
	at scala.tools.nsc.backend.jvm.CodeGen.$anonfun$genUnit$2(CodeGen.scala:53)
	at scala.tools.nsc.backend.jvm.CodeGen.genClassDefs$1(CodeGen.scala:53)
	at scala.tools.nsc.backend.jvm.CodeGen.$anonfun$genUnit$4(CodeGen.scala:58)
	at scala.tools.nsc.backend.jvm.CodeGen.genUnit(CodeGen.scala:58)
	at scala.tools.nsc.backend.jvm.GenBCode$BCodePhase.apply(GenBCode.scala:67)
	at scala.tools.nsc.Global$GlobalPhase.$anonfun$applyPhase$1(Global.scala:426)
	at scala.tools.nsc.Global$GlobalPhase.applyPhase(Global.scala:419)
	at scala.tools.nsc.Global$GlobalPhase.$anonfun$run$1(Global.scala:390)
	at scala.tools.nsc.Global$GlobalPhase.$anonfun$run$1$adapted(Global.scala:390)
	at scala.collection.Iterator.foreach(Iterator.scala:944)
	at scala.collection.Iterator.foreach$(Iterator.scala:944)
	at scala.collection.AbstractIterator.foreach(Iterator.scala:1432)
	at scala.tools.nsc.Global$GlobalPhase.run(Global.scala:390)
	at scala.tools.nsc.backend.jvm.GenBCode$BCodePhase.super$run(GenBCode.scala:73)
	at scala.tools.nsc.backend.jvm.GenBCode$BCodePhase.$anonfun$run$1(GenBCode.scala:73)
	at scala.tools.nsc.backend.jvm.GenBCode$BCodePhase.run(GenBCode.scala:71)
	at scala.tools.nsc.Global$Run.compileUnitsInternal(Global.scala:1446)
	at scala.tools.nsc.Global$Run.compileUnits(Global.scala:1430)
	at scala.tools.nsc.Global$Run.compileSources(Global.scala:1423)
	at scala.tools.nsc.Global$Run.compile(Global.scala:1539)
	at xsbt.CachedCompiler0.run(CompilerInterface.scala:116)
	at xsbt.CachedCompiler0.run(CompilerInterface.scala:95)
	at xsbt.CompilerInterface.run(CompilerInterface.scala:26)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:497)
	at sbt.compiler.AnalyzingCompiler.call(AnalyzingCompiler.scala:107)
	at sbt.compiler.AnalyzingCompiler.compile(AnalyzingCompiler.scala:53)
	at sbt.compiler.AnalyzingCompiler.compile(AnalyzingCompiler.scala:47)
	at sbt.compiler.MixedAnalyzingCompiler$$anonfun$compileScala$1$1.apply$mcV$sp(MixedAnalyzingCompiler.scala:50)
	at sbt.compiler.MixedAnalyzingCompiler$$anonfun$compileScala$1$1.apply(MixedAnalyzingCompiler.scala:50)
	at sbt.compiler.MixedAnalyzingCompiler$$anonfun$compileScala$1$1.apply(MixedAnalyzingCompiler.scala:50)
	at sbt.compiler.MixedAnalyzingCompiler.timed(MixedAnalyzingCompiler.scala:74)
	at sbt.compiler.MixedAnalyzingCompiler.compileScala$1(MixedAnalyzingCompiler.scala:49)
	at sbt.compiler.MixedAnalyzingCompiler.compile(MixedAnalyzingCompiler.scala:64)
	at sbt.compiler.IC$$anonfun$compileInternal$1.apply(IncrementalCompiler.scala:160)
	at sbt.compiler.IC$$anonfun$compileInternal$1.apply(IncrementalCompiler.scala:160)
	at sbt.inc.IncrementalCompile$$anonfun$doCompile$1.apply(Compile.scala:66)
	at sbt.inc.IncrementalCompile$$anonfun$doCompile$1.apply(Compile.scala:64)
	at sbt.inc.IncrementalCommon.cycle(IncrementalCommon.scala:32)
	at sbt.inc.Incremental$$anonfun$1.apply(Incremental.scala:72)
	at sbt.inc.Incremental$$anonfun$1.apply(Incremental.scala:71)
	at sbt.inc.Incremental$.manageClassfiles(Incremental.scala:99)
	at sbt.inc.Incremental$.compile(Incremental.scala:71)
	at sbt.inc.IncrementalCompile$.apply(Compile.scala:54)
	at sbt.compiler.IC$.compileInternal(IncrementalCompiler.scala:160)
	at sbt.compiler.IC$.incrementalCompile(IncrementalCompiler.scala:138)
	at sbt.Compiler$.compile(Compiler.scala:155)
	at sbt.Compiler$.compile(Compiler.scala:141)
	at sbt.Defaults$.sbt$Defaults$$compileIncrementalTaskImpl(Defaults.scala:913)
	at sbt.Defaults$$anonfun$compileIncrementalTask$1.apply(Defaults.scala:904)
	at sbt.Defaults$$anonfun$compileIncrementalTask$1.apply(Defaults.scala:902)
	at scala.Function1$$anonfun$compose$1.apply(Function1.scala:47)
	at sbt.$tilde$greater$$anonfun$$u2219$1.apply(TypeFunctions.scala:40)
	at sbt.std.Transform$$anon$4.work(System.scala:63)
	at sbt.Execute$$anonfun$submit$1$$anonfun$apply$1.apply(Execute.scala:228)
	at sbt.Execute$$anonfun$submit$1$$anonfun$apply$1.apply(Execute.scala:228)
	at sbt.ErrorHandling$.wideConvert(ErrorHandling.scala:17)
	at sbt.Execute.work(Execute.scala:237)
	at sbt.Execute$$anonfun$submit$1.apply(Execute.scala:228)
	at sbt.Execute$$anonfun$submit$1.apply(Execute.scala:228)
	at sbt.ConcurrentRestrictions$$anon$4$$anonfun$1.apply(ConcurrentRestrictions.scala:159)
	at sbt.CompletionService$$anon$2.call(CompletionService.scala:28)
	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
	at java.lang.Thread.run(Thread.java:745)
[error] Error while emitting MetaBases.scala
[error] assertion failed:
[error]   MetaBases$MirrorBase$$anonfun$lambdaImpl$2
[error]      while compiling: squid/core/src/main/scala/squid/quasi/MetaBases.scala
[error]         during phase: jvm
[error]      library version: version 2.12.5
[error]     compiler version: version 2.12.5
[error]   reconstructed args: -deprecation -Xplugin:user/.ivy2/cache/org.scalamacros/paradise_2.12.5/jars/paradise_2.12.5-2.1.0.jar -feature -language:postfixOps -language:implicitConversions -language:higherKinds -classpath squid/core/target/scala-2.12/classes:squid/core_macros/target/scala-2.12/classes:user/.ivy2/cache/org.scala-lang/scala-compiler/jars/scala-compiler-2.12.5.jar:user/.ivy2/cache/org.scala-lang/scala-reflect/jars/scala-reflect-2.12.5.jar:user/.ivy2/cache/org.scala-lang.modules/scala-xml_2.12/bundles/scala-xml_2.12-1.0.6.jar:user/.ivy2/cache/org.scalactic/scalactic_2.12/bundles/scalactic_2.12-3.0.5.jar -unchecked -bootclasspath /Library/Java/JavaVirtualMachines/jdk1.8.0_65.jdk/Contents/Home/jre/lib/resources.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_65.jdk/Contents/Home/jre/lib/rt.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_65.jdk/Contents/Home/jre/lib/sunrsasign.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_65.jdk/Contents/Home/jre/lib/jsse.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_65.jdk/Contents/Home/jre/lib/jce.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_65.jdk/Contents/Home/jre/lib/charsets.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_65.jdk/Contents/Home/jre/lib/jfr.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_65.jdk/Contents/Home/jre/classes:user/.ivy2/cache/org.scala-lang/scala-library/jars/scala-library-2.12.5.jar
[error]
[error]   last tree to typer: TypeTree(class Universe)
[error]        tree position: line 406 of squid/core/src/main/scala/squid/quasi/MetaBases.scala
[error]             tree tpe: scala.reflect.api.Universe
[error]               symbol: abstract class Universe in package api
[error]    symbol definition: abstract class Universe extends Symbols with Types with FlagSets with Scopes with Names with Trees with Constants with Annotations with Positions with Exprs with TypeTags with ImplicitTags with StandardDefinitions with StandardNames with StandardLiftables with Mirrors with Printers with Liftables with Quasiquotes with Internals (a ClassSymbol)
[error]       symbol package: scala.reflect.api
[error]        symbol owners: class Universe
[error]            call site: constructor MetaBases$Runtime$ScalaReflectionBase in object MetaBases$Runtime$ScalaReflectionBase in package quasi
[error]
[error] == Source file context for tree position ==
[error]
[error]    403
[error]    404 object MetaBases {
[error]    405
[error]    406   object Runtime extends MetaBases {
[error]    407     val u: sru.type = sru
[error]    408
[error]    409     private var varCount = 0
java.lang.AssertionError: assertion failed: MetaBases$MirrorBase$$anonfun$lambdaImpl$2
	at scala.reflect.internal.SymbolTable.throwAssertionError(SymbolTable.scala:163)
	at scala.tools.nsc.backend.jvm.BCodeHelpers.isAnonymousOrLocalClass(BCodeHelpers.scala:77)
	at scala.tools.nsc.backend.jvm.BTypesFromSymbols.buildNonEmptyNestedInfo(BTypesFromSymbols.scala:471)
	at scala.tools.nsc.backend.jvm.BTypesFromSymbols.$anonfun$computeClassInfo$22(BTypesFromSymbols.scala:432)
	at scala.tools.nsc.backend.jvm.BTypesFromSymbols.$anonfun$computeClassInfo$21(BTypesFromSymbols.scala:432)
	at scala.tools.nsc.backend.jvm.BTypes$Lazy$LazyWithLock.$anonfun$init$1(BTypes.scala:1009)
	at scala.tools.nsc.backend.jvm.BTypes$Lazy$LazyWithLock.init(BTypes.scala:1008)
	at scala.tools.nsc.backend.jvm.BTypes$Lazy$AbstractLazy.force(BTypes.scala:990)
	at scala.tools.nsc.backend.jvm.BTypes$ClassBType.$anonfun$isNestedClass$1(BTypes.scala:681)
	at scala.tools.nsc.backend.jvm.BTypes$ClassBType.isNestedClass(BTypes.scala:681)
	at scala.tools.nsc.backend.jvm.BTypes$ClassBType.$anonfun$checkInfoConsistency$10(BTypes.scala:657)
	at scala.tools.nsc.backend.jvm.BTypes$ClassBType.$anonfun$checkInfoConsistency$9(BTypes.scala:657)
	at scala.tools.nsc.backend.jvm.BTypes$ClassBType.$anonfun$checkInfoConsistency$7(BTypes.scala:657)
	at scala.tools.nsc.backend.jvm.BTypes$ClassBType.$anonfun$checkInfoConsistency$7$adapted(BTypes.scala:656)
	at scala.tools.nsc.backend.jvm.BTypes$Lazy$AbstractLazy.force(BTypes.scala:993)
	at scala.tools.nsc.backend.jvm.analysis.BackendUtils$Collector.declaredNestedClasses(BackendUtils.scala:328)
	at scala.tools.nsc.backend.jvm.analysis.BackendUtils$NestedClassesCollector.visit(BackendUtils.scala:604)
	at scala.tools.nsc.backend.jvm.analysis.BackendUtils.collectNestedClasses(BackendUtils.scala:344)
	at scala.tools.nsc.backend.jvm.PostProcessor.setInnerClasses(PostProcessor.scala:125)
	at scala.tools.nsc.backend.jvm.PostProcessor.sendToDisk(PostProcessor.scala:59)
	at scala.tools.nsc.backend.jvm.GeneratedClassHandler$WritingClassHandler.$anonfun$postProcessUnit$3(GeneratedClassHandler.scala:112)
	at scala.tools.nsc.backend.jvm.GeneratedClassHandler$WritingClassHandler.$anonfun$postProcessUnit$2(GeneratedClassHandler.scala:112)
	at scala.runtime.java8.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.java:12)
	at scala.tools.nsc.backend.jvm.PostProcessorFrontendAccess$PostProcessorFrontendAccessImpl.withThreadLocalReporter(PostProcessorFrontendAccess.scala:213)
	at scala.tools.nsc.backend.jvm.GeneratedClassHandler$WritingClassHandler.$anonfun$postProcessUnit$1(GeneratedClassHandler.scala:111)
	at scala.runtime.java8.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.java:12)
	at scala.concurrent.Future$.$anonfun$apply$1(Future.scala:654)
	at scala.util.Success.$anonfun$map$1(Try.scala:251)
	at scala.util.Success.map(Try.scala:209)
	at scala.concurrent.Future.$anonfun$map$1(Future.scala:288)
	at scala.concurrent.impl.Promise.liftedTree1$1(Promise.scala:29)
	at scala.concurrent.impl.Promise.$anonfun$transform$1(Promise.scala:29)
	at scala.concurrent.impl.CallbackRunnable.run(Promise.scala:60)
	at scala.tools.nsc.backend.jvm.GeneratedClassHandler$SyncWritingClassHandler$$anonfun$$lessinit$greater$1.execute(GeneratedClassHandler.scala:165)
	at scala.concurrent.impl.ExecutionContextImpl.execute(ExecutionContextImpl.scala:20)
	at scala.concurrent.impl.CallbackRunnable.executeWithValue(Promise.scala:68)
	at scala.concurrent.impl.Promise$KeptPromise$Kept.onComplete(Promise.scala:368)
	at scala.concurrent.impl.Promise$KeptPromise$Kept.onComplete$(Promise.scala:367)
	at scala.concurrent.impl.Promise$KeptPromise$Successful.onComplete(Promise.scala:375)
	at scala.concurrent.impl.Promise.transform(Promise.scala:29)
	at scala.concurrent.impl.Promise.transform$(Promise.scala:27)
	at scala.concurrent.impl.Promise$KeptPromise$Successful.transform(Promise.scala:375)
	at scala.concurrent.Future.map(Future.scala:288)
	at scala.concurrent.Future.map$(Future.scala:288)
	at scala.concurrent.impl.Promise$KeptPromise$Successful.map(Promise.scala:375)
	at scala.tools.nsc.backend.jvm.GeneratedClassHandler$WritingClassHandler.postProcessUnit(GeneratedClassHandler.scala:107)
	at scala.tools.nsc.backend.jvm.GeneratedClassHandler$WritingClassHandler.process(GeneratedClassHandler.scala:100)
	at scala.tools.nsc.backend.jvm.CodeGen.genUnit(CodeGen.scala:61)
	at scala.tools.nsc.backend.jvm.GenBCode$BCodePhase.apply(GenBCode.scala:67)
	at scala.tools.nsc.Global$GlobalPhase.$anonfun$applyPhase$1(Global.scala:426)
	at scala.tools.nsc.Global$GlobalPhase.applyPhase(Global.scala:419)
	at scala.tools.nsc.Global$GlobalPhase.$anonfun$run$1(Global.scala:390)
	at scala.tools.nsc.Global$GlobalPhase.$anonfun$run$1$adapted(Global.scala:390)
	at scala.collection.Iterator.foreach(Iterator.scala:944)
	at scala.collection.Iterator.foreach$(Iterator.scala:944)
	at scala.collection.AbstractIterator.foreach(Iterator.scala:1432)
	at scala.tools.nsc.Global$GlobalPhase.run(Global.scala:390)
	at scala.tools.nsc.backend.jvm.GenBCode$BCodePhase.super$run(GenBCode.scala:73)
	at scala.tools.nsc.backend.jvm.GenBCode$BCodePhase.$anonfun$run$1(GenBCode.scala:73)
	at scala.tools.nsc.backend.jvm.GenBCode$BCodePhase.run(GenBCode.scala:71)
	at scala.tools.nsc.Global$Run.compileUnitsInternal(Global.scala:1446)
	at scala.tools.nsc.Global$Run.compileUnits(Global.scala:1430)
	at scala.tools.nsc.Global$Run.compileSources(Global.scala:1423)
	at scala.tools.nsc.Global$Run.compile(Global.scala:1539)
	at xsbt.CachedCompiler0.run(CompilerInterface.scala:116)
	at xsbt.CachedCompiler0.run(CompilerInterface.scala:95)
	at xsbt.CompilerInterface.run(CompilerInterface.scala:26)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:497)
	at sbt.compiler.AnalyzingCompiler.call(AnalyzingCompiler.scala:107)
	at sbt.compiler.AnalyzingCompiler.compile(AnalyzingCompiler.scala:53)
	at sbt.compiler.AnalyzingCompiler.compile(AnalyzingCompiler.scala:47)
	at sbt.compiler.MixedAnalyzingCompiler$$anonfun$compileScala$1$1.apply$mcV$sp(MixedAnalyzingCompiler.scala:50)
	at sbt.compiler.MixedAnalyzingCompiler$$anonfun$compileScala$1$1.apply(MixedAnalyzingCompiler.scala:50)
	at sbt.compiler.MixedAnalyzingCompiler$$anonfun$compileScala$1$1.apply(MixedAnalyzingCompiler.scala:50)
	at sbt.compiler.MixedAnalyzingCompiler.timed(MixedAnalyzingCompiler.scala:74)
	at sbt.compiler.MixedAnalyzingCompiler.compileScala$1(MixedAnalyzingCompiler.scala:49)
	at sbt.compiler.MixedAnalyzingCompiler.compile(MixedAnalyzingCompiler.scala:64)
	at sbt.compiler.IC$$anonfun$compileInternal$1.apply(IncrementalCompiler.scala:160)
	at sbt.compiler.IC$$anonfun$compileInternal$1.apply(IncrementalCompiler.scala:160)
	at sbt.inc.IncrementalCompile$$anonfun$doCompile$1.apply(Compile.scala:66)
	at sbt.inc.IncrementalCompile$$anonfun$doCompile$1.apply(Compile.scala:64)
	at sbt.inc.IncrementalCommon.cycle(IncrementalCommon.scala:32)
	at sbt.inc.Incremental$$anonfun$1.apply(Incremental.scala:72)
	at sbt.inc.Incremental$$anonfun$1.apply(Incremental.scala:71)
	at sbt.inc.Incremental$.manageClassfiles(Incremental.scala:99)
	at sbt.inc.Incremental$.compile(Incremental.scala:71)
	at sbt.inc.IncrementalCompile$.apply(Compile.scala:54)
	at sbt.compiler.IC$.compileInternal(IncrementalCompiler.scala:160)
	at sbt.compiler.IC$.incrementalCompile(IncrementalCompiler.scala:138)
	at sbt.Compiler$.compile(Compiler.scala:155)
	at sbt.Compiler$.compile(Compiler.scala:141)
	at sbt.Defaults$.sbt$Defaults$$compileIncrementalTaskImpl(Defaults.scala:913)
	at sbt.Defaults$$anonfun$compileIncrementalTask$1.apply(Defaults.scala:904)
	at sbt.Defaults$$anonfun$compileIncrementalTask$1.apply(Defaults.scala:902)
	at scala.Function1$$anonfun$compose$1.apply(Function1.scala:47)
	at sbt.$tilde$greater$$anonfun$$u2219$1.apply(TypeFunctions.scala:40)
	at sbt.std.Transform$$anon$4.work(System.scala:63)
	at sbt.Execute$$anonfun$submit$1$$anonfun$apply$1.apply(Execute.scala:228)
	at sbt.Execute$$anonfun$submit$1$$anonfun$apply$1.apply(Execute.scala:228)
	at sbt.ErrorHandling$.wideConvert(ErrorHandling.scala:17)
	at sbt.Execute.work(Execute.scala:237)
	at sbt.Execute$$anonfun$submit$1.apply(Execute.scala:228)
	at sbt.Execute$$anonfun$submit$1.apply(Execute.scala:228)
	at sbt.ConcurrentRestrictions$$anon$4$$anonfun$1.apply(ConcurrentRestrictions.scala:159)
	at sbt.CompletionService$$anon$2.call(CompletionService.scala:28)
	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
	at java.lang.Thread.run(Thread.java:745)
[error] Error while emitting squid/quasi/MetaBases$MirrorBase
[error] assertion failed: MetaBases$MirrorBase$$anonfun$lambdaImpl$2
[error] two errors found
[error] (core/compile:compileIncremental) Compilation failed
@hrhino
Copy link

hrhino commented Apr 29, 2018

Seems like a manifestation of #2806.

@SethTisue
Copy link
Member

agree, I suggest this be a comment on #2806 and we close it here.

LPTK added a commit to epfldata/squid that referenced this issue Apr 30, 2018
The main difficulties in porting the code base to 2.12 were:
 * two compiler bugs introduced by Scala 2.12, reported at:
    - scala/bug#10856
    - scala/bug#10857
 * the limitations of Scala runtime reflection with respect
   to the new encoding of function values (Java 8 lambdas), which
   affected Squid’s reflection-based interpreter
 * a subtle change in the behavior of Scala’s reify{} used by Scalatest,
   which produced an extruded variable when used inside invocations of
   Squid’s rewrite macro
LPTK added a commit to epfldata/squid that referenced this issue Apr 30, 2018
The main difficulties in porting the code base to 2.12 were:
 * two compiler bugs introduced by Scala 2.12, reported at:
    - scala/bug#10856
    - scala/bug#10857
 * the limitations of Scala runtime reflection with respect
   to the new encoding of function values (Java 8 lambdas), which
   affected Squid’s reflection-based interpreter
 * a subtle change in the behavior of Scala’s reify{} used by Scalatest,
   which produced an extruded variable when used inside invocations of
   Squid’s rewrite macro
@SethTisue SethTisue added this to the Backlog milestone May 23, 2020
@sjrd
Copy link
Member

sjrd commented May 9, 2022

Here is a self-contained, probably close to minimal reproduction:

package test

class JSFunction

trait JSFunction0[+R] extends JSFunction {
  def apply(): R
}

object A {
  def lambdaAnything() = test(() => 1)
  def test(cmp: JSFunction0[Int]) = ()
}
$ cs launch scalac:2.13.8 -- Test.scala 
error: Error while emitting Test.scala
assertion failed:
  A$$anonfun$lambdaAnything$2
     while compiling: Test.scala
        during phase: jvm
     library version: version 2.13.8
    compiler version: version 2.13.8
  reconstructed args:

  last tree to typer: TypeTree(<$anon: test.JSFunction with test.JSFunction0>)
       tree position: line 10 of Test.scala
            tree tpe: test.anonfun$lambdaAnything$2
              symbol: final <$anon: test.JSFunction with test.JSFunction0> in package test
   symbol definition: final class anonfun$lambdaAnything$2 extends JSFunction with JSFunction0 (a ClassSymbol)
      symbol package: test
       symbol owners: <$anon: test.JSFunction with test.JSFunction0>
           call site: constructor A$$anonfun$lambdaAnything$2 in package test

== Source file context for tree position ==

     7 }
     8
     9 object A {
    10   def lambdaAnything() = test(() => 1)
    11   def test(cmp: JSFunction0[Int]) = ()
    12 }
    13
error: Error while emitting Test.scala
assertion failed: A$$anonfun$lambdaAnything$2
2 errors

Reproducible with 2.12.15 and 2.13.8.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants