Closed
Description
Compiler version
Latest main
(1604e77).
Minimized code
//> using scala 3.6.0-RC1-bin-SNAPSHOT
import language.experimental.captureChecking
class Box[Cap^] {}
def run[Cap^](f: Box[Cap]^{Cap^} => Unit): Box[Cap]^{Cap^} = ???
def main() =
val b = run(_ => ())
// val b = run[caps.CapSet](_ => ()) // this compiles
Output (click arrow to expand)
[info] running (fork) dotty.tools.dotc.Main -d /home/nki/Projects/dotty/compiler/../out/default-last-scalac-out.jar -classpath /home/nki/.cache/coursier/v1/https/repo1.maven.org/maven2/org/scala-lang/scala-library/2.13.14/scala-library-2.13.14.jar:/home/nki/Projects/dotty/library/../out/bootstrap/scala3-library-bootstrapped/scala-3.6.0-RC1-bin-SNAPSHOT-nonbootstrapped/scala3-library_3-3.6.0-RC1-bin-SNAPSHOT.jar test.scala
error when pickling type Cap
error when pickling tree Cap of class class dotty.tools.dotc.ast.Trees$Ident
error when pickling tree _root_.scala.caps.capsOf[Cap] of class class dotty.tools.dotc.ast.Trees$TypeApply
error when pickling tree [_root_.scala.caps.capsOf[Cap] : Any @retainsArg] of class class dotty.tools.dotc.ast.Trees$SeqLiteral
error when pickling tree [_root_.scala.caps.capsOf[Cap] : Any @retainsArg]* of class class dotty.tools.dotc.ast.Trees$Typed
error when pickling tree new _root_.scala.annotation.retains(
[_root_.scala.caps.capsOf[Cap] : Any @retainsArg]*) of class class dotty.tools.dotc.ast.Trees$Apply
error when pickling type Box[caps.CapSet^]^{Cap^}
error when pickling tree Box[caps.CapSet^]^{Cap^} of class class dotty.tools.dotc.ast.Trees$TypeTree
error when pickling tree def $anonfun(_$1: Box[caps.CapSet^]^{Cap^}): Unit = () of class class dotty.tools.dotc.ast.Trees$DefDef
error when pickling tree {
def $anonfun(_$1: Box[caps.CapSet^]^{Cap^}): Unit = ()
closure($anonfun)
} of class class dotty.tools.dotc.ast.Trees$Block
error when pickling tree run[caps.CapSet^](
{
def $anonfun(_$1: Box[caps.CapSet^]^{Cap^}): Unit = ()
closure($anonfun)
}
) of class class dotty.tools.dotc.ast.Trees$Apply
error when pickling tree val b: Box[caps.CapSet^]^{} =
run[caps.CapSet^](
{
def $anonfun(_$1: Box[caps.CapSet^]^{Cap^}): Unit = ()
closure($anonfun)
}
) of class class dotty.tools.dotc.ast.Trees$ValDef
error when pickling tree {
val b: Box[caps.CapSet^]^{} =
run[caps.CapSet^](
{
def $anonfun(_$1: Box[caps.CapSet^]^{Cap^}): Unit = ()
closure($anonfun)
}
)
()
} of class class dotty.tools.dotc.ast.Trees$Block
error when pickling tree def main(): Unit =
{
val b: Box[caps.CapSet^]^{} =
run[caps.CapSet^](
{
def $anonfun(_$1: Box[caps.CapSet^]^{Cap^}): Unit = ()
closure($anonfun)
}
)
()
} of class class dotty.tools.dotc.ast.Trees$DefDef
error when pickling tree () extends Object() { this: test$package.type =>
private def writeReplace(): AnyRef =
new scala.runtime.ModuleSerializationProxy(classOf[test$package.type])
def run[Cap >: Nothing <: _root_.scala.caps.CapSet^{cap}](
f: Box[Cap]^{Cap^} => Unit): Box[Cap]^{Cap^} = ???
def main(): Unit =
{
val b: Box[caps.CapSet^]^{} =
run[caps.CapSet^](
{
def $anonfun(_$1: Box[caps.CapSet^]^{Cap^}): Unit = ()
closure($anonfun)
}
)
()
}
} of class class dotty.tools.dotc.ast.Trees$Template
error when pickling tree @SourceFile("test.scala") final module class test$package() extends Object() {
this: test$package.type =>
private def writeReplace(): AnyRef =
new scala.runtime.ModuleSerializationProxy(classOf[test$package.type])
def run[Cap >: Nothing <: _root_.scala.caps.CapSet^{cap}](
f: Box[Cap]^{Cap^} => Unit): Box[Cap]^{Cap^} = ???
def main(): Unit =
{
val b: Box[caps.CapSet^]^{} =
run[caps.CapSet^](
{
def $anonfun(_$1: Box[caps.CapSet^]^{Cap^}): Unit = ()
closure($anonfun)
}
)
()
}
} of class class dotty.tools.dotc.ast.Trees$TypeDef
error when pickling tree package <empty> {
import language.experimental.captureChecking
final lazy module val test$package: test$package = new test$package()
@SourceFile("test.scala") final module class test$package() extends Object() {
this: test$package.type =>
private def writeReplace(): AnyRef =
new scala.runtime.ModuleSerializationProxy(classOf[test$package.type])
def run[Cap >: Nothing <: _root_.scala.caps.CapSet^{cap}](
f: Box[Cap]^{Cap^} => Unit): Box[Cap]^{Cap^} = ???
def main(): Unit =
{
val b: Box[caps.CapSet^]^{} =
run[caps.CapSet^](
{
def $anonfun(_$1: Box[caps.CapSet^]^{Cap^}): Unit = ()
closure($anonfun)
}
)
()
}
}
} of class class dotty.tools.dotc.ast.Trees$PackageDef
Exception in thread "main"
unhandled exception while running pickler on test.scala
An unhandled exception was thrown in the compiler.
Please file a crash report here:
https://github.com/scala/scala3/issues/new/choose
For non-enriched exceptions, compile with -Xno-enrich-error-messages.
while compiling: test.scala
during phase: pickler
mode: Mode(ImplicitsEnabled)
library version: version 2.13.14
compiler version: version 3.6.0-RC1-bin-SNAPSHOT-nonbootstrapped-git-1604e77
settings: -classpath /home/nki/.cache/coursier/v1/https/repo1.maven.org/maven2/org/scala-lang/scala-library/2.13.14/scala-library-2.13.14.jar:/home/nki/Projects/dotty/library/../out/bootstrap/scala3-library-bootstrapped/scala-3.6.0-RC1-bin-SNAPSHOT-nonbootstrapped/scala3-library_3-3.6.0-RC1-bin-SNAPSHOT.jar -d /home/nki/Projects/dotty/compiler/../out/default-last-scalac-out.jar
java.lang.AssertionError: assertion failed: orphan parameter reference: TypeParamRef(Cap)
at scala.runtime.Scala3RunTime$.assertFailed(Scala3RunTime.scala:8)
at dotty.tools.dotc.core.tasty.TreePickler.pickleNewType(TreePickler.scala:311)
at dotty.tools.dotc.core.tasty.TreePickler.pickleType(TreePickler.scala:177)
at dotty.tools.dotc.core.tasty.TreePickler.pickleTree(TreePickler.scala:436)
at dotty.tools.dotc.core.tasty.TreePickler.pickleTpt(TreePickler.scala:345)
at dotty.tools.dotc.core.tasty.TreePickler.pickleTree$$anonfun$4(TreePickler.scala:527)
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:334)
at dotty.tools.dotc.core.tasty.TreePickler.pickleTree(TreePickler.scala:527)
at dotty.tools.dotc.core.tasty.TreePickler.pickleTree$$anonfun$9(TreePickler.scala:603)
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:334)
at dotty.tools.dotc.core.tasty.TreePickler.pickleTree(TreePickler.scala:603)
at dotty.tools.dotc.core.tasty.TreePickler.pickleTree(TreePickler.scala:553)
at dotty.tools.dotc.core.tasty.TreePickler.pickleTree$$anonfun$3(TreePickler.scala:520)
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:334)
at dotty.tools.dotc.core.tasty.TreePickler.pickleTree(TreePickler.scala:520)
at dotty.tools.dotc.core.tasty.TreePickler.pickleNewType(TreePickler.scala:280)
at dotty.tools.dotc.core.tasty.TreePickler.pickleType(TreePickler.scala:177)
at dotty.tools.dotc.core.tasty.TreePickler.pickleTree(TreePickler.scala:709)
at dotty.tools.dotc.core.tasty.TreePickler.pickleTpt(TreePickler.scala:345)
at dotty.tools.dotc.core.tasty.TreePickler.pickleDef(TreePickler.scala:375)
at dotty.tools.dotc.core.tasty.TreePickler.pickleParam(TreePickler.scala:404)
at dotty.tools.dotc.core.tasty.TreePickler.pickleParams$$anonfun$2(TreePickler.scala:411)
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:334)
at dotty.tools.dotc.core.tasty.TreePickler.pickleParams(TreePickler.scala:411)
at dotty.tools.dotc.core.tasty.TreePickler.pickleParamss$1(TreePickler.scala:648)
at dotty.tools.dotc.core.tasty.TreePickler.pickleTree$$anonfun$16(TreePickler.scala:655)
at dotty.tools.dotc.core.tasty.TreePickler.pickleTree$$anonfun$adapted$2(TreePickler.scala:655)
at scala.Function0.apply$mcV$sp(Function0.scala:42)
at dotty.tools.dotc.core.tasty.TreePickler.pickleDef(TreePickler.scala:372)
at dotty.tools.dotc.core.tasty.TreePickler.pickleTree(TreePickler.scala:655)
at dotty.tools.dotc.core.tasty.TreePickler.pickleTree$$anonfun$6(TreePickler.scala:564)
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:334)
at dotty.tools.dotc.core.tasty.TreePickler.pickleTree(TreePickler.scala:564)
at dotty.tools.dotc.core.tasty.TreePickler.pickleTree$$anonfun$3(TreePickler.scala:520)
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:334)
at dotty.tools.dotc.core.tasty.TreePickler.pickleTree(TreePickler.scala:520)
at dotty.tools.dotc.core.tasty.TreePickler.pickleTreeUnlessEmpty(TreePickler.scala:349)
at dotty.tools.dotc.core.tasty.TreePickler.pickleDef(TreePickler.scala:383)
at dotty.tools.dotc.core.tasty.TreePickler.pickleTree(TreePickler.scala:640)
at dotty.tools.dotc.core.tasty.TreePickler.pickleTree$$anonfun$6(TreePickler.scala:564)
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:334)
at dotty.tools.dotc.core.tasty.TreePickler.pickleTree(TreePickler.scala:564)
at dotty.tools.dotc.core.tasty.TreePickler.pickleTreeUnlessEmpty(TreePickler.scala:349)
at dotty.tools.dotc.core.tasty.TreePickler.pickleDef(TreePickler.scala:383)
at dotty.tools.dotc.core.tasty.TreePickler.pickleTree(TreePickler.scala:655)
at dotty.tools.dotc.core.tasty.TreePickler.pickleStats$$anonfun$2(TreePickler.scala:416)
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:334)
at dotty.tools.dotc.core.tasty.TreePickler.pickleStats(TreePickler.scala:416)
at dotty.tools.dotc.core.tasty.TreePickler.pickleTree(TreePickler.scala:691)
at dotty.tools.dotc.core.tasty.TreePickler.pickleDef(TreePickler.scala:374)
at dotty.tools.dotc.core.tasty.TreePickler.pickleTree(TreePickler.scala:657)
at dotty.tools.dotc.core.tasty.TreePickler.pickleStats$$anonfun$2(TreePickler.scala:416)
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:334)
at dotty.tools.dotc.core.tasty.TreePickler.pickleStats(TreePickler.scala:416)
at dotty.tools.dotc.core.tasty.TreePickler.pickleTree(TreePickler.scala:707)
at dotty.tools.dotc.core.tasty.TreePickler.pickle$$anonfun$1(TreePickler.scala:931)
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:334)
at dotty.tools.dotc.core.tasty.TreePickler.pickle(TreePickler.scala:929)
at dotty.tools.dotc.transform.Pickler.run$$anonfun$1$$anonfun$1(Pickler.scala:306)
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:334)
at dotty.tools.dotc.transform.Pickler.run$$anonfun$1(Pickler.scala:279)
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:334)
at dotty.tools.dotc.transform.Pickler.run(Pickler.scala:278)
at dotty.tools.dotc.core.Phases$Phase.runOn$$anonfun$1(Phases.scala:380)
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:334)
at dotty.tools.dotc.core.Phases$Phase.runOn(Phases.scala:373)
at dotty.tools.dotc.transform.Pickler.runPhase$1(Pickler.scala:392)
at dotty.tools.dotc.transform.Pickler.runOn(Pickler.scala:398)
at dotty.tools.dotc.Run.runPhases$1$$anonfun$1(Run.scala:343)
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$1(Run.scala:336)
at dotty.tools.dotc.Run.compileUnits$$anonfun$1(Run.scala:384)
at dotty.tools.dotc.Run.compileUnits$$anonfun$adapted$1(Run.scala:396)
at dotty.tools.dotc.util.Stats$.maybeMonitored(Stats.scala:69)
at dotty.tools.dotc.Run.compileUnits(Run.scala:396)
at dotty.tools.dotc.Run.compileSources(Run.scala:282)
at dotty.tools.dotc.Run.compile(Run.scala:267)
at dotty.tools.dotc.Driver.doCompile(Driver.scala:37)
at dotty.tools.dotc.Driver.process(Driver.scala:201)
at dotty.tools.dotc.Driver.process(Driver.scala:169)
at dotty.tools.dotc.Driver.process(Driver.scala:181)
at dotty.tools.dotc.Driver.main(Driver.scala:211)
at dotty.tools.dotc.Main.main(Main.scala)