Compiler version
3.10.1-RC1-bin-SNAPSHOT (main @ 297c812, built 2026-09-03)
Unreleased regression on main: introducing commit a6365f7 (2026-08-19, PR #26854).
All released versions <= 3.10.0-RC1 are unaffected (checked 3.8.1 / 3.8.2 / 3.8.4 / 3.9.0 / 3.10.0-RC1).
Minimized code
a.scala
import language.experimental.captureChecking
import caps.*
class Cap1 extends caps.ExclusiveCapability
def test(): Unit =
val v1 = (x0: Cap1^) => { val u2 = new Cap1
def d3(): Cap1^{u2} = u2
d3()
()
}
@main def main(): Unit = ()
Run with (-Ycc-log crucial)
scala-cli compile --scala-version 3.10.1-RC1-bin-SNAPSHOT --repository ivy2Local -O "-language:experimental.captureChecking" -O "-Ycc-log" --server=false a.scala
Output (just the error)
unhandled exception while running cc on /tmp/a.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: /tmp/a.scala
during phase: cc
mode: Mode(ImplicitsEnabled)
library version: version 3.10.1-RC1-bin-SNAPSHOT
compiler version: version 3.10.1-RC1-bin-SNAPSHOT-git-297c812
settings: -Ycc-log true -classpath /home/julian/.ivy2/local/org.scala-lang/scala3-library_3/3.10.1-RC1-bin-SNAPSHOT/jars/scala3-library_3.jar:/home/julian/.ivy2/local/org.scala-lang/scala-library/3.10.1-RC1-bin-SNAPSHOT/jars/scala-library.jar -d /home/julian/.cache/scalacli/virtual-projects/ff/project-4e60d9b9/.scala-build/tmp_a2d2d53713/classes/main -language List(experimental.captureChecking) -sourceroot /home/julian/.cache/scalacli/virtual-projects/ff/project-4e60d9b9
Exception in thread "main" dotty.tools.dotc.core.CyclicReference: Cyclic reference involving method d3
Run with -explain-cyclic for more details.
Compilation failed
Output (full)
Details
cc check /tmp/a.scala
expanded explicit in class Cap1: scala.caps.ExclusiveCapability --> scala.caps.ExclusiveCapability^
expanded explicit in class Cap1: scala.caps.ExclusiveCapability --> scala.caps.ExclusiveCapability^
update class info of class Cap1 with parents [Object, scala.caps.ExclusiveCapability] selfinfo <notype> to Object with (scala.caps.ExclusiveCapability^) {...}
expanded inferred in package object a$package: a$package --> a$package^'s1
expanded explicit in value v1: Cap1^ --> Cap1^
expanded inferred in value v1: (x0: (Cap1^) @declared) -> Unit --> (x0: Cap1^) ->'s2 Unit
expanded explicit in method $anonfun: Cap1^ --> Cap1^
expanded inferred in value u2: Cap1 --> Cap1^'s3
expanded explicit in method d3: Cap1^{u2} --> Cap1^{u2}
update class info of the top-level definitions in package <empty> with parents [Object] selfinfo a$package.type to Object {...}
update class info of class main with parents [Object] selfinfo <notype> to Object {...}
expanded explicit in trait ExclusiveCapability: Object with scala.caps.Capability {...} --> Object with (scala.caps.Capability^) {...}
Complete method $anonfun in [method test, the top-level definitions in package <empty>]
constr type (): Cap1 with in class Cap1 = Cap1^
Include call or box capture 's4 from 's5 in method $anonfun --> 's6
Include call or box capture 's7 from 's4 in method test --> 's8
Include call or box capture 's9 from 's7 in the top-level definitions in package <empty> --> 's10
solved vars for value u2 in Cap1^
error while rechecking def d3(): Cap1^{u2} = u2
error while rechecking ... (caught cyclic reference) ...
==> rechecking ... (caught cyclic reference) ... with pt = <?>?
==> rechecking class Cap1() extends Object(), scala.caps.ExclusiveCapability {} with pt = <?>?
==> rechecking def <init>(): Unit with pt = <?>?
==> rechecking Unit with pt = <?>?
<== rechecking Unit with pt = <?> = Unit
solved vars for constructor Cap1 in Unit
<== rechecking def <init>(): Unit with pt = <?> = (Cap1.this.<init> : (): Cap1)
==> rechecking new Object() with pt = <?>?
==> rechecking new Object with pt = ?.{ constructor Object}?
<== rechecking new Object with pt = ?.{ constructor Object} = Object
constr type (): Object with in class Object = Object
<== rechecking new Object() with pt = <?> = Object
==> rechecking scala.caps.ExclusiveCapability with pt = <?>?
<== rechecking scala.caps.ExclusiveCapability with pt = <?> = scala.caps.ExclusiveCapability^
==> rechecking val _ with pt = <?>?
<== rechecking val _ with pt = <?> = <notype>
Use set of class Cap1 = 's11, self type: Cap1^
<== rechecking class Cap1() extends Object(), scala.caps.ExclusiveCapability {} with pt = <?> = Cap1
==> rechecking final lazy module val a$package: a$package = new a$package() with pt = <?>?
==> rechecking a$package with pt = <?>?
<== rechecking a$package with pt = <?> = a$package^'s1
==> rechecking new a$package() with pt = a$package^'s1?
==> rechecking new a$package with pt = ?.{ constructor a$package}?
<== rechecking new a$package with pt = ?.{ constructor a$package} = a$package
constr type (): a$package with in the top-level definitions in package <empty> = a$package^'s10
Include call or box capture 's12 from 's13 in package object a$package --> 's14
<== rechecking new a$package() with pt = a$package^'s1 = a$package^'s10
<== rechecking final lazy module val a$package: a$package = new a$package() with pt = <?> = a$package.type
==> rechecking ... (caught cyclic reference) ... with pt = <?>?
==> rechecking def <init>(): Unit with pt = <?>?
==> rechecking Unit with pt = <?>?
<== rechecking Unit with pt = <?> = Unit
solved vars for constructor a$package in Unit
<== rechecking def <init>(): Unit with pt = <?> = (<init> : (): a$package)
==> rechecking new Object() with pt = <?>?
==> rechecking new Object with pt = ?.{ constructor Object}?
<== rechecking new Object with pt = ?.{ constructor Object} = Object
constr type (): Object with in class Object = Object
<== rechecking new Object() with pt = <?> = Object
==> rechecking val _ with pt = <?>?
<== rechecking val _ with pt = <?> = <notype>
==> rechecking private[this] type $this = a$package.type with pt = <?>?
==> rechecking a$package.type with pt = <?>?
<== rechecking a$package.type with pt = <?> = a$package.type
<== rechecking private[this] type $this = a$package.type with pt = <?> = $this
==> rechecking private def writeReplace(): AnyRef =
new scala.runtime.ModuleSerializationProxy(classOf[a$package.type]) with pt = <?>?
==> rechecking AnyRef with pt = <?>?
<== rechecking AnyRef with pt = <?> = AnyRef
==> rechecking new scala.runtime.ModuleSerializationProxy(classOf[a$package.type]) with pt = AnyRef?
==> rechecking new scala.runtime.ModuleSerializationProxy with pt = ?.{ constructor ModuleSerializationProxy}?
<== rechecking new scala.runtime.ModuleSerializationProxy with pt = ?.{ constructor ModuleSerializationProxy} = scala.runtime.ModuleSerializationProxy
==> rechecking classOf[a$package.type] with pt = Class[?]^<fluid>?
<== rechecking classOf[a$package.type] with pt = Class[?]^<fluid> = (classOf[a$package.type] : Class[a$package.type])
recheck arg classOf[a$package.type] vs Class[?]^<fluid> = (classOf[a$package.type] : Class[a$package.type])
constr type (moduleClass: Class[?]^<fluid>): scala.runtime.ModuleSerializationProxy with (classOf[a$package.type] : Class[a$package.type]) in class ModuleSerializationProxy = scala.runtime.ModuleSerializationProxy^'s15
Include call or box capture 's16 from 's17 in method writeReplace --> 's18
Include call or box capture 's19 from 's16 in the top-level definitions in package <empty> --> 's10
<== rechecking new scala.runtime.ModuleSerializationProxy(classOf[a$package.type]) with pt = AnyRef = scala.runtime.ModuleSerializationProxy^'s15
<== rechecking private def writeReplace(): AnyRef =
new scala.runtime.ModuleSerializationProxy(classOf[a$package.type]) with pt = <?> = (writeReplace : (): AnyRef)
==> rechecking ... (caught cyclic reference) ... with pt = <?>?
==> rechecking Unit with pt = <?>?
<== rechecking Unit with pt = <?> = Unit
==> rechecking ... (caught cyclic reference) ... with pt = Unit?
==> rechecking ... (caught cyclic reference) ... with pt = <?>?
Complete value v1 in [method test, the top-level definitions in package <empty>]
==> rechecking (x0: (Cap1^) @declared) -> Unit with pt = <?>?
<== rechecking (x0: (Cap1^) @declared) -> Unit with pt = <?> = (x0: Cap1^) ->'s2 Unit
==> rechecking ... (caught cyclic reference) ... with pt = (x0: Cap1^) ->'s2 Unit?
recheck closure block ... (caught cyclic reference) ...: (x0: Cap1^): Unit
==> rechecking Unit with pt = <?>?
<== rechecking Unit with pt = <?> = Unit
==> rechecking ... (caught cyclic reference) ... with pt = Unit?
==> rechecking val u2: Cap1 = new Cap1() with pt = <?>?
==> rechecking Cap1 with pt = <?>?
<== rechecking Cap1 with pt = <?> = Cap1^
==> rechecking new Cap1() with pt = Cap1^?
==> rechecking new Cap1 with pt = ?.{ constructor Cap1}?
<== rechecking new Cap1 with pt = ?.{ constructor Cap1} = Cap1
constr type (): Cap1 with in class Cap1 = Cap1^
Include call or box capture 's20 from 's21 in method $anonfun --> 's6
Include call or box capture 's22 from 's20 in method test --> 's8
Include call or box capture 's23 from 's22 in the top-level definitions in package <empty> --> 's10
<== rechecking new Cap1() with pt = Cap1^ = Cap1^
solved vars for value u2 in Cap1^
<== rechecking val u2: Cap1 = new Cap1() with pt = <?> = (u2 : Cap1)
==> rechecking def d3(): Cap1^{u2} = u2 with pt = <?>?
error while rechecking def d3(): Cap1^{u2} = u2
<== rechecking def d3(): Cap1^{u2} = u2 with pt = <?> = <missing> (with exception dotty.tools.dotc.core.CyclicReference: Cyclic reference involving method d3
Run with -explain-cyclic for more details.)
error while rechecking ... (caught cyclic reference) ...
<== rechecking ... (caught cyclic reference) ... with pt = Unit = <missing> (with exception dotty.tools.dotc.core.CyclicReference: Cyclic reference involving method d3
Run with -explain-cyclic for more details.)
error while rechecking ... (caught cyclic reference) ...
<== rechecking ... (caught cyclic reference) ... with pt = (x0: Cap1^) ->'s2 Unit = <missing> (with exception dotty.tools.dotc.core.CyclicReference: Cyclic reference involving method d3
Run with -explain-cyclic for more details.)
solved vars for value v1 in (x0: Cap1^) -> Unit
error while rechecking ... (caught cyclic reference) ...
<== rechecking ... (caught cyclic reference) ... with pt = <?> = <missing> (with exception dotty.tools.dotc.core.CyclicReference: Cyclic reference involving method d3
Run with -explain-cyclic for more details.)
error while rechecking ... (caught cyclic reference) ...
<== rechecking ... (caught cyclic reference) ... with pt = Unit = <missing> (with exception dotty.tools.dotc.core.CyclicReference: Cyclic reference involving method d3
Run with -explain-cyclic for more details.)
error while rechecking ... (caught cyclic reference) ...
<== rechecking ... (caught cyclic reference) ... with pt = <?> = <missing> (with exception dotty.tools.dotc.core.CyclicReference: Cyclic reference involving method d3
Run with -explain-cyclic for more details.)
error while rechecking ... (caught cyclic reference) ...
<== rechecking ... (caught cyclic reference) ... with pt = <?> = <missing> (with exception dotty.tools.dotc.core.CyclicReference: Cyclic reference involving method d3
Run with -explain-cyclic for more details.)
error while rechecking ... (caught cyclic reference) ...
<== rechecking ... (caught cyclic reference) ... with pt = <?> = <missing> (with exception dotty.tools.dotc.core.CyclicReference: Cyclic reference involving method d3
Run with -explain-cyclic for more details.)
unhandled exception while running cc on /tmp/a.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: /tmp/a.scala
during phase: cc
mode: Mode(ImplicitsEnabled)
library version: version 3.10.1-RC1-bin-SNAPSHOT
compiler version: version 3.10.1-RC1-bin-SNAPSHOT-git-297c812
settings: -Ycc-log true -classpath /home/julian/.ivy2/local/org.scala-lang/scala3-library_3/3.10.1-RC1-bin-SNAPSHOT/jars/scala3-library_3.jar:/home/julian/.ivy2/local/org.scala-lang/scala-library/3.10.1-RC1-bin-SNAPSHOT/jars/scala-library.jar -d /home/julian/.cache/scalacli/virtual-projects/ff/project-4e60d9b9/.scala-build/tmp_a2d2d53713/classes/main -language List(experimental.captureChecking) -sourceroot /home/julian/.cache/scalacli/virtual-projects/ff/project-4e60d9b9
Exception in thread "main" dotty.tools.dotc.core.CyclicReference: Cyclic reference involving method d3
Run with -explain-cyclic for more details.
Compilation failed
Compiler version
3.10.1-RC1-bin-SNAPSHOT (main @ 297c812, built 2026-09-03)
Unreleased regression on main: introducing commit a6365f7 (2026-08-19, PR #26854).
All released versions <= 3.10.0-RC1 are unaffected (checked 3.8.1 / 3.8.2 / 3.8.4 / 3.9.0 / 3.10.0-RC1).
Minimized code
a.scalaRun with (
-Ycc-logcrucial)Output (just the error)
Output (full)
Details