Last active
September 28, 2017 17:07
-
-
Save teigen/ce283eb0d5ab235cd78d6b52c7ffa65e to your computer and use it in GitHub Desktop.
SAM returning value class crashes compiler
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
package sam | |
// scala 2.12.3 | |
object SonOfSAM { | |
val long:SonOfSAM[Long] = i => new Foo(i) | |
} | |
trait SonOfSAM[A]{ | |
def foo(a:A):Foo | |
} | |
class Foo(val toLong:Long) extends AnyVal |
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
λ scalac Err.scala | |
warning: an unexpected type representation reached the compiler backend while compiling Err.scala: ErasedValueType(class Foo, Long). If possible, please file a bug on https://github.com/scala/bug/issues. | |
scala.MatchError: ErasedValueType(class Foo, Long) (of class scala.reflect.internal.Types$UniqueErasedValueType) | |
at scala.tools.nsc.backend.jvm.BTypesFromSymbols.typeToBType(BTypesFromSymbols.scala:220) | |
at scala.tools.nsc.backend.jvm.BTypesFromSymbols.methodBTypeFromMethodType(BTypesFromSymbols.scala:154) | |
at scala.tools.nsc.backend.jvm.BTypesFromSymbols.methodBTypeFromSymbol(BTypesFromSymbols.scala:145) | |
at scala.tools.nsc.backend.jvm.BTypesFromSymbols.$anonfun$buildInlineInfoFromClassSymbol$6(BTypesFromSymbols.scala:604) | |
at scala.collection.Iterator$$anon$11.nextCur(Iterator.scala:473) | |
at scala.collection.Iterator$$anon$11.hasNext(Iterator.scala:479) | |
at scala.collection.Iterator.foreach(Iterator.scala:929) | |
at scala.collection.Iterator.foreach$(Iterator.scala:929) | |
at scala.collection.AbstractIterator.foreach(Iterator.scala:1417) | |
at scala.collection.TraversableOnce.toMap(TraversableOnce.scala:316) | |
at scala.collection.TraversableOnce.toMap$(TraversableOnce.scala:314) | |
at scala.collection.AbstractIterator.toMap(Iterator.scala:1417) | |
at scala.tools.nsc.backend.jvm.BTypesFromSymbols.buildInlineInfoFromClassSymbol(BTypesFromSymbols.scala:637) | |
at scala.tools.nsc.backend.jvm.BTypesFromSymbols.buildFromSymbol$1(BTypesFromSymbols.scala:536) | |
at scala.tools.nsc.backend.jvm.BTypesFromSymbols.buildInlineInfo(BTypesFromSymbols.scala:541) | |
at scala.tools.nsc.backend.jvm.BTypesFromSymbols.setClassInfo(BTypesFromSymbols.scala:458) | |
at scala.tools.nsc.backend.jvm.BTypesFromSymbols.classBTypeFromSymbol(BTypesFromSymbols.scala:134) | |
at scala.tools.nsc.backend.jvm.BCodeSkelBuilder$PlainSkelBuilder.genPlainClass(BCodeSkelBuilder.scala:94) | |
at scala.tools.nsc.backend.jvm.GenBCode$BCodePhase$Worker1.visit(GenBCode.scala:190) | |
at scala.tools.nsc.backend.jvm.GenBCode$BCodePhase$Worker1.$anonfun$run$1(GenBCode.scala:139) | |
at scala.tools.nsc.backend.jvm.GenBCode$BCodePhase$Worker1.run(GenBCode.scala:139) | |
at scala.tools.nsc.backend.jvm.GenBCode$BCodePhase.buildAndSendToDisk(GenBCode.scala:381) | |
at scala.tools.nsc.backend.jvm.GenBCode$BCodePhase.run(GenBCode.scala:350) | |
at scala.tools.nsc.Global$Run.compileUnitsInternal(Global.scala:1431) | |
at scala.tools.nsc.Global$Run.compileUnits(Global.scala:1416) | |
at scala.tools.nsc.Global$Run.compileSources(Global.scala:1412) | |
at scala.tools.nsc.Global$Run.compile(Global.scala:1515) | |
at scala.tools.nsc.Driver.doCompile(Driver.scala:35) | |
at scala.tools.nsc.MainClass.doCompile(Main.scala:24) | |
at scala.tools.nsc.Driver.process(Driver.scala:55) | |
at scala.tools.nsc.Driver.main(Driver.scala:68) | |
at scala.tools.nsc.Main.main(Main.scala) | |
error: Error while emitting Err.scala | |
ErasedValueType(class Foo, Long) (of class scala.reflect.internal.Types$UniqueErasedValueType) | |
java.lang.AssertionError: assertion failed: ClassBType.info not yet assigned: Lsam/SonOfSAM$; | |
at scala.tools.nsc.backend.jvm.BTypes$ClassBType.info(BTypes.scala:891) | |
at scala.tools.nsc.backend.jvm.BTypes$ClassBType.isNestedClass(BTypes.scala:951) | |
at scala.tools.nsc.backend.jvm.analysis.BackendUtils$Collector.getClassIfNested(BackendUtils.scala:297) | |
at scala.tools.nsc.backend.jvm.analysis.BackendUtils$NestedClassesCollector.visitInternalName(BackendUtils.scala:517) | |
at scala.tools.nsc.backend.jvm.analysis.BackendUtils$NestedClassesCollector.visitInternalNameOrArrayReference(BackendUtils.scala:526) | |
at scala.tools.nsc.backend.jvm.analysis.BackendUtils$NestedClassesCollector.$anonfun$visit$3(BackendUtils.scala:504) | |
at scala.tools.nsc.backend.jvm.analysis.BackendUtils$NestedClassesCollector.$anonfun$visit$3$adapted(BackendUtils.scala:486) | |
at scala.collection.Iterator.foreach(Iterator.scala:929) | |
at scala.collection.Iterator.foreach$(Iterator.scala:929) | |
at scala.collection.AbstractIterator.foreach(Iterator.scala:1417) | |
at scala.collection.IterableLike.foreach(IterableLike.scala:71) | |
at scala.collection.IterableLike.foreach$(IterableLike.scala:70) | |
at scala.collection.AbstractIterable.foreach(Iterable.scala:54) | |
at scala.tools.nsc.backend.jvm.analysis.BackendUtils$NestedClassesCollector.visit(BackendUtils.scala:486) | |
at scala.tools.nsc.backend.jvm.analysis.BackendUtils.collectNestedClasses(BackendUtils.scala:309) | |
at scala.tools.nsc.backend.jvm.GenBCode$BCodePhase$Worker2.setInnerClasses(GenBCode.scala:253) | |
at scala.tools.nsc.backend.jvm.GenBCode$BCodePhase$Worker2.run(GenBCode.scala:268) | |
at scala.tools.nsc.backend.jvm.GenBCode$BCodePhase.buildAndSendToDisk(GenBCode.scala:384) | |
at scala.tools.nsc.backend.jvm.GenBCode$BCodePhase.run(GenBCode.scala:350) | |
at scala.tools.nsc.Global$Run.compileUnitsInternal(Global.scala:1431) | |
at scala.tools.nsc.Global$Run.compileUnits(Global.scala:1416) | |
at scala.tools.nsc.Global$Run.compileSources(Global.scala:1412) | |
at scala.tools.nsc.Global$Run.compile(Global.scala:1515) | |
at scala.tools.nsc.Driver.doCompile(Driver.scala:35) | |
at scala.tools.nsc.MainClass.doCompile(Main.scala:24) | |
at scala.tools.nsc.Driver.process(Driver.scala:55) | |
at scala.tools.nsc.Driver.main(Driver.scala:68) | |
at scala.tools.nsc.Main.main(Main.scala) | |
error: Error while emitting sam/SonOfSAM | |
assertion failed: ClassBType.info not yet assigned: Lsam/SonOfSAM$; | |
one warning found | |
two errors found |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment