Open
Description
Compiler version
3.3.1-RC1-bin-20230412-e940957-NIGHTLY and before
Minimized code
object Foo:
opaque type Baz = Int
def fun: (arg: Foo.type) => arg.Baz = ???
Output (click arrow to expand)
error when pickling type arg.type
error when pickling type arg.Baz
error when pickling tree arg.Baz
error when pickling tree Foo.type => arg.Baz
error when pickling tree (Foo.type => arg.Baz)
{
def apply(arg: Foo.type): arg.Baz
}
error when pickling tree def fun:
(Foo.type => arg.Baz)
{
def apply(arg: Foo.type): arg.Baz
}
= ???
error when pickling tree () extends Object() { this: bug$package.type =>
private def writeReplace(): AnyRef =
new scala.runtime.ModuleSerializationProxy(classOf[bug$package.type])
def fun:
(Foo.type => arg.Baz)
{
def apply(arg: Foo.type): arg.Baz
}
= ???
}
error when pickling tree @SourceFile("bug.scala") final module class bug$package() extends Object() {
this: bug$package.type =>
private def writeReplace(): AnyRef =
new scala.runtime.ModuleSerializationProxy(classOf[bug$package.type])
def fun:
(Foo.type => arg.Baz)
{
def apply(arg: Foo.type): arg.Baz
}
= ???
}
error when pickling tree package <empty> {
final lazy module val bug$package: bug$package = new bug$package()
@SourceFile("bug.scala") final module class bug$package() extends Object() {
this: bug$package.type =>
private def writeReplace(): AnyRef =
new scala.runtime.ModuleSerializationProxy(classOf[bug$package.type])
def fun:
(Foo.type => arg.Baz)
{
def apply(arg: Foo.type): arg.Baz
}
= ???
}
}
unhandled exception while running pickler on bug.scala
Exception in thread "main" java.lang.AssertionError: assertion failed: orphan parameter reference: TermParamRef(arg)
at scala.runtime.Scala3RunTime$.assertFailed(Scala3RunTime.scala:8)
at dotty.tools.dotc.core.tasty.TreePickler.pickleNewType(TreePickler.scala:292)
at dotty.tools.dotc.core.tasty.TreePickler.pickleType(TreePickler.scala:162)
at dotty.tools.dotc.core.tasty.TreePickler.pickleExternalRef$1(TreePickler.scala:202)
at dotty.tools.dotc.core.tasty.TreePickler.pickleNewType(TreePickler.scala:224)
at dotty.tools.dotc.core.tasty.TreePickler.pickleType(TreePickler.scala:162)
at dotty.tools.dotc.core.tasty.TreePickler.pickleTree(TreePickler.scala:625)
at dotty.tools.dotc.core.tasty.TreePickler.pickleTree$$anonfun$20(TreePickler.scala:641)
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(TreePickler.scala:641)
at dotty.tools.dotc.core.tasty.TreePickler.pickleTree(TreePickler.scala:637)
at dotty.tools.dotc.core.tasty.TreePickler.pickleTpt(TreePickler.scala:319)
at dotty.tools.dotc.core.tasty.TreePickler.pickleDef(TreePickler.scala:338)
at dotty.tools.dotc.core.tasty.TreePickler.pickleTree(TreePickler.scala:581)
at dotty.tools.dotc.core.tasty.TreePickler.pickleStats$$anonfun$2(TreePickler.scala:373)
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:373)
at dotty.tools.dotc.core.tasty.TreePickler.pickleTree(TreePickler.scala:607)
at dotty.tools.dotc.core.tasty.TreePickler.pickleDef(TreePickler.scala:337)
at dotty.tools.dotc.core.tasty.TreePickler.pickleTree(TreePickler.scala:583)
at dotty.tools.dotc.core.tasty.TreePickler.pickleStats$$anonfun$2(TreePickler.scala:373)
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:373)
at dotty.tools.dotc.core.tasty.TreePickler.pickleTree(TreePickler.scala:623)
at dotty.tools.dotc.core.tasty.TreePickler.pickle$$anonfun$1(TreePickler.scala:797)
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:804)
at dotty.tools.dotc.transform.Pickler.run$$anonfun$1$$anonfun$1(Pickler.scala:90)
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:142)
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:142)
at dotty.tools.dotc.core.Phases$Phase.runOn$$anonfun$1(Phases.scala:324)
at scala.collection.immutable.List.map(List.scala:246)
at dotty.tools.dotc.core.Phases$Phase.runOn(Phases.scala:328)
at dotty.tools.dotc.transform.Pickler.runOn(Pickler.scala:150)
at dotty.tools.dotc.Run.runPhases$1$$anonfun$1(Run.scala:246)
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:1321)
at dotty.tools.dotc.Run.runPhases$1(Run.scala:262)
at dotty.tools.dotc.Run.compileUnits$$anonfun$1(Run.scala:270)
at dotty.tools.dotc.Run.compileUnits$$anonfun$adapted$1(Run.scala:279)
at dotty.tools.dotc.util.Stats$.maybeMonitored(Stats.scala:67)
at dotty.tools.dotc.Run.compileUnits(Run.scala:279)
at dotty.tools.dotc.Run.compileSources(Run.scala:194)
at dotty.tools.dotc.Run.compile(Run.scala:179)
at dotty.tools.dotc.Driver.doCompile(Driver.scala:37)
at dotty.tools.dotc.Driver.process(Driver.scala:197)
at dotty.tools.dotc.Driver.process(Driver.scala:165)
at dotty.tools.dotc.Driver.process(Driver.scala:177)
at dotty.tools.dotc.Driver.main(Driver.scala:207)
at dotty.tools.dotc.Main.main(Main.scala)
The crash does not occur if at least one of the following is true:
- the type of
arg
is a class (e.g.Foo
) or a literal type pointing to a val (e.g.foo.type
) type Baz
is not opaque