Skip to content

Nonsense opaque type definition crashes compiler #23185

Open
@jchyb

Description

@jchyb

Compiler version

3.7.2-RC1-bin-20250515-c481e91-NIGHTLY, but any after 3.6.0 (including 3.6.0) will crash

Minimized code

opaque type Opaque: String

Output (click arrow to expand)

  exception occurred while typechecking /Users/jchyb/workspace/scala3/Test2.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: /Users/jchyb/workspace/scala3/Test2.scala
        during phase: typer
                mode: Mode(ImplicitsEnabled)
     library version: version 2.13.16
    compiler version: version 3.7.2-RC1-bin-20250515-c481e91-NIGHTLY-git-c481e91
            settings: -bootclasspath /Users/jchyb/Library/Caches/Coursier/v1/https/repo1.maven.org/maven2/org/scala-lang/scala3-library_3/3.7.2-RC1-bin-20250515-c481e91-NIGHTLY/scala3-library_3-3.7.2-RC1-bin-20250515-c481e91-NIGHTLY.jar:/Users/jchyb/Library/Caches/Coursier/v1/https/repo1.maven.org/maven2/org/scala-lang/scala-library/2.13.16/scala-library-2.13.16.jar -classpath /Users/jchyb/workspace/scala3/.scala-build/.bloop/scala3_ca449ecd5f-ca491fd8ef/bloop-internal-classes/main-ZFFuRaDpRpKCuai6DuyFQA==:/Users/jchyb/workspace/scala3/.scala-build/scala3_ca449ecd5f-ca491fd8ef/classes/classes-empty-scala3_ca449ecd5f-ca491fd8ef -d /Users/jchyb/workspace/scala3/.scala-build/.bloop/scala3_ca449ecd5f-ca491fd8ef/bloop-internal-classes/main-ZFFuRaDpRpKCuai6DuyFQA== -sourceroot /Users/jchyb/workspace/scala3

Error compiling project (Scala 3.7.2-RC1-bin-20250515-c481e91-NIGHTLY, JVM (21))
Error: java.lang.UnsupportedOperationException: complete
        at dotty.tools.package$.unsupported(package.scala:9)
        at dotty.tools.dotc.core.SymDenotations$NoCompleter.complete(SymDenotations.scala:2824)
        at dotty.tools.dotc.core.SymDenotations$NoCompleter.complete$(SymDenotations.scala:2823)
        at dotty.tools.dotc.core.SymDenotations$NoCompleter$.complete(SymDenotations.scala:2827)
        at dotty.tools.dotc.core.Types$ClassInfo.force$1(Types.scala:5565)
        at dotty.tools.dotc.core.Types$ClassInfo.refineSelfType$1$$anonfun$1(Types.scala:5574)
        at dotty.tools.dotc.core.Types$LazyRef.ref(Types.scala:3179)
        at dotty.tools.dotc.core.Types$Type.stripLazyRef(Types.scala:1296)
        at dotty.tools.dotc.core.SymDenotations$SymDenotation.recur$3(SymDenotations.scala:1363)
        at dotty.tools.dotc.core.SymDenotations$SymDenotation.opaqueAlias(SymDenotations.scala:1367)
        at dotty.tools.dotc.typer.Checking$.checkNonCyclic(Checking.scala:423)
        at dotty.tools.dotc.typer.Checking.checkNonCyclic(Checking.scala:949)
        at dotty.tools.dotc.typer.Checking.checkNonCyclic$(Checking.scala:944)
        at dotty.tools.dotc.typer.Typer.checkNonCyclic(Typer.scala:154)
        at dotty.tools.dotc.typer.Namer$TypeDefCompleter.typeSig(Namer.scala:1121)
        at dotty.tools.dotc.typer.Namer$Completer.completeInCreationContext(Namer.scala:1003)
        at dotty.tools.dotc.typer.Namer$Completer.complete(Namer.scala:872)
        at dotty.tools.dotc.core.SymDenotations$SymDenotation.completeFrom(SymDenotations.scala:175)
        at dotty.tools.dotc.core.Denotations$Denotation.completeInfo$1(Denotations.scala:190)
        at dotty.tools.dotc.core.Denotations$Denotation.info(Denotations.scala:192)
        at dotty.tools.dotc.core.SymDenotations$SymDenotation.ensureCompleted(SymDenotations.scala:393)
        at dotty.tools.dotc.typer.Typer.retrieveSym(Typer.scala:3548)
        at dotty.tools.dotc.typer.Typer.typedNamed$1(Typer.scala:3573)
        at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:3688)
        at dotty.tools.dotc.typer.Typer.typed(Typer.scala:3766)
        at dotty.tools.dotc.typer.Typer.typed(Typer.scala:3771)
        at dotty.tools.dotc.typer.Typer.traverse$1(Typer.scala:3793)
        at dotty.tools.dotc.typer.Typer.typedStats(Typer.scala:3839)
        at dotty.tools.dotc.typer.Typer.typedClassDef(Typer.scala:3261)
        at dotty.tools.dotc.typer.Typer.typedTypeOrClassDef$1(Typer.scala:3589)
        at dotty.tools.dotc.typer.Typer.typedNamed$1(Typer.scala:3593)
        at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:3688)
        at dotty.tools.dotc.typer.Typer.typed(Typer.scala:3766)
        at dotty.tools.dotc.typer.Typer.typed(Typer.scala:3771)
        at dotty.tools.dotc.typer.Typer.traverse$1(Typer.scala:3793)
        at dotty.tools.dotc.typer.Typer.typedStats(Typer.scala:3839)
        at dotty.tools.dotc.typer.Typer.typedPackageDef(Typer.scala:3394)
        at dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:3635)
        at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:3689)
        at dotty.tools.dotc.typer.Typer.typed(Typer.scala:3766)
        at dotty.tools.dotc.typer.Typer.typed(Typer.scala:3771)
        at dotty.tools.dotc.typer.Typer.typedExpr(Typer.scala:3882)
        at dotty.tools.dotc.typer.TyperPhase.typeCheck$$anonfun$1(TyperPhase.scala:47)
        at scala.runtime.function.JProcedure1.apply(JProcedure1.java:15)
        at scala.runtime.function.JProcedure1.apply(JProcedure1.java:10)
        at dotty.tools.dotc.core.Phases$Phase.monitor(Phases.scala:510)
        at dotty.tools.dotc.typer.TyperPhase.typeCheck(TyperPhase.scala:53)
        at dotty.tools.dotc.typer.TyperPhase.$anonfun$4(TyperPhase.scala:99)
        at scala.collection.Iterator$$anon$6.hasNext(Iterator.scala:479)
        at scala.collection.Iterator$$anon$9.hasNext(Iterator.scala:583)
        at scala.collection.immutable.List.prependedAll(List.scala:152)
        at scala.collection.immutable.List$.from(List.scala:685)
        at scala.collection.immutable.List$.from(List.scala:682)
        at scala.collection.IterableOps$WithFilter.map(Iterable.scala:900)
        at dotty.tools.dotc.typer.TyperPhase.runOn(TyperPhase.scala:98)
        at dotty.tools.dotc.Run.runPhases$1$$anonfun$1(Run.scala:368)
        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:1324)
        at dotty.tools.dotc.Run.runPhases$1(Run.scala:361)
        at dotty.tools.dotc.Run.compileUnits$$anonfun$1$$anonfun$2(Run.scala:408)
        at dotty.tools.dotc.Run.compileUnits$$anonfun$1$$anonfun$adapted$1(Run.scala:408)
        at scala.Function0.apply$mcV$sp(Function0.scala:42)
        at dotty.tools.dotc.Run.showProgress(Run.scala:470)
        at dotty.tools.dotc.Run.compileUnits$$anonfun$1(Run.scala:408)
        at dotty.tools.dotc.Run.compileUnits$$anonfun$adapted$1(Run.scala:420)
        at dotty.tools.dotc.util.Stats$.maybeMonitored(Stats.scala:69)
        at dotty.tools.dotc.Run.compileUnits(Run.scala:420)
        at dotty.tools.dotc.Run.compileSources(Run.scala:307)
        at dotty.tools.dotc.Run.compile(Run.scala:292)
        at dotty.tools.dotc.Driver.doCompile(Driver.scala:37)
        at dotty.tools.xsbt.CompilerBridgeDriver.run(CompilerBridgeDriver.java:141)
        at dotty.tools.xsbt.CompilerBridge.run(CompilerBridge.java:22)
        at sbt.internal.inc.AnalyzingCompiler.compile(AnalyzingCompiler.scala:91)
        at sbt.internal.inc.bloop.internal.BloopHighLevelCompiler.compileSources$1(BloopHighLevelCompiler.scala:148)
        at sbt.internal.inc.bloop.internal.BloopHighLevelCompiler.$anonfun$compile$9(BloopHighLevelCompiler.scala:181)
        at scala.runtime.java8.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.java:23)
        at sbt.internal.inc.bloop.internal.BloopHighLevelCompiler.$anonfun$compile$1(BloopHighLevelCompiler.scala:73)
        at bloop.tracing.NoopTracer$.trace(BraveTracer.scala:53)
        at sbt.internal.inc.bloop.internal.BloopHighLevelCompiler.timed$1(BloopHighLevelCompiler.scala:72)
        at sbt.internal.inc.bloop.internal.BloopHighLevelCompiler.$anonfun$compile$8(BloopHighLevelCompiler.scala:181)
        at scala.runtime.java8.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.java:23)
        at monix.eval.internal.TaskRunLoop$.startFull(TaskRunLoop.scala:81)
        at monix.eval.internal.TaskRestartCallback.syncOnSuccess(TaskRestartCallback.scala:101)
        at monix.eval.internal.TaskRestartCallback.onSuccess(TaskRestartCallback.scala:74)
        at monix.eval.internal.TaskExecuteOn$AsyncRegister$$anon$1.run(TaskExecuteOn.scala:71)
        at java.base/java.util.concurrent.ForkJoinTask$RunnableExecuteAction.exec(ForkJoinTask.java:1423)
        at java.base/java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:387)
        at java.base/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1312)
        at java.base/java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1843)
        at java.base/java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1808)
        at java.base/java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:188)

Error: Unexpected error when compiling scala3_ca449ecd5f-ca491fd8ef: java.lang.UnsupportedOperationException: complete
        at dotty.tools.package$.unsupported(package.scala:9)
        at dotty.tools.dotc.core.SymDenotations$NoCompleter.complete(SymDenotations.scala:2824)
        at dotty.tools.dotc.core.SymDenotations$NoCompleter.complete$(SymDenotations.scala:2823)
        at dotty.tools.dotc.core.SymDenotations$NoCompleter$.complete(SymDenotations.scala:2827)
        at dotty.tools.dotc.core.Types$ClassInfo.force$1(Types.scala:5565)
        at dotty.tools.dotc.core.Types$ClassInfo.refineSelfType$1$$anonfun$1(Types.scala:5574)
        at dotty.tools.dotc.core.Types$LazyRef.ref(Types.scala:3179)
        at dotty.tools.dotc.core.Types$Type.stripLazyRef(Types.scala:1296)
        at dotty.tools.dotc.core.SymDenotations$SymDenotation.recur$3(SymDenotations.scala:1363)
        at dotty.tools.dotc.core.SymDenotations$SymDenotation.opaqueAlias(SymDenotations.scala:1367)
        at dotty.tools.dotc.typer.Checking$.checkNonCyclic(Checking.scala:423)
        at dotty.tools.dotc.typer.Checking.checkNonCyclic(Checking.scala:949)
        at dotty.tools.dotc.typer.Checking.checkNonCyclic$(Checking.scala:944)
        at dotty.tools.dotc.typer.Typer.checkNonCyclic(Typer.scala:154)
        at dotty.tools.dotc.typer.Namer$TypeDefCompleter.typeSig(Namer.scala:1121)
        at dotty.tools.dotc.typer.Namer$Completer.completeInCreationContext(Namer.scala:1003)
        at dotty.tools.dotc.typer.Namer$Completer.complete(Namer.scala:872)
        at dotty.tools.dotc.core.SymDenotations$SymDenotation.completeFrom(SymDenotations.scala:175)
        at dotty.tools.dotc.core.Denotations$Denotation.completeInfo$1(Denotations.scala:190)
        at dotty.tools.dotc.core.Denotations$Denotation.info(Denotations.scala:192)
        at dotty.tools.dotc.core.SymDenotations$SymDenotation.ensureCompleted(SymDenotations.scala:393)
        at dotty.tools.dotc.typer.Typer.retrieveSym(Typer.scala:3548)
        at dotty.tools.dotc.typer.Typer.typedNamed$1(Typer.scala:3573)
        at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:3688)
        at dotty.tools.dotc.typer.Typer.typed(Typer.scala:3766)
        at dotty.tools.dotc.typer.Typer.typed(Typer.scala:3771)
        at dotty.tools.dotc.typer.Typer.traverse$1(Typer.scala:3793)
        at dotty.tools.dotc.typer.Typer.typedStats(Typer.scala:3839)
        at dotty.tools.dotc.typer.Typer.typedClassDef(Typer.scala:3261)
        at dotty.tools.dotc.typer.Typer.typedTypeOrClassDef$1(Typer.scala:3589)
        at dotty.tools.dotc.typer.Typer.typedNamed$1(Typer.scala:3593)
        at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:3688)
        at dotty.tools.dotc.typer.Typer.typed(Typer.scala:3766)
        at dotty.tools.dotc.typer.Typer.typed(Typer.scala:3771)
        at dotty.tools.dotc.typer.Typer.traverse$1(Typer.scala:3793)
        at dotty.tools.dotc.typer.Typer.typedStats(Typer.scala:3839)
        at dotty.tools.dotc.typer.Typer.typedPackageDef(Typer.scala:3394)
        at dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:3635)
        at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:3689)
        at dotty.tools.dotc.typer.Typer.typed(Typer.scala:3766)
        at dotty.tools.dotc.typer.Typer.typed(Typer.scala:3771)
        at dotty.tools.dotc.typer.Typer.typedExpr(Typer.scala:3882)
        at dotty.tools.dotc.typer.TyperPhase.typeCheck$$anonfun$1(TyperPhase.scala:47)
        at scala.runtime.function.JProcedure1.apply(JProcedure1.java:15)
        at scala.runtime.function.JProcedure1.apply(JProcedure1.java:10)
        at dotty.tools.dotc.core.Phases$Phase.monitor(Phases.scala:510)
        at dotty.tools.dotc.typer.TyperPhase.typeCheck(TyperPhase.scala:53)
        at dotty.tools.dotc.typer.TyperPhase.$anonfun$4(TyperPhase.scala:99)
        at scala.collection.Iterator$$anon$6.hasNext(Iterator.scala:479)
        at scala.collection.Iterator$$anon$9.hasNext(Iterator.scala:583)
        at scala.collection.immutable.List.prependedAll(List.scala:152)
        at scala.collection.immutable.List$.from(List.scala:685)
        at scala.collection.immutable.List$.from(List.scala:682)
        at scala.collection.IterableOps$WithFilter.map(Iterable.scala:900)
        at dotty.tools.dotc.typer.TyperPhase.runOn(TyperPhase.scala:98)
        at dotty.tools.dotc.Run.runPhases$1$$anonfun$1(Run.scala:368)
        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:1324)
        at dotty.tools.dotc.Run.runPhases$1(Run.scala:361)
        at dotty.tools.dotc.Run.compileUnits$$anonfun$1$$anonfun$2(Run.scala:408)
        at dotty.tools.dotc.Run.compileUnits$$anonfun$1$$anonfun$adapted$1(Run.scala:408)
        at scala.Function0.apply$mcV$sp(Function0.scala:42)
        at dotty.tools.dotc.Run.showProgress(Run.scala:470)
        at dotty.tools.dotc.Run.compileUnits$$anonfun$1(Run.scala:408)
        at dotty.tools.dotc.Run.compileUnits$$anonfun$adapted$1(Run.scala:420)
        at dotty.tools.dotc.util.Stats$.maybeMonitored(Stats.scala:69)
        at dotty.tools.dotc.Run.compileUnits(Run.scala:420)
        at dotty.tools.dotc.Run.compileSources(Run.scala:307)
        at dotty.tools.dotc.Run.compile(Run.scala:292)
        at dotty.tools.dotc.Driver.doCompile(Driver.scala:37)
        at dotty.tools.xsbt.CompilerBridgeDriver.run(CompilerBridgeDriver.java:141)
        at dotty.tools.xsbt.CompilerBridge.run(CompilerBridge.java:22)
        at sbt.internal.inc.AnalyzingCompiler.compile(AnalyzingCompiler.scala:91)
        at sbt.internal.inc.bloop.internal.BloopHighLevelCompiler.compileSources$1(BloopHighLevelCompiler.scala:148)
        at sbt.internal.inc.bloop.internal.BloopHighLevelCompiler.$anonfun$compile$9(BloopHighLevelCompiler.scala:181)
        at scala.runtime.java8.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.java:23)
        at sbt.internal.inc.bloop.internal.BloopHighLevelCompiler.$anonfun$compile$1(BloopHighLevelCompiler.scala:73)
        at bloop.tracing.NoopTracer$.trace(BraveTracer.scala:53)
        at sbt.internal.inc.bloop.internal.BloopHighLevelCompiler.timed$1(BloopHighLevelCompiler.scala:72)
        at sbt.internal.inc.bloop.internal.BloopHighLevelCompiler.$anonfun$compile$8(BloopHighLevelCompiler.scala:181)
        at scala.runtime.java8.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.java:23)
        at monix.eval.internal.TaskRunLoop$.startFull(TaskRunLoop.scala:81)
        at monix.eval.internal.TaskRestartCallback.syncOnSuccess(TaskRestartCallback.scala:101)
        at monix.eval.internal.TaskRestartCallback.onSuccess(TaskRestartCallback.scala:74)
        at monix.eval.internal.TaskExecuteOn$AsyncRegister$$anon$1.run(TaskExecuteOn.scala:71)
        at java.base/java.util.concurrent.ForkJoinTask$RunnableExecuteAction.exec(ForkJoinTask.java:1423)
        at java.base/java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:387)
        at java.base/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1312)
        at java.base/java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1843)
        at java.base/java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1808)
        at java.base/java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:188)

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions