Skip to content

anonymous class crash pickler via transparent inline cascade of a literal type member #13503

Closed
@soronpo

Description

@soronpo

Compiler version

v3.1.0-RC1

Minimized code

trait First {type Out}
given First with {type Out = 123}

trait Second {type Out} 
transparent inline given (using f: First): Second = new Second {type Out = f.Out}

val s = summon[Second]

Output (click arrow to expand)

scala.MatchError: Literal(Constant(123)) (of class dotty.tools.dotc.ast.Trees$Literal)
	at dotty.tools.dotc.core.tasty.TreePickler.pickleDef$$anonfun$1(TreePickler.scala:343)
	at dotty.tools.dotc.core.tasty.TreePickler.withLength(TreePickler.scala:69)
	at dotty.tools.dotc.core.tasty.TreePickler.pickleDef(TreePickler.scala:347)
	at dotty.tools.dotc.core.tasty.TreePickler.pickleTree(TreePickler.scala:573)
	at dotty.tools.dotc.core.tasty.TreePickler.pickleStats$$anonfun$2(TreePickler.scala:371)
	at scala.runtime.function.JProcedure1.apply(JProcedure1.java:15)
	at scala.runtime.function.JProcedure1.apply(JProcedure1.java:10)
	at scala.collection.immutable.List.foreach(List.scala:333)
	at dotty.tools.dotc.core.tasty.TreePickler.pickleStats(TreePickler.scala:371)
	at dotty.tools.dotc.core.tasty.TreePickler.pickleTree$$anonfun$26(TreePickler.scala:597)
	at dotty.tools.dotc.core.tasty.TreePickler.withLength(TreePickler.scala:69)
	at dotty.tools.dotc.core.tasty.TreePickler.pickleTree(TreePickler.scala:598)
	at dotty.tools.dotc.core.tasty.TreePickler.pickleDef$$anonfun$1(TreePickler.scala:342)
	at dotty.tools.dotc.core.tasty.TreePickler.withLength(TreePickler.scala:69)
	at dotty.tools.dotc.core.tasty.TreePickler.pickleDef(TreePickler.scala:347)
	at dotty.tools.dotc.core.tasty.TreePickler.pickleTree(TreePickler.scala:573)
	at dotty.tools.dotc.core.tasty.TreePickler.pickleTree$$anonfun$40$$anonfun$1(TreePickler.scala:480)
	at scala.runtime.function.JProcedure1.apply(JProcedure1.java:15)
	at scala.runtime.function.JProcedure1.apply(JProcedure1.java:10)
	at scala.collection.immutable.List.foreach(List.scala:333)
	at dotty.tools.dotc.core.tasty.TreePickler.pickleTree$$anonfun$9(TreePickler.scala:480)
	at dotty.tools.dotc.core.tasty.TreePickler.withLength(TreePickler.scala:69)
	at dotty.tools.dotc.core.tasty.TreePickler.pickleTree(TreePickler.scala:480)
	at dotty.tools.dotc.core.tasty.TreePickler.pickleTree$$anonfun$19(TreePickler.scala:524)
	at dotty.tools.dotc.core.tasty.TreePickler.withLength(TreePickler.scala:69)
	at dotty.tools.dotc.core.tasty.TreePickler.pickleTree(TreePickler.scala:530)
	at dotty.tools.dotc.core.tasty.TreePickler.pickleTree$$anonfun$19(TreePickler.scala:524)
	at dotty.tools.dotc.core.tasty.TreePickler.withLength(TreePickler.scala:69)
	at dotty.tools.dotc.core.tasty.TreePickler.pickleTree(TreePickler.scala:530)
	at dotty.tools.dotc.core.tasty.TreePickler.pickleTree$$anonfun$19(TreePickler.scala:524)
	at dotty.tools.dotc.core.tasty.TreePickler.withLength(TreePickler.scala:69)
	at dotty.tools.dotc.core.tasty.TreePickler.pickleTree(TreePickler.scala:530)
	at dotty.tools.dotc.core.tasty.TreePickler.pickleTreeUnlessEmpty(TreePickler.scala:330)
	at dotty.tools.dotc.core.tasty.TreePickler.pickleDef$$anonfun$1(TreePickler.scala:345)
	at dotty.tools.dotc.core.tasty.TreePickler.withLength(TreePickler.scala:69)
	at dotty.tools.dotc.core.tasty.TreePickler.pickleDef(TreePickler.scala:347)
	at dotty.tools.dotc.core.tasty.TreePickler.pickleTree(TreePickler.scala:556)
	at dotty.tools.dotc.core.tasty.TreePickler.pickleStats$$anonfun$2(TreePickler.scala:371)
	at scala.runtime.function.JProcedure1.apply(JProcedure1.java:15)
	at scala.runtime.function.JProcedure1.apply(JProcedure1.java:10)
	at scala.collection.immutable.List.foreach(List.scala:333)
	at dotty.tools.dotc.core.tasty.TreePickler.pickleStats(TreePickler.scala:371)
	at dotty.tools.dotc.core.tasty.TreePickler.pickleTree$$anonfun$26(TreePickler.scala:597)
	at dotty.tools.dotc.core.tasty.TreePickler.withLength(TreePickler.scala:69)
	at dotty.tools.dotc.core.tasty.TreePickler.pickleTree(TreePickler.scala:598)
	at dotty.tools.dotc.core.tasty.TreePickler.pickleDef$$anonfun$1(TreePickler.scala:342)
	at dotty.tools.dotc.core.tasty.TreePickler.withLength(TreePickler.scala:69)
	at dotty.tools.dotc.core.tasty.TreePickler.pickleDef(TreePickler.scala:347)
	at dotty.tools.dotc.core.tasty.TreePickler.pickleTree(TreePickler.scala:573)
	at dotty.tools.dotc.core.tasty.TreePickler.pickleStats$$anonfun$2(TreePickler.scala:371)
	at scala.runtime.function.JProcedure1.apply(JProcedure1.java:15)
	at scala.runtime.function.JProcedure1.apply(JProcedure1.java:10)
	at scala.collection.immutable.List.foreach(List.scala:333)
	at dotty.tools.dotc.core.tasty.TreePickler.pickleStats(TreePickler.scala:371)
	at dotty.tools.dotc.core.tasty.TreePickler.pickleTree$$anonfun$29(TreePickler.scala:613)
	at dotty.tools.dotc.core.tasty.TreePickler.withLength(TreePickler.scala:69)
	at dotty.tools.dotc.core.tasty.TreePickler.pickleTree(TreePickler.scala:613)
	at dotty.tools.dotc.core.tasty.TreePickler.pickle$$anonfun$1(TreePickler.scala:784)
	at scala.runtime.function.JProcedure1.apply(JProcedure1.java:15)
	at scala.runtime.function.JProcedure1.apply(JProcedure1.java:10)
	at scala.collection.immutable.List.foreach(List.scala:333)
	at dotty.tools.dotc.core.tasty.TreePickler.pickle(TreePickler.scala:784)
	at dotty.tools.dotc.transform.Pickler.run$$anonfun$3$$anonfun$2(Pickler.scala:69)
	at scala.runtime.function.JProcedure1.apply(JProcedure1.java:15)
	at scala.runtime.function.JProcedure1.apply(JProcedure1.java:10)
	at scala.collection.immutable.List.foreach(List.scala:333)
	at dotty.tools.dotc.transform.Pickler.run$$anonfun$1(Pickler.scala:106)
	at scala.runtime.function.JProcedure1.apply(JProcedure1.java:15)
	at scala.runtime.function.JProcedure1.apply(JProcedure1.java:10)
	at scala.collection.immutable.List.foreach(List.scala:333)
	at dotty.tools.dotc.transform.Pickler.run(Pickler.scala:106)
	at dotty.tools.dotc.core.Phases$Phase.runOn$$anonfun$1(Phases.scala:303)
	at scala.collection.immutable.List.map(List.scala:246)
	at dotty.tools.dotc.core.Phases$Phase.runOn(Phases.scala:304)
	at dotty.tools.dotc.transform.Pickler.runOn(Pickler.scala:111)
	at dotty.tools.dotc.Run.runPhases$4$$anonfun$4(Run.scala:205)
	at scala.runtime.function.JProcedure1.apply(JProcedure1.java:15)
	at scala.runtime.function.JProcedure1.apply(JProcedure1.java:10)
	at scala.collection.ArrayOps$.foreach$extension(ArrayOps.scala:1323)
	at dotty.tools.dotc.Run.runPhases$5(Run.scala:215)
	at dotty.tools.dotc.Run.compileUnits$$anonfun$1(Run.scala:223)
	at scala.runtime.java8.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.scala:18)
	at dotty.tools.dotc.util.Stats$.maybeMonitored(Stats.scala:67)
	at dotty.tools.dotc.Run.compileUnits(Run.scala:230)
	at dotty.tools.dotc.Run.compileSources(Run.scala:166)
	at dotty.tools.dotc.Run.compile(Run.scala:150)
	at dotty.tools.dotc.Driver.doCompile(Driver.scala:39)
	at dotty.tools.xsbt.CompilerBridgeDriver.run(CompilerBridgeDriver.java:88)
	at dotty.tools.xsbt.CompilerBridge.run(CompilerBridge.java:22)
	at sbt.internal.inc.AnalyzingCompiler.compile(AnalyzingCompiler.scala:91)
	at sbt.internal.inc.MixedAnalyzingCompiler.$anonfun$compile$7(MixedAnalyzingCompiler.scala:192)
	at scala.runtime.java8.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.java:23)
	at sbt.internal.inc.MixedAnalyzingCompiler.timed(MixedAnalyzingCompiler.scala:247)
	at sbt.internal.inc.MixedAnalyzingCompiler.$anonfun$compile$4(MixedAnalyzingCompiler.scala:182)
	at sbt.internal.inc.MixedAnalyzingCompiler.$anonfun$compile$4$adapted(MixedAnalyzingCompiler.scala:163)
	at sbt.internal.inc.JarUtils$.withPreviousJar(JarUtils.scala:239)
	at sbt.internal.inc.MixedAnalyzingCompiler.compileScala$1(MixedAnalyzingCompiler.scala:163)
	at sbt.internal.inc.MixedAnalyzingCompiler.compile(MixedAnalyzingCompiler.scala:210)
	at sbt.internal.inc.IncrementalCompilerImpl.$anonfun$compileInternal$1(IncrementalCompilerImpl.scala:528)
	at sbt.internal.inc.IncrementalCompilerImpl.$anonfun$compileInternal$1$adapted(IncrementalCompilerImpl.scala:528)
	at sbt.internal.inc.Incremental$.$anonfun$apply$5(Incremental.scala:175)
	at sbt.internal.inc.Incremental$.$anonfun$apply$5$adapted(Incremental.scala:173)
	at sbt.internal.inc.Incremental$$anon$2.run(Incremental.scala:459)
	at sbt.internal.inc.IncrementalCommon$CycleState.next(IncrementalCommon.scala:116)
	at sbt.internal.inc.IncrementalCommon$$anon$1.next(IncrementalCommon.scala:56)
	at sbt.internal.inc.IncrementalCommon$$anon$1.next(IncrementalCommon.scala:52)
	at sbt.internal.inc.IncrementalCommon.cycle(IncrementalCommon.scala:263)
	at sbt.internal.inc.Incremental$.$anonfun$incrementalCompile$8(Incremental.scala:414)
	at sbt.internal.inc.Incremental$.withClassfileManager(Incremental.scala:501)
	at sbt.internal.inc.Incremental$.incrementalCompile(Incremental.scala:401)
	at sbt.internal.inc.Incremental$.apply(Incremental.scala:167)
	at sbt.internal.inc.IncrementalCompilerImpl.compileInternal(IncrementalCompilerImpl.scala:528)
	at sbt.internal.inc.IncrementalCompilerImpl.$anonfun$compileIncrementally$1(IncrementalCompilerImpl.scala:482)
	at sbt.internal.inc.IncrementalCompilerImpl.handleCompilationError(IncrementalCompilerImpl.scala:332)
	at sbt.internal.inc.IncrementalCompilerImpl.compileIncrementally(IncrementalCompilerImpl.scala:420)
	at sbt.internal.inc.IncrementalCompilerImpl.compile(IncrementalCompilerImpl.scala:137)
	at sbt.Defaults$.compileIncrementalTaskImpl(Defaults.scala:2357)
	at sbt.Defaults$.$anonfun$compileIncrementalTask$2(Defaults.scala:2314)
	at sbt.internal.io.Retry$.apply(Retry.scala:46)
	at sbt.internal.io.Retry$.apply(Retry.scala:28)
	at sbt.internal.io.Retry$.apply(Retry.scala:23)
	at sbt.internal.server.BspCompileTask$.compute(BspCompileTask.scala:31)
	at sbt.Defaults$.$anonfun$compileIncrementalTask$1(Defaults.scala:2310)
	at scala.Function1.$anonfun$compose$1(Function1.scala:49)
	at sbt.internal.util.$tilde$greater.$anonfun$$u2219$1(TypeFunctions.scala:62)
	at sbt.std.Transform$$anon$4.work(Transform.scala:68)
	at sbt.Execute.$anonfun$submit$2(Execute.scala:282)
	at sbt.internal.util.ErrorHandling$.wideConvert(ErrorHandling.scala:23)
	at sbt.Execute.work(Execute.scala:291)
	at sbt.Execute.$anonfun$submit$1(Execute.scala:282)
	at sbt.ConcurrentRestrictions$$anon$4.$anonfun$submitValid$1(ConcurrentRestrictions.scala:265)
	at sbt.CompletionService$$anon$2.call(CompletionService.scala:64)
	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:1149)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
	at java.lang.Thread.run(Thread.java:748)

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions