scala3 icon indicating copy to clipboard operation
scala3 copied to clipboard

Spurious " has non-class parent: val <none>" warnings/errors

Open pshirshov opened this issue 1 year ago • 23 comments

3.1.3

This looks some kind of a race condition in the compiler because it's not always happening on my machine.

From time to time I'm getting output like this while compiling classes which use BIOCatsMonad

scala: java.lang.AssertionError: assertion failed: class BIOCatsMonad has non-class parent: val <none>
scala: 	at scala.runtime.Scala3RunTime$.assertFailed(Scala3RunTime.scala:8)
scala: 	at dotty.tools.dotc.core.SymDenotations$ClassDenotation.traverse$1(SymDenotations.scala:1899)
scala: 	at dotty.tools.dotc.core.SymDenotations$ClassDenotation.computeBaseData(SymDenotations.scala:1904)
scala: 	at dotty.tools.dotc.core.SymDenotations$BaseDataImpl.apply(SymDenotations.scala:2873)
scala: 	at dotty.tools.dotc.core.SymDenotations$ClassDenotation.baseData(SymDenotations.scala:1870)
scala: 	at dotty.tools.dotc.core.SymDenotations$ClassDenotation.baseClassSet(SymDenotations.scala:1886)
scala: 	at dotty.tools.dotc.core.SymDenotations$ClassDenotation.derivesFrom(SymDenotations.scala:1912)
scala: 	at dotty.tools.dotc.core.SymDenotations$SymDenotation.isValueClass(SymDenotations.scala:808)
scala: 	at dotty.tools.dotc.transform.ValueClasses$.isDerivedValueClass(ValueClasses.scala:19)
scala: 	at dotty.tools.dotc.core.TypeErasure$.dotty$tools$dotc$core$TypeErasure$$$erasureDependsOnArgs(TypeErasure.scala:75)
scala: 	at dotty.tools.dotc.core.TypeErasure.dotty$tools$dotc$core$TypeErasure$$sigName(TypeErasure.scala:814)
scala: 	at dotty.tools.dotc.core.TypeErasure$.sigName(TypeErasure.scala:204)
scala: 	at dotty.tools.dotc.core.Signature$.apply(Signature.scala:167)
scala: 	at dotty.tools.dotc.core.Types$MethodOrPoly.computeSignature$2(Types.scala:3535)
scala: 	at dotty.tools.dotc.core.Types$MethodOrPoly.signature(Types.scala:3556)
scala: 	at dotty.tools.dotc.core.Types$MethodOrPoly.computeSignature$2(Types.scala:3531)
scala: 	at dotty.tools.dotc.core.Denotations$SingleDenotation.signature(Denotations.scala:615)
scala: 	at dotty.tools.dotc.core.Denotations$SingleDenotation.signature(Denotations.scala:605)
scala: 	at dotty.tools.dotc.core.Denotations$SingleDenotation.atSignature(Denotations.scala:647)
scala: 	at dotty.tools.dotc.core.Denotations$SingleDenotation.atSignature(Denotations.scala:645)
scala: 	at dotty.tools.dotc.core.tasty.TreeUnpickler$TreeReader.readLengthTerm$1(TreeUnpickler.scala:1223)
scala: 	at dotty.tools.dotc.core.tasty.TreeUnpickler$TreeReader.readTerm(TreeUnpickler.scala:1297)
scala: 	at dotty.tools.dotc.core.tasty.TreeUnpickler$TreeReader.readLengthTerm$1(TreeUnpickler.scala:1140)
scala: 	at dotty.tools.dotc.core.tasty.TreeUnpickler$TreeReader.readLengthTerm$1(TreeUnpickler.scala:1137)
scala: 	at dotty.tools.dotc.core.tasty.TreeUnpickler$TreeReader.$anonfun$19(TreeUnpickler.scala:934)
scala: 	at dotty.tools.tasty.TastyReader.collectWhile(TastyReader.scala:137)
scala: 	at dotty.tools.dotc.core.tasty.TreeUnpickler$TreeReader.readTemplate(TreeUnpickler.scala:937)
scala: 	at dotty.tools.dotc.core.tasty.TreeUnpickler$TreeReader.readNewDef(TreeUnpickler.scala:855)
scala: 	at dotty.tools.dotc.core.tasty.TreeUnpickler$TreeReader.readIndexedDef(TreeUnpickler.scala:774)
scala: 	at dotty.tools.dotc.core.tasty.TreeUnpickler$Completer.complete(TreeUnpickler.scala:120)
scala: 	at dotty.tools.dotc.core.SymDenotations$SymDenotation.completeFrom(SymDenotations.scala:167)
scala: 	at dotty.tools.dotc.core.Denotations$Denotation.completeInfo$1(Denotations.scala:187)
scala: 	at dotty.tools.dotc.core.Denotations$Denotation.info(Denotations.scala:189)
scala: 	at dotty.tools.dotc.core.Types$NamedType.info(Types.scala:2204)
scala: 	at dotty.tools.dotc.core.Types$TypeRef.underlying(Types.scala:2702)
scala: 	at dotty.tools.dotc.core.Types$Type.findDecl(Types.scala:640)
scala: 	at dotty.tools.dotc.core.Types$Type.decl(Types.scala:625)
scala: 	at dotty.tools.dotc.core.NamerOps$.addConstructorApplies(NamerOps.scala:107)
scala: 	at dotty.tools.dotc.core.NamerOps$$anon$1.complete(NamerOps.scala:122)
scala: 	at dotty.tools.dotc.core.SymDenotations$SymDenotation.ensureCompleted(SymDenotations.scala:369)
scala: 	at dotty.tools.dotc.core.SymDenotations$SymDenotation.flags(SymDenotations.scala:64)
scala: 	at dotty.tools.dotc.core.SymDenotations$ModuleCompleter.complete(SymDenotations.scala:2690)
scala: 	at dotty.tools.dotc.core.SymDenotations$SymDenotation.is(SymDenotations.scala:116)
scala: 	at dotty.tools.dotc.typer.ImportSuggestions.lookInside$1(ImportSuggestions.scala:66)
scala: 	at dotty.tools.dotc.typer.ImportSuggestions.nestedRoots$1$$anonfun$1$$anonfun$1(ImportSuggestions.scala:75)
scala: 	at dotty.tools.dotc.core.Scopes$Scope.filter(Scopes.scala:102)
scala: 	at dotty.tools.dotc.typer.ImportSuggestions.nestedRoots$1$$anonfun$1(ImportSuggestions.scala:78)
scala: 	at scala.collection.immutable.List.flatMap(List.scala:293)
scala: 	at dotty.tools.dotc.typer.ImportSuggestions.nestedRoots$1(ImportSuggestions.scala:78)
scala: 	at dotty.tools.dotc.typer.ImportSuggestions.rootsStrictlyIn$1(ImportSuggestions.scala:97)
scala: 	at dotty.tools.dotc.typer.ImportSuggestions.rootsIn$1(ImportSuggestions.scala:108)
scala: 	at dotty.tools.dotc.typer.ImportSuggestions.rootsStrictlyIn$1$$anonfun$2(ImportSuggestions.scala:100)
scala: 	at dotty.tools.dotc.typer.ImportSuggestions.rootsStrictlyIn$1(ImportSuggestions.scala:100)
scala: 	at dotty.tools.dotc.typer.ImportSuggestions.rootsOnPath$1(ImportSuggestions.scala:111)
scala: 	at dotty.tools.dotc.typer.ImportSuggestions.recur$1(ImportSuggestions.scala:128)
scala: 	at dotty.tools.dotc.typer.ImportSuggestions.recur$1(ImportSuggestions.scala:130)
scala: 	at dotty.tools.dotc.typer.ImportSuggestions.suggestionRoots(ImportSuggestions.scala:133)
scala: 	at dotty.tools.dotc.typer.ImportSuggestions.importSuggestions(ImportSuggestions.scala:235)
scala: 	at dotty.tools.dotc.typer.ImportSuggestions.importSuggestionAddendum(ImportSuggestions.scala:323)
scala: 	at dotty.tools.dotc.typer.ImportSuggestions.importSuggestionAddendum$(ImportSuggestions.scala:21)
scala: 	at dotty.tools.dotc.typer.Typer.importSuggestionAddendum(Typer.scala:117)
scala: 	at dotty.tools.dotc.typer.Implicits.$anonfun$3(Implicits.scala:900)
scala: 	at scala.Option.getOrElse(Option.scala:201)
scala: 	at dotty.tools.dotc.typer.ImplicitSearchError.hiddenImplicitsAddendum(ErrorReporting.scala:417)
scala: 	at dotty.tools.dotc.typer.ImplicitSearchError.missingArgMsg(ErrorReporting.scala:265)
scala: 	at dotty.tools.dotc.typer.Implicits.missingArgMsg(Implicits.scala:901)
scala: 	at dotty.tools.dotc.typer.Implicits.missingArgMsg$(Implicits.scala:785)
scala: 	at dotty.tools.dotc.typer.Typer.missingArgMsg(Typer.scala:117)
scala: 	at dotty.tools.dotc.typer.Typer.issueErrors$1$$anonfun$1$$anonfun$1(Typer.scala:3520)
scala: 	at dotty.tools.dotc.reporting.NoExplanation.msg(Message.scala:141)
scala: 	at dotty.tools.dotc.reporting.Message.message(Message.scala:89)
scala: 	at dotty.tools.dotc.reporting.Diagnostic.message(Diagnostic.scala:99)
scala: 	at dotty.tools.dotc.typer.Inliner$Intrinsics$.packError(Inliner.scala:374)
scala: 	at dotty.tools.dotc.typer.Inliner$Intrinsics$.$anonfun$27(Inliner.scala:380)
scala: 	at scala.collection.immutable.List.map(List.scala:246)
scala: 	at dotty.tools.dotc.typer.Inliner$Intrinsics$.packErrors(Inliner.scala:380)
scala: 	at dotty.tools.dotc.typer.Inliner$Intrinsics$.typeCheckErrors(Inliner.scala:392)
scala: 	at dotty.tools.dotc.typer.Inliner$.inlineCall(Inliner.scala:103)
scala: 	at dotty.tools.dotc.typer.Inliner$InlineTyper.inlineIfNeeded(Inliner.scala:1706)
scala: 	at dotty.tools.dotc.typer.Inliner$InlineTyper.typedApply(Inliner.scala:1630)
scala: 	at dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:2832)
scala: 	at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:2895)
scala: 	at dotty.tools.dotc.typer.ReTyper.typedUnadapted(ReTyper.scala:123)
scala: 	at dotty.tools.dotc.typer.Inliner$InlineTyper.typedUnadapted(Inliner.scala:1710)
scala: 	at dotty.tools.dotc.typer.ProtoTypes$FunProto.$anonfun$7(ProtoTypes.scala:469)
scala: 	at dotty.tools.dotc.typer.ProtoTypes$FunProto.cacheTypedArg(ProtoTypes.scala:392)
scala: 	at dotty.tools.dotc.typer.ProtoTypes$FunProto.typedArg(ProtoTypes.scala:470)
scala: 	at dotty.tools.dotc.typer.Applications$ApplyToUntyped.typedArg(Applications.scala:866)
scala: 	at dotty.tools.dotc.typer.Applications$Application.addTyped$1(Applications.scala:557)
scala: 	at dotty.tools.dotc.typer.Applications$Application.matchArgs(Applications.scala:622)
scala: 	at dotty.tools.dotc.typer.Applications$Application.init(Applications.scala:460)
scala: 	at dotty.tools.dotc.typer.Applications$TypedApply.<init>(Applications.scala:748)
scala: 	at dotty.tools.dotc.typer.Applications$ApplyToUntyped.<init>(Applications.scala:865)
scala: 	at dotty.tools.dotc.typer.Applications.ApplyTo(Applications.scala:1065)
scala: 	at dotty.tools.dotc.typer.Applications.ApplyTo$(Applications.scala:327)
scala: 	at dotty.tools.dotc.typer.Typer.ApplyTo(Typer.scala:117)
scala: 	at dotty.tools.dotc.typer.Applications.simpleApply$1(Applications.scala:911)
scala: 	at dotty.tools.dotc.typer.Applications.realApply$1$$anonfun$3(Applications.scala:991)
scala: 	at dotty.tools.dotc.typer.Typer.tryEither(Typer.scala:3104)
scala: 	at dotty.tools.dotc.typer.Applications.realApply$1(Applications.scala:1002)
scala: 	at dotty.tools.dotc.typer.Applications.typedApply(Applications.scala:1040)
scala: 	at dotty.tools.dotc.typer.Applications.typedApply$(Applications.scala:327)
scala: 	at dotty.tools.dotc.typer.Inliner$InlineTyper.typedApply(Inliner.scala:1623)
scala: 	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2960)
scala: 	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2964)
scala: 	at dotty.tools.dotc.typer.Inliner$InlineTyper.typedSelect(Inliner.scala:1574)
scala: 	at dotty.tools.dotc.typer.Typer.typedNamed$1(Typer.scala:2801)
scala: 	at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:2894)
scala: 	at dotty.tools.dotc.typer.Typer.typedExpr(Typer.scala:3080)
scala: 	at dotty.tools.dotc.typer.Applications.realApply$1(Applications.scala:898)
scala: 	at dotty.tools.dotc.typer.Typer.$anonfun$47(Typer.scala:2278)
scala: 	at dotty.tools.dotc.typer.PrepareInlineable$.dropInlineIfError(PrepareInlineable.scala:248)
scala: 	at dotty.tools.dotc.typer.Typer.typedDefDef(Typer.scala:2278)
scala: 	at dotty.tools.dotc.typer.Typer.typedNamed$1(Typer.scala:2808)
scala: 	at dotty.tools.dotc.typer.Typer.traverse$1(Typer.scala:2986)
scala: 	at dotty.tools.dotc.typer.Typer.typedStats(Typer.scala:3036)
scala: 	at dotty.tools.dotc.typer.Typer.typedBlockStats(Typer.scala:1067)
scala: 	at dotty.tools.dotc.typer.Typer.typedBlock(Typer.scala:1071)
scala: 	at dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:2840)
scala: 	at dotty.tools.dotc.typer.Typer.typedBlock(Typer.scala:1073)
scala: 	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2957)
scala: 	at dotty.tools.dotc.typer.Inliner.inlined(Inliner.scala:1070)
scala: 	at dotty.tools.dotc.typer.Inliner$.inlineCall(Inliner.scala:166)
scala: 	at dotty.tools.dotc.typer.Typer.adaptNoArgsOther$1(Typer.scala:3666)
scala: 	at dotty.tools.dotc.typer.Typer.adaptNoArgs$1(Typer.scala:3783)
scala: 	at dotty.tools.dotc.typer.Typer.adapt1(Typer.scala:3995)
scala: 	at dotty.tools.dotc.typer.Typer.adapt(Typer.scala:3329)
scala: 	at dotty.tools.dotc.typer.Typer.traverse$1(Typer.scala:3013)
scala: 	at dotty.tools.dotc.typer.Typer.typedApply(Typer.scala:117)
scala: 	at dotty.tools.dotc.typer.Typer.typedInfixOp(Typer.scala:2717)
scala: 	at dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:2871)
scala: 	at dotty.tools.dotc.typer.Typer.typedClassDef(Typer.scala:2476)
scala: 	at dotty.tools.dotc.typer.Typer.typedTypeOrClassDef$1(Typer.scala:2820)
scala: 	at dotty.tools.dotc.typer.Typer.typedNamed$1(Typer.scala:2824)
scala: 	at dotty.tools.dotc.typer.Typer.typedPackageDef(Typer.scala:2603)
scala: 	at dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:2865)
scala: 	at dotty.tools.dotc.typer.TyperPhase.typeCheck$$anonfun$1(TyperPhase.scala:43)
scala: 	at dotty.tools.dotc.typer.TyperPhase.typeCheck$$anonfun$adapted$1(TyperPhase.scala:50)
scala: 	at scala.Function0.apply$mcV$sp(Function0.scala:39)
scala: 	at dotty.tools.dotc.core.Phases$Phase.monitor(Phases.scala:414)
scala: 	at dotty.tools.dotc.typer.TyperPhase.typeCheck(TyperPhase.scala:50)
scala: 	at dotty.tools.dotc.typer.TyperPhase.runOn$$anonfun$3(TyperPhase.scala:84)
scala: 	at scala.runtime.function.JProcedure1.apply(JProcedure1.java:15)
scala: 	at scala.runtime.function.JProcedure1.apply(JProcedure1.java:10)
scala: 	at scala.collection.immutable.List.foreach(List.scala:333)
scala: 	at dotty.tools.dotc.typer.TyperPhase.runOn(TyperPhase.scala:84)
scala: 	at dotty.tools.dotc.Run.runPhases$1$$anonfun$1(Run.scala:225)
scala: 	at scala.collection.ArrayOps$.foreach$extension(ArrayOps.scala:1328)
scala: 	at dotty.tools.dotc.Run.runPhases$1(Run.scala:236)
scala: 	at dotty.tools.dotc.Run.compileUnits$$anonfun$1(Run.scala:244)
scala: 	at dotty.tools.dotc.Run.compileUnits$$anonfun$adapted$1(Run.scala:253)
scala: 	at dotty.tools.dotc.util.Stats$.maybeMonitored(Stats.scala:68)
scala: 	at dotty.tools.dotc.Run.compileUnits(Run.scala:253)
scala: 	at dotty.tools.dotc.Run.compileSources(Run.scala:186)
scala: 	at dotty.tools.dotc.Run.compile(Run.scala:170)
scala: 	at dotty.tools.dotc.Driver.doCompile(Driver.scala:35)
scala: 	at dotty.tools.xsbt.CompilerBridgeDriver.run(CompilerBridgeDriver.java:88)
scala: 	at dotty.tools.xsbt.CompilerBridge.run(CompilerBridge.java:22)
scala: 	at sbt.internal.inc.AnalyzingCompiler.compile(AnalyzingCompiler.scala:91)
scala: 	at sbt.internal.inc.MixedAnalyzingCompiler.$anonfun$compile$7(MixedAnalyzingCompiler.scala:192)
scala: 	at scala.runtime.java8.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.scala:18)
scala: 	at sbt.internal.inc.MixedAnalyzingCompiler.timed(MixedAnalyzingCompiler.scala:247)
scala: 	at sbt.internal.inc.MixedAnalyzingCompiler.$anonfun$compile$4(MixedAnalyzingCompiler.scala:182)
scala: 	at sbt.internal.inc.MixedAnalyzingCompiler.$anonfun$compile$4$adapted(MixedAnalyzingCompiler.scala:163)
scala: 	at sbt.internal.inc.JarUtils$.withPreviousJar(JarUtils.scala:239)
scala: 	at sbt.internal.inc.MixedAnalyzingCompiler.compileScala$1(MixedAnalyzingCompiler.scala:163)
scala: 	at sbt.internal.inc.MixedAnalyzingCompiler.compile(MixedAnalyzingCompiler.scala:210)
scala: 	at sbt.internal.inc.IncrementalCompilerImpl.$anonfun$compileInternal$1(IncrementalCompilerImpl.scala:528)
scala: 	at sbt.internal.inc.IncrementalCompilerImpl.$anonfun$compileInternal$1$adapted(IncrementalCompilerImpl.scala:528)
scala: 	at sbt.internal.inc.Incremental$.$anonfun$apply$5(Incremental.scala:177)
scala: 	at sbt.internal.inc.Incremental$.$anonfun$apply$5$adapted(Incremental.scala:175)
scala: 	at sbt.internal.inc.Incremental$$anon$2.run(Incremental.scala:461)
scala: 	at sbt.internal.inc.IncrementalCommon$CycleState.next(IncrementalCommon.scala:116)
scala: 	at sbt.internal.inc.IncrementalCommon$$anon$1.next(IncrementalCommon.scala:56)
scala: 	at sbt.internal.inc.IncrementalCommon$$anon$1.next(IncrementalCommon.scala:52)
scala: 	at sbt.internal.inc.IncrementalCommon.cycle(IncrementalCommon.scala:263)
scala: 	at sbt.internal.inc.Incremental$.$anonfun$incrementalCompile$8(Incremental.scala:416)
scala: 	at sbt.internal.inc.Incremental$.withClassfileManager(Incremental.scala:503)
scala: 	at sbt.internal.inc.Incremental$.incrementalCompile(Incremental.scala:403)
scala: 	at sbt.internal.inc.Incremental$.apply(Incremental.scala:169)
scala: 	at sbt.internal.inc.IncrementalCompilerImpl.compileInternal(IncrementalCompilerImpl.scala:528)
scala: 	at sbt.internal.inc.IncrementalCompilerImpl.$anonfun$compileIncrementally$1(IncrementalCompilerImpl.scala:482)
scala: 	at sbt.internal.inc.IncrementalCompilerImpl.handleCompilationError(IncrementalCompilerImpl.scala:332)
scala: 	at sbt.internal.inc.IncrementalCompilerImpl.compileIncrementally(IncrementalCompilerImpl.scala:420)
scala: 	at sbt.internal.inc.IncrementalCompilerImpl.compile(IncrementalCompilerImpl.scala:137)
scala: 	at org.jetbrains.jps.incremental.scala.local.SbtCompiler.$anonfun$doCompile$3(SbtCompiler.scala:91)
scala: 	at scala.util.Try$.apply(Try.scala:210)
scala: 	at org.jetbrains.jps.incremental.scala.local.SbtCompiler.doCompile(SbtCompiler.scala:89)
scala: 	at org.jetbrains.jps.incremental.scala.local.SbtCompiler.compile(SbtCompiler.scala:20)
scala: 	at org.jetbrains.jps.incremental.scala.local.LocalServer.doCompile(LocalServer.scala:52)
scala: 	at org.jetbrains.jps.incremental.scala.local.LocalServer.compile(LocalServer.scala:30)
scala: 	at org.jetbrains.jps.incremental.scala.remote.Main$.compileLogic(Main.scala:209)
scala: 	at org.jetbrains.jps.incremental.scala.remote.Main$.$anonfun$handleCommand$1(Main.scala:192)
scala: 	at org.jetbrains.jps.incremental.scala.remote.Main$.decorated$1(Main.scala:182)
scala: 	at org.jetbrains.jps.incremental.scala.remote.Main$.handleCommand(Main.scala:189)
scala: 	at org.jetbrains.jps.incremental.scala.remote.Main$.serverLogic(Main.scala:165)
scala: 	at org.jetbrains.jps.incremental.scala.remote.Main$.nailMain(Main.scala:105)
scala: 	at org.jetbrains.jps.incremental.scala.remote.Main.nailMain(Main.scala)
scala: 	at jdk.internal.reflect.GeneratedMethodAccessor13.invoke(Unknown Source)
scala: 	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
scala: 	at java.base/java.lang.reflect.Method.invoke(Method.java:568)
scala: 	at com.facebook.nailgun.NGSession.runImpl(NGSession.java:312)
scala: 	at com.facebook.nailgun.NGSession.run(NGSession.java:198)

In my case this does not prevent the compiler from going further though other users report compiler crashes with messages like

[error] class izumi.fundamentals.orphans.cats.Applicative cannot be unpickled because no class file was found for denot: val <none>

At this moment I cannot produce minimal repro and even reliable repro, I wasn't able to reproduce the crashes too.

pshirshov avatar Sep 13 '22 17:09 pshirshov

@odersky , that's the issue I mentioned during our conversation.

In order to reproduce on izumi:

  1. Clone izumi repo, check out commit https://github.com/7mind/izumi/commit/319bec48035cf6f8bbb641ef8220593e3b57d756
  2. Run ./sbtgen.sc --js
  3. Type ++ 3 in the sbt shell followed by ;clean;test:compile

Watch the build log. There will be stacktraces like:

 java.lang.AssertionError: assertion failed: class DIException has non-class parent: val <none>
	at scala.runtime.Scala3RunTime$.assertFailed(Scala3RunTime.scala:8)
	at dotty.tools.dotc.core.SymDenotations$ClassDenotation.traverse$1(SymDenotations.scala:1912)
	at dotty.tools.dotc.core.SymDenotations$ClassDenotation.computeBaseData(SymDenotations.scala:1917)
	at dotty.tools.dotc.core.SymDenotations$BaseDataImpl.apply(SymDenotations.scala:2889)
	at dotty.tools.dotc.core.SymDenotations$ClassDenotation.baseData(SymDenotations.scala:1883)
	at dotty.tools.dotc.core.SymDenotations$ClassDenotation.baseClassSet(SymDenotations.scala:1899)
	at dotty.tools.dotc.core.SymDenotations$ClassDenotation.derivesFrom(SymDenotations.scala:1925)
	at dotty.tools.dotc.core.SymDenotations$SymDenotation.isValueClass(SymDenotations.scala:821)
	at dotty.tools.dotc.transform.ValueClasses$.isDerivedValueClass(ValueClasses.scala:19)
	at dotty.tools.dotc.core.TypeErasure.dotty$tools$dotc$core$TypeErasure$$sigName(TypeErasure.scala:822)
	at dotty.tools.dotc.core.TypeErasure$.sigName(TypeErasure.scala:204)
	at dotty.tools.dotc.core.Signature$.apply(Signature.scala:167)
	at dotty.tools.dotc.core.Types$MethodOrPoly.computeSignature$2(Types.scala:3678)
	at dotty.tools.dotc.core.Types$MethodOrPoly.signature(Types.scala:3699)
	at dotty.tools.dotc.core.Denotations$SingleDenotation.signature(Denotations.scala:615)
	at dotty.tools.dotc.core.Denotations$SingleDenotation.matchesLoosely(Denotations.scala:1033)
	at dotty.tools.dotc.core.Denotations$SingleDenotation.matches(Denotations.scala:1017)
	at dotty.tools.dotc.core.Denotations$Denotation.mergeDenot$1(Denotations.scala:406)
	at dotty.tools.dotc.core.Denotations$Denotation.meet(Denotations.scala:496)
	at dotty.tools.dotc.core.Denotations$DenotUnion.toDenot(Denotations.scala:1239)
	at dotty.tools.dotc.core.Denotations$DenotUnion.toDenot(Denotations.scala:1239)
	at dotty.tools.dotc.core.Types$Type.findDecl(Types.scala:641)
	at dotty.tools.dotc.core.Types$Type.decl(Types.scala:628)
	at dotty.tools.dotc.core.tasty.TreeUnpickler$TreeReader.readLengthTerm$1(TreeUnpickler.scala:1322)
	at dotty.tools.dotc.core.tasty.TreeUnpickler$TreeReader.readTerm(TreeUnpickler.scala:1394)
	at dotty.tools.dotc.core.tasty.TreeUnpickler$TreeReader.readLengthTerm$1(TreeUnpickler.scala:1233)
	at dotty.tools.dotc.core.tasty.TreeUnpickler$TreeReader.readTerm(TreeUnpickler.scala:1394)
	at dotty.tools.dotc.core.tasty.TreeUnpickler$TreeReader.$anonfun$19(TreeUnpickler.scala:984)
	at dotty.tools.tasty.TastyReader.collectWhile(TastyReader.scala:137)
	at dotty.tools.dotc.core.tasty.TreeUnpickler$TreeReader.readTemplate(TreeUnpickler.scala:987)
	at dotty.tools.dotc.core.tasty.TreeUnpickler$TreeReader.readNewDef(TreeUnpickler.scala:905)
	at dotty.tools.dotc.core.tasty.TreeUnpickler$TreeReader.readIndexedDef(TreeUnpickler.scala:824)
	at dotty.tools.dotc.core.tasty.TreeUnpickler$Completer.liftedTree1$1(TreeUnpickler.scala:138)
	at dotty.tools.dotc.core.tasty.TreeUnpickler$Completer.complete(TreeUnpickler.scala:142)
	at dotty.tools.dotc.core.SymDenotations$SymDenotation.completeFrom(SymDenotations.scala:173)
	at dotty.tools.dotc.core.Denotations$Denotation.completeInfo$1(Denotations.scala:187)
	at dotty.tools.dotc.core.Denotations$Denotation.info(Denotations.scala:189)
	at dotty.tools.dotc.core.Denotations$Denotation.completeInfo$1(Denotations.scala:187)
	at dotty.tools.dotc.core.Denotations$Denotation.info(Denotations.scala:189)
	at dotty.tools.dotc.core.SymDenotations$SymDenotation.ensureCompleted(SymDenotations.scala:380)
	at dotty.tools.dotc.core.SymDenotations$SymDenotation.flags(SymDenotations.scala:66)
	at dotty.tools.dotc.core.SymDenotations$SymDenotation.is(SymDenotations.scala:122)
	at dotty.tools.dotc.typer.Checking$NotPrivate$1.isLeaked(Checking.scala:617)
	at dotty.tools.dotc.typer.Checking$NotPrivate$1.apply(Checking.scala:632)
	at dotty.tools.dotc.typer.Checking$NotPrivate$1.apply(Checking.scala:628)
	at scala.collection.immutable.List.mapConserve(List.scala:472)
	at dotty.tools.dotc.core.Types$TypeMap.mapOverLambda(Types.scala:5585)
	at dotty.tools.dotc.core.Types$TypeMap.mapOver(Types.scala:5620)
	at dotty.tools.dotc.typer.Checking$NotPrivate$1.apply(Checking.scala:670)
	at dotty.tools.dotc.typer.Checking$.checkNoPrivateLeaks(Checking.scala:674)
	at dotty.tools.dotc.typer.TypeAssigner.avoidPrivateLeaks(TypeAssigner.scala:45)
	at dotty.tools.dotc.typer.TypeAssigner.avoidPrivateLeaks$(TypeAssigner.scala:16)
	at dotty.tools.dotc.typer.Typer.avoidPrivateLeaks(Typer.scala:121)
	at dotty.tools.dotc.core.tasty.TreeUnpickler$TreeReader.readNewDef(TreeUnpickler.scala:946)
	at dotty.tools.dotc.core.tasty.TreeUnpickler$TreeReader.readIndexedDef(TreeUnpickler.scala:824)
	at dotty.tools.dotc.core.tasty.TreeUnpickler$Completer.liftedTree1$1(TreeUnpickler.scala:138)
	at dotty.tools.dotc.core.tasty.TreeUnpickler$Completer.complete(TreeUnpickler.scala:142)
	at dotty.tools.dotc.core.SymDenotations$SymDenotation.completeFrom(SymDenotations.scala:173)
	at dotty.tools.dotc.core.Denotations$Denotation.completeInfo$1(Denotations.scala:187)
	at dotty.tools.dotc.core.Denotations$Denotation.info(Denotations.scala:189)
	at dotty.tools.dotc.core.Types$TermRef.underlying(Types.scala:2769)
	at dotty.tools.dotc.core.Types$Type.widenSingleton(Types.scala:1238)
	at dotty.tools.dotc.typer.ProtoTypes$Compatibility.normalizedCompatible(ProtoTypes.scala:59)
	at dotty.tools.dotc.typer.ProtoTypes$Compatibility.normalizedCompatible$(ProtoTypes.scala:26)
	at dotty.tools.dotc.typer.ProtoTypes$NoViewsAllowed$.normalizedCompatible(ProtoTypes.scala:120)
	at dotty.tools.dotc.typer.ProtoTypes$SelectionProto.qualifies$1(ProtoTypes.scala:209)
	at dotty.tools.dotc.typer.ProtoTypes$SelectionProto.liftedTree1$1(ProtoTypes.scala:213)
	at dotty.tools.dotc.typer.ProtoTypes$SelectionProto.isMatchedBy(ProtoTypes.scala:226)
	at dotty.tools.dotc.core.TypeComparer.isMatchedByProto(TypeComparer.scala:2032)
	at dotty.tools.dotc.core.TypeComparer.firstTry$1(TypeComparer.scala:329)
	at dotty.tools.dotc.core.TypeComparer.recur(TypeComparer.scala:1447)
	at dotty.tools.dotc.core.TypeComparer.isSubType(TypeComparer.scala:210)
	at dotty.tools.dotc.core.TypeComparer.isSubType(TypeComparer.scala:220)
	at dotty.tools.dotc.core.TypeComparer.topLevelSubType(TypeComparer.scala:130)
	at dotty.tools.dotc.core.TypeComparer.testSubType(TypeComparer.scala:146)
	at dotty.tools.dotc.core.TypeComparer$.testSubType(TypeComparer.scala:2932)
	at dotty.tools.dotc.typer.Typer.adaptNoArgsOther$1(Typer.scala:3770)
	at dotty.tools.dotc.typer.Typer.adaptNoArgs$1(Typer.scala:3849)
	at dotty.tools.dotc.typer.Typer.adapt1(Typer.scala:4071)
	at dotty.tools.dotc.typer.Typer.adapt(Typer.scala:3406)
	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:3025)
	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:3029)
	at dotty.tools.dotc.typer.Typer.typedExpr(Typer.scala:3145)
	at dotty.tools.dotc.typer.Typer.typeSelectOnTerm$1(Typer.scala:653)
	at dotty.tools.dotc.typer.Typer.typedSelect(Typer.scala:691)
	at dotty.tools.dotc.typer.Typer.typedNamed$1(Typer.scala:2864)
	at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:2957)
	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:3025)
	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:3029)
	at dotty.tools.dotc.typer.Typer.typedExpr(Typer.scala:3145)
	at dotty.tools.dotc.typer.Applications.tryWithProto$1(Applications.scala:1299)
	at dotty.tools.dotc.typer.Applications.tryWithTypeArgs$1$$anonfun$1(Applications.scala:1311)
	at dotty.tools.dotc.typer.Typer.tryEither(Typer.scala:3169)
	at dotty.tools.dotc.typer.Applications.tryWithTypeArgs$1(Applications.scala:1319)
	at dotty.tools.dotc.typer.Applications.tryWithName$1(Applications.scala:1326)
	at dotty.tools.dotc.typer.Applications.trySelectUnapply$1(Applications.scala:1340)
	at dotty.tools.dotc.typer.Applications.typedUnApply(Applications.scala:1353)
	at dotty.tools.dotc.typer.Applications.typedUnApply$(Applications.scala:346)
	at dotty.tools.dotc.typer.Typer.typedUnApply(Typer.scala:121)
	at dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:2895)
	at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:2958)
	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:3025)
	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:3029)
	at dotty.tools.dotc.typer.Typer.typedPattern(Typer.scala:3165)
	at dotty.tools.dotc.typer.Typer.typedCase(Typer.scala:1758)
	at dotty.tools.dotc.typer.Typer.typedCases$$anonfun$1(Typer.scala:1691)
	at dotty.tools.dotc.core.Decorators$ListDecorator$.loop$1(Decorators.scala:91)
	at dotty.tools.dotc.core.Decorators$ListDecorator$.mapconserve$extension(Decorators.scala:107)
	at dotty.tools.dotc.typer.Typer.typedCases(Typer.scala:1693)
	at dotty.tools.dotc.typer.Typer.$anonfun$35(Typer.scala:1860)
	at dotty.tools.dotc.typer.Applications.harmonic(Applications.scala:2287)
	at dotty.tools.dotc.typer.Applications.harmonic$(Applications.scala:346)
	at dotty.tools.dotc.typer.Typer.harmonic(Typer.scala:121)
	at dotty.tools.dotc.typer.Typer.typedTry(Typer.scala:1863)
	at dotty.tools.dotc.typer.Typer.typedTry(Typer.scala:1876)
	at dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:2935)
	at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:2958)
	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:3025)
	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:3029)
	at dotty.tools.dotc.typer.Typer.traverse$1(Typer.scala:3078)
	at dotty.tools.dotc.typer.Typer.typedStats(Typer.scala:3101)
	at dotty.tools.dotc.typer.Typer.typedBlockStats(Typer.scala:1063)
	at dotty.tools.dotc.typer.Typer.typedBlock(Typer.scala:1067)
	at dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:2903)
	at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:2958)
	at dotty.tools.dotc.typer.ProtoTypes$FunProto.$anonfun$7(ProtoTypes.scala:491)
	at dotty.tools.dotc.typer.ProtoTypes$FunProto.cacheTypedArg(ProtoTypes.scala:414)
	at dotty.tools.dotc.typer.ProtoTypes$FunProto.typedArg(ProtoTypes.scala:492)
	at dotty.tools.dotc.typer.Applications$ApplyToUntyped.typedArg(Applications.scala:884)
	at dotty.tools.dotc.typer.Applications$ApplyToUntyped.typedArg(Applications.scala:884)
	at dotty.tools.dotc.typer.Applications$Application.addTyped$1(Applications.scala:576)
	at dotty.tools.dotc.typer.Applications$Application.matchArgs(Applications.scala:640)
	at dotty.tools.dotc.typer.Applications$Application.init(Applications.scala:479)
	at dotty.tools.dotc.typer.Applications$TypedApply.<init>(Applications.scala:766)
	at dotty.tools.dotc.typer.Applications$ApplyToUntyped.<init>(Applications.scala:883)
	at dotty.tools.dotc.typer.Applications.ApplyTo(Applications.scala:1095)
	at dotty.tools.dotc.typer.Applications.ApplyTo$(Applications.scala:346)
	at dotty.tools.dotc.typer.Typer.ApplyTo(Typer.scala:121)
	at dotty.tools.dotc.typer.Applications.simpleApply$1(Applications.scala:941)
	at dotty.tools.dotc.typer.Applications.realApply$1$$anonfun$3(Applications.scala:1021)
	at dotty.tools.dotc.typer.Typer.tryEither(Typer.scala:3169)
	at dotty.tools.dotc.typer.Applications.realApply$1(Applications.scala:1032)
	at dotty.tools.dotc.typer.Applications.typedApply(Applications.scala:1070)
	at dotty.tools.dotc.typer.Applications.typedApply$(Applications.scala:346)
	at dotty.tools.dotc.typer.Typer.typedApply(Typer.scala:121)
	at dotty.tools.dotc.typer.Typer.typedInfixOp(Typer.scala:2779)
	at dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:2934)
	at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:2958)
	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:3025)
	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:3029)
	at dotty.tools.dotc.typer.Typer.traverse$1(Typer.scala:3078)
	at dotty.tools.dotc.typer.Typer.typedStats(Typer.scala:3101)
	at dotty.tools.dotc.typer.Typer.typedClassDef(Typer.scala:2532)
	at dotty.tools.dotc.typer.Typer.typedTypeOrClassDef$1(Typer.scala:2883)
	at dotty.tools.dotc.typer.Typer.typedNamed$1(Typer.scala:2887)
	at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:2957)
	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:3025)
	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:3029)
	at dotty.tools.dotc.typer.Typer.traverse$1(Typer.scala:3051)
	at dotty.tools.dotc.typer.Typer.typedStats(Typer.scala:3101)
	at dotty.tools.dotc.typer.Typer.typedPackageDef(Typer.scala:2659)
	at dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:2928)
	at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:2958)
	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:3025)
	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:3029)
	at dotty.tools.dotc.typer.Typer.typedExpr(Typer.scala:3145)
	at dotty.tools.dotc.typer.TyperPhase.typeCheck$$anonfun$1(TyperPhase.scala:44)
	at dotty.tools.dotc.typer.TyperPhase.typeCheck$$anonfun$adapted$1(TyperPhase.scala:54)
	at scala.Function0.apply$mcV$sp(Function0.scala:42)
	at dotty.tools.dotc.core.Phases$Phase.monitor(Phases.scala:429)
	at dotty.tools.dotc.typer.TyperPhase.typeCheck(TyperPhase.scala:54)
	at dotty.tools.dotc.typer.TyperPhase.runOn$$anonfun$3(TyperPhase.scala:88)
	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.typer.TyperPhase.runOn(TyperPhase.scala:88)
	at dotty.tools.dotc.Run.runPhases$1$$anonfun$1(Run.scala:238)
	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:249)
	at dotty.tools.dotc.Run.compileUnits$$anonfun$1(Run.scala:257)
	at dotty.tools.dotc.Run.compileUnits$$anonfun$adapted$1(Run.scala:266)
	at dotty.tools.dotc.util.Stats$.maybeMonitored(Stats.scala:68)
	at dotty.tools.dotc.Run.compileUnits(Run.scala:266)
	at dotty.tools.dotc.Run.compileSources(Run.scala:190)
	at dotty.tools.dotc.Run.compile(Run.scala:174)
	at dotty.tools.dotc.Driver.doCompile(Driver.scala:35)
	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:193)
	at scala.runtime.java8.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.java:23)
	at sbt.internal.inc.MixedAnalyzingCompiler.timed(MixedAnalyzingCompiler.scala:248)
	at sbt.internal.inc.MixedAnalyzingCompiler.$anonfun$compile$4(MixedAnalyzingCompiler.scala:183)
	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:211)
	at sbt.internal.inc.IncrementalCompilerImpl.$anonfun$compileInternal$1(IncrementalCompilerImpl.scala:534)
	at sbt.internal.inc.IncrementalCompilerImpl.$anonfun$compileInternal$1$adapted(IncrementalCompilerImpl.scala:534)
	at sbt.internal.inc.Incremental$.$anonfun$apply$5(Incremental.scala:179)
	at sbt.internal.inc.Incremental$.$anonfun$apply$5$adapted(Incremental.scala:177)
	at sbt.internal.inc.Incremental$$anon$2.run(Incremental.scala:463)
	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:418)
	at sbt.internal.inc.Incremental$.withClassfileManager(Incremental.scala:506)
	at sbt.internal.inc.Incremental$.incrementalCompile(Incremental.scala:405)
	at sbt.internal.inc.Incremental$.apply(Incremental.scala:171)
	at sbt.internal.inc.IncrementalCompilerImpl.compileInternal(IncrementalCompilerImpl.scala:534)
	at sbt.internal.inc.IncrementalCompilerImpl.$anonfun$compileIncrementally$1(IncrementalCompilerImpl.scala:488)
	at sbt.internal.inc.IncrementalCompilerImpl.handleCompilationError(IncrementalCompilerImpl.scala:332)
	at sbt.internal.inc.IncrementalCompilerImpl.compileIncrementally(IncrementalCompilerImpl.scala:425)
	at sbt.internal.inc.IncrementalCompilerImpl.compile(IncrementalCompilerImpl.scala:137)
	at sbt.Defaults$.compileIncrementalTaskImpl(Defaults.scala:2363)
	at sbt.Defaults$.$anonfun$compileIncrementalTask$2(Defaults.scala:2313)
	at sbt.internal.server.BspCompileTask$.$anonfun$compute$1(BspCompileTask.scala:30)
	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:30)
	at sbt.Defaults$.$anonfun$compileIncrementalTask$1(Defaults.scala:2311)
	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.base/java.util.concurrent.FutureTask.run(FutureTask.java:317)
	at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:577)
	at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:317)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1144)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642)
	at java.base/java.lang.Thread.run(Thread.java:1589)
no sig for TypeRef(ThisType(TypeRef(NoPrefix,module class exceptions)),class DIException) because of ()

The build will succeed regardless. It might be interesting that the "problematic" classes differ from run to run. That makes me think that it might be some kind of a race condition in the compiler.

I still can't isolate it but it is easily reproducible and, as you requested, the stacktraces are available.

pshirshov avatar Feb 10 '23 16:02 pshirshov

I'm seeing what looks to be an identical crash in one of my own projects. Scala 3.2.2, SBT 1.8.2, Java 18.0.2 on Linux x86_64.

Stack trace java.lang.AssertionError: assertion failed: trait AutoRollback has non-class parent: val scala.runtime.Scala3RunTime$.assertFailed(Scala3RunTime.scala:8) dotty.tools.dotc.core.SymDenotations$ClassDenotation.traverse$1(SymDenotations.scala:1912) dotty.tools.dotc.core.SymDenotations$ClassDenotation.computeBaseData(SymDenotations.scala:1917) dotty.tools.dotc.core.SymDenotations$BaseDataImpl.apply(SymDenotations.scala:2889) dotty.tools.dotc.core.SymDenotations$ClassDenotation.baseData(SymDenotations.scala:1883) dotty.tools.dotc.core.SymDenotations$ClassDenotation.baseClassSet(SymDenotations.scala:1899) dotty.tools.dotc.core.SymDenotations$ClassDenotation.derivesFrom(SymDenotations.scala:1925) dotty.tools.dotc.core.Types$Type.loop$1(Types.scala:268) dotty.tools.dotc.core.Types$Type.derivesFrom(Types.scala:292) dotty.tools.dotc.typer.Namer$ClassCompleter.checkedParentType$1(Namer.scala:1490) dotty.tools.dotc.typer.Namer$ClassCompleter.$anonfun$27(Namer.scala:1558) scala.collection.immutable.List.map(List.scala:246) dotty.tools.dotc.typer.Namer$ClassCompleter.completeInCreationContext(Namer.scala:1558) dotty.tools.dotc.typer.Namer$Completer.complete(Namer.scala:810) dotty.tools.dotc.core.SymDenotations$SymDenotation.completeFrom(SymDenotations.scala:173) dotty.tools.dotc.core.Denotations$Denotation.completeInfo$1(Denotations.scala:187) dotty.tools.dotc.core.Denotations$Denotation.info(Denotations.scala:189) dotty.tools.dotc.core.SymDenotations$SymDenotation.ensureCompleted(SymDenotations.scala:380) dotty.tools.dotc.typer.Typer.retrieveSym(Typer.scala:2836) dotty.tools.dotc.typer.Typer.typedNamed$1(Typer.scala:2861) dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:2957) dotty.tools.dotc.typer.Typer.typed(Typer.scala:3025) dotty.tools.dotc.typer.Typer.typed(Typer.scala:3029) dotty.tools.dotc.typer.Typer.traverse$1(Typer.scala:3051) dotty.tools.dotc.typer.Typer.typedStats(Typer.scala:3101) dotty.tools.dotc.typer.Typer.typedBlockStats(Typer.scala:1063) dotty.tools.dotc.typer.Typer.typedBlock(Typer.scala:1067) dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:2903) dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:2958) dotty.tools.dotc.typer.Typer.typed(Typer.scala:3025) dotty.tools.dotc.typer.Typer.typed(Typer.scala:3029) dotty.tools.dotc.typer.Typer.typedNew(Typer.scala:814) dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:2899) dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:2958) dotty.tools.dotc.typer.ProtoTypes$FunProto.$anonfun$7(ProtoTypes.scala:491) dotty.tools.dotc.typer.ProtoTypes$FunProto.cacheTypedArg(ProtoTypes.scala:414) dotty.tools.dotc.typer.ProtoTypes$FunProto.typedArg(ProtoTypes.scala:492) dotty.tools.dotc.typer.Applications$ApplyToUntyped.typedArg(Applications.scala:884) dotty.tools.dotc.typer.Applications$ApplyToUntyped.typedArg(Applications.scala:884) dotty.tools.dotc.typer.Applications$Application.addTyped$1(Applications.scala:576) dotty.tools.dotc.typer.Applications$Application.matchArgs(Applications.scala:640) dotty.tools.dotc.typer.Applications$Application.init(Applications.scala:479) dotty.tools.dotc.typer.Applications$TypedApply.(Applications.scala:766) dotty.tools.dotc.typer.Applications$ApplyToUntyped.(Applications.scala:883) dotty.tools.dotc.typer.Applications.ApplyTo(Applications.scala:1095) dotty.tools.dotc.typer.Applications.ApplyTo$(Applications.scala:346) dotty.tools.dotc.typer.Typer.ApplyTo(Typer.scala:121) dotty.tools.dotc.typer.Applications.simpleApply$1(Applications.scala:941) dotty.tools.dotc.typer.Applications.realApply$1$$anonfun$3(Applications.scala:1021) dotty.tools.dotc.typer.Typer.tryEither(Typer.scala:3169) dotty.tools.dotc.typer.Applications.realApply$1(Applications.scala:1032) dotty.tools.dotc.typer.Applications.typedApply(Applications.scala:1070) dotty.tools.dotc.typer.Applications.typedApply$(Applications.scala:346) dotty.tools.dotc.typer.Typer.typedApply(Typer.scala:121) dotty.tools.dotc.typer.Typer.typedInfixOp(Typer.scala:2779) dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:2934) dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:2958) dotty.tools.dotc.typer.Typer.typed(Typer.scala:3025) dotty.tools.dotc.typer.Typer.typed(Typer.scala:3029) dotty.tools.dotc.typer.Typer.traverse$1(Typer.scala:3078) dotty.tools.dotc.typer.Typer.typedStats(Typer.scala:3101) dotty.tools.dotc.typer.Typer.typedBlockStats(Typer.scala:1063) dotty.tools.dotc.typer.Typer.typedBlock(Typer.scala:1067) dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:2903) dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:2958) dotty.tools.dotc.typer.ProtoTypes$FunProto.$anonfun$7(ProtoTypes.scala:491) dotty.tools.dotc.typer.ProtoTypes$FunProto.cacheTypedArg(ProtoTypes.scala:414) dotty.tools.dotc.typer.ProtoTypes$FunProto.typedArg(ProtoTypes.scala:492) dotty.tools.dotc.typer.Applications$ApplyToUntyped.typedArg(Applications.scala:884) dotty.tools.dotc.typer.Applications$ApplyToUntyped.typedArg(Applications.scala:884) dotty.tools.dotc.typer.Applications$Application.addTyped$1(Applications.scala:576) dotty.tools.dotc.typer.Applications$Application.matchArgs(Applications.scala:640) dotty.tools.dotc.typer.Applications$Application.init(Applications.scala:479) dotty.tools.dotc.typer.Applications$TypedApply.(Applications.scala:766) dotty.tools.dotc.typer.Applications$ApplyToUntyped.(Applications.scala:883) dotty.tools.dotc.typer.Applications.ApplyTo(Applications.scala:1095) dotty.tools.dotc.typer.Applications.ApplyTo$(Applications.scala:346) dotty.tools.dotc.typer.Typer.ApplyTo(Typer.scala:121) dotty.tools.dotc.typer.Applications.simpleApply$1(Applications.scala:941) dotty.tools.dotc.typer.Applications.realApply$1$$anonfun$3(Applications.scala:1021) dotty.tools.dotc.typer.Typer.tryEither(Typer.scala:3169) dotty.tools.dotc.typer.Applications.realApply$1(Applications.scala:1032) dotty.tools.dotc.typer.Applications.typedApply(Applications.scala:1070) dotty.tools.dotc.typer.Applications.typedApply$(Applications.scala:346) dotty.tools.dotc.typer.Typer.typedApply(Typer.scala:121) dotty.tools.dotc.typer.Typer.typedInfixOp(Typer.scala:2779) dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:2934) dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:2958) dotty.tools.dotc.typer.Typer.typed(Typer.scala:3025) dotty.tools.dotc.typer.Typer.typed(Typer.scala:3029) dotty.tools.dotc.typer.Typer.traverse$1(Typer.scala:3078) dotty.tools.dotc.typer.Typer.typedStats(Typer.scala:3101) dotty.tools.dotc.typer.Typer.typedClassDef(Typer.scala:2532) dotty.tools.dotc.typer.Typer.typedTypeOrClassDef$1(Typer.scala:2883) dotty.tools.dotc.typer.Typer.typedNamed$1(Typer.scala:2887) dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:2957) dotty.tools.dotc.typer.Typer.typed(Typer.scala:3025) dotty.tools.dotc.typer.Typer.typed(Typer.scala:3029) dotty.tools.dotc.typer.Typer.traverse$1(Typer.scala:3051) dotty.tools.dotc.typer.Typer.typedStats(Typer.scala:3101) dotty.tools.dotc.typer.Typer.typedPackageDef(Typer.scala:2659) dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:2928) dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:2958) dotty.tools.dotc.typer.Typer.typed(Typer.scala:3025) dotty.tools.dotc.typer.Typer.typed(Typer.scala:3029) dotty.tools.dotc.typer.Typer.typedExpr(Typer.scala:3145) dotty.tools.dotc.typer.TyperPhase.typeCheck$$anonfun$1(TyperPhase.scala:44) dotty.tools.dotc.typer.TyperPhase.typeCheck$$anonfun$adapted$1(TyperPhase.scala:54) scala.Function0.apply$mcV$sp(Function0.scala:42) dotty.tools.dotc.core.Phases$Phase.monitor(Phases.scala:429) dotty.tools.dotc.typer.TyperPhase.typeCheck(TyperPhase.scala:54) dotty.tools.dotc.typer.TyperPhase.runOn$$anonfun$3(TyperPhase.scala:88) scala.runtime.function.JProcedure1.apply(JProcedure1.java:15) scala.runtime.function.JProcedure1.apply(JProcedure1.java:10) scala.collection.immutable.List.foreach(List.scala:333) dotty.tools.dotc.typer.TyperPhase.runOn(TyperPhase.scala:88) dotty.tools.dotc.Run.runPhases$1$$anonfun$1(Run.scala:238) scala.runtime.function.JProcedure1.apply(JProcedure1.java:15) scala.runtime.function.JProcedure1.apply(JProcedure1.java:10) scala.collection.ArrayOps$.foreach$extension(ArrayOps.scala:1321) dotty.tools.dotc.Run.runPhases$1(Run.scala:249) dotty.tools.dotc.Run.compileUnits$$anonfun$1(Run.scala:257) dotty.tools.dotc.Run.compileUnits$$anonfun$adapted$1(Run.scala:266) dotty.tools.dotc.util.Stats$.maybeMonitored(Stats.scala:68) dotty.tools.dotc.Run.compileUnits(Run.scala:266) dotty.tools.dotc.Run.compileSources(Run.scala:190) dotty.tools.dotc.Run.compile(Run.scala:174) dotty.tools.dotc.Driver.doCompile(Driver.scala:35) dotty.tools.xsbt.CompilerBridgeDriver.run(CompilerBridgeDriver.java:88) dotty.tools.xsbt.CompilerBridge.run(CompilerBridge.java:22) sbt.internal.inc.AnalyzingCompiler.compile(AnalyzingCompiler.scala:91) sbt.internal.inc.MixedAnalyzingCompiler.$anonfun$compile$7(MixedAnalyzingCompiler.scala:193) scala.runtime.java8.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.java:23) sbt.internal.inc.MixedAnalyzingCompiler.timed(MixedAnalyzingCompiler.scala:248) sbt.internal.inc.MixedAnalyzingCompiler.$anonfun$compile$4(MixedAnalyzingCompiler.scala:183) sbt.internal.inc.MixedAnalyzingCompiler.$anonfun$compile$4$adapted(MixedAnalyzingCompiler.scala:163) sbt.internal.inc.JarUtils$.withPreviousJar(JarUtils.scala:239) sbt.internal.inc.MixedAnalyzingCompiler.compileScala$1(MixedAnalyzingCompiler.scala:163) sbt.internal.inc.MixedAnalyzingCompiler.compile(MixedAnalyzingCompiler.scala:211) sbt.internal.inc.IncrementalCompilerImpl.$anonfun$compileInternal$1(IncrementalCompilerImpl.scala:534) sbt.internal.inc.IncrementalCompilerImpl.$anonfun$compileInternal$1$adapted(IncrementalCompilerImpl.scala:534) sbt.internal.inc.Incremental$.$anonfun$apply$5(Incremental.scala:179) sbt.internal.inc.Incremental$.$anonfun$apply$5$adapted(Incremental.scala:177) sbt.internal.inc.Incremental$$anon$2.run(Incremental.scala:463) sbt.internal.inc.IncrementalCommon$CycleState.next(IncrementalCommon.scala:116) sbt.internal.inc.IncrementalCommon$$anon$1.next(IncrementalCommon.scala:56) sbt.internal.inc.IncrementalCommon$$anon$1.next(IncrementalCommon.scala:52) sbt.internal.inc.IncrementalCommon.cycle(IncrementalCommon.scala:263) sbt.internal.inc.Incremental$.$anonfun$incrementalCompile$8(Incremental.scala:418) sbt.internal.inc.Incremental$.withClassfileManager(Incremental.scala:506) sbt.internal.inc.Incremental$.incrementalCompile(Incremental.scala:405) sbt.internal.inc.Incremental$.apply(Incremental.scala:171) sbt.internal.inc.IncrementalCompilerImpl.compileInternal(IncrementalCompilerImpl.scala:534) sbt.internal.inc.IncrementalCompilerImpl.$anonfun$compileIncrementally$1(IncrementalCompilerImpl.scala:488) sbt.internal.inc.IncrementalCompilerImpl.handleCompilationError(IncrementalCompilerImpl.scala:332) sbt.internal.inc.IncrementalCompilerImpl.compileIncrementally(IncrementalCompilerImpl.scala:425) sbt.internal.inc.IncrementalCompilerImpl.compile(IncrementalCompilerImpl.scala:137) sbt.Defaults$.compileIncrementalTaskImpl(Defaults.scala:2363) sbt.Defaults$.$anonfun$compileIncrementalTask$2(Defaults.scala:2313) sbt.internal.server.BspCompileTask$.$anonfun$compute$1(BspCompileTask.scala:30) sbt.internal.io.Retry$.apply(Retry.scala:46) sbt.internal.io.Retry$.apply(Retry.scala:28) sbt.internal.io.Retry$.apply(Retry.scala:23) sbt.internal.server.BspCompileTask$.compute(BspCompileTask.scala:30) sbt.Defaults$.$anonfun$compileIncrementalTask$1(Defaults.scala:2311) scala.Function1.$anonfun$compose$1(Function1.scala:49) sbt.internal.util.$tilde$greater.$anonfun$$u2219$1(TypeFunctions.scala:62) sbt.std.Transform$$anon$4.work(Transform.scala:68) sbt.Execute.$anonfun$submit$2(Execute.scala:282) sbt.internal.util.ErrorHandling$.wideConvert(ErrorHandling.scala:23) sbt.Execute.work(Execute.scala:291) sbt.Execute.$anonfun$submit$1(Execute.scala:282) sbt.ConcurrentRestrictions$$anon$4.$anonfun$submitValid$1(ConcurrentRestrictions.scala:265) sbt.CompletionService$$anon$2.call(CompletionService.scala:64) java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264) java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:539) java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264) java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136) java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635) java.base/java.lang.Thread.run(Thread.java:833) (postgres / Test / compileIncremental) java.lang.AssertionError: assertion failed: trait AutoRollback has non-class parent: val

This is a project using ScalikeJDBC 4.0.0 and the assertion is thrown only when compiling tests (i.e. "sbt test"). I can compile the project successfully (i.e. "sbt clean compile") every time - the assertion has something to do with my test classes it seems. The referenced "AutoRollback" trait is from ScalikeJDBC, not from my code.

Nexus6 avatar Mar 07 '23 05:03 Nexus6

It's probably not a race condition but a an error that depends on the order of files to be compiled. And the problem seems to be (as almost always) that there is a cyclic reference that the compiler cannot resolve.

odersky avatar Mar 07 '23 08:03 odersky

I think it would be important to minimize it but I don't have the time. Can someone help me here?

The problem of @pshirshov looks like it can easily be avoided since it happens during import suggestions and we can simply turn off the assert then.

The problem of @Nexus6 is more serious and harder to fix. Essentially we end up with an illegal state in a core operation -- computing the base types of a type. I could simply turn off the assert and return no base type, but I really would like to find out what goes wrong here because this could be a deeper problem. Turning off the assert would simply mask the underlying problem which will make it much less likely to be fixed.

odersky avatar Mar 07 '23 13:03 odersky

A minimization should be a small number of self contained files that demonstrates the problem. Typically it goes like this:

  1. Compile all files together
  2. Compile only a specific subset of these files and observe the problem.

odersky avatar Mar 07 '23 13:03 odersky

Ok, I'll try.

pshirshov avatar Mar 07 '23 13:03 pshirshov

@pshirshov Thanks! But I actually think it would be easier to start with the problem experienced by @Nexus6. The problem you are seeing is when the compiler tries to find suggestions for imports. That process depends not just on the files you compile and their dependencies but the whole classpath. That makes it hard to reproduce by definition. As far as I can see the problem experienced by @Nexus6 is a full compiler crash for normal compilation. As a first step it would be good to find out whether it is still present in 3.3.0.

odersky avatar Mar 07 '23 13:03 odersky

@odersky To create a reproducible test case, I used vscode+metals to create a minimal sbt project from the Scala3 template. To this I added the ScalikeJDBC, specs2, and munit dependencies from the project where I originally observed the crash. In addition, I added a stripped-down version of one of the test classes that was originally generated for me, from an existing db schema, by ScalikeJDBC.

Github is not allowing me to attach the project archive (.tar.gz - 1.2K) here but you can download it here or let me know of some other way I can get it to you if you're interested.

Just download, unpack, switch to the new project directory, run "sbt test" and the crash should happen every time. I tested this on my x86_64 machine and on an ARM64 machine - same crash. Interestingly, the test class shouldn't compile at all as I left the source file for the "Header" model class out of the project. But the crash occurs before the compiler even gets to the point of complaining about the missing class.

Nexus6 avatar Mar 08 '23 04:03 Nexus6

We spotted another strange trace in come code using izumi-reflect. We'll try to isolate it but as with the previous trace it might be tricky.

java.lang.AssertionError: assertion failed: class Array
        at scala.runtime.Scala3RunTime$.assertFailed(Scala3RunTime.scala:8)
        at dotty.tools.backend.jvm.BCodeHelpers.primitiveOrClassToBType$1(BCodeHelpers.scala:713)
        at dotty.tools.backend.jvm.BCodeHelpers.dotty$tools$backend$jvm$BCodeHelpers$$typeToTypeKind(BCodeHelpers.scala:733)
        at dotty.tools.backend.jvm.BCodeHelpers$BCInnerClassGen.toTypeKind(BCodeHelpers.scala:201)
        at dotty.tools.backend.jvm.BCodeHelpers$BCInnerClassGen.toTypeKind$(BCodeHelpers.scala:129)
        at dotty.tools.backend.jvm.BCodeSkelBuilder$PlainSkelBuilder.toTypeKind(BCodeSkelBuilder.scala:74)
        at dotty.tools.backend.jvm.BCodeBodyBuilder$PlainBodyBuilder.genConstant(BCodeBodyBuilder.scala:578)
        at dotty.tools.backend.jvm.BCodeBodyBuilder$PlainBodyBuilder.genLoadTo(BCodeBodyBuilder.scala:447)
        at dotty.tools.backend.jvm.BCodeBodyBuilder$PlainBodyBuilder.genLoad(BCodeBodyBuilder.scala:303)
        at dotty.tools.backend.jvm.BCodeBodyBuilder$PlainBodyBuilder.loop$1(BCodeBodyBuilder.scala:1202)
        at dotty.tools.backend.jvm.BCodeBodyBuilder$PlainBodyBuilder.genLoadArguments(BCodeBodyBuilder.scala:1209)
        at dotty.tools.backend.jvm.BCodeBodyBuilder$PlainBodyBuilder.genApply(BCodeBodyBuilder.scala:832)
        at dotty.tools.backend.jvm.BCodeBodyBuilder$PlainBodyBuilder.genLoadTo(BCodeBodyBuilder.scala:382)
        at dotty.tools.backend.jvm.BCodeBodyBuilder$PlainBodyBuilder.genLoadTo(BCodeBodyBuilder.scala:462)
        at dotty.tools.backend.jvm.BCodeBodyBuilder$PlainBodyBuilder.genLoad(BCodeBodyBuilder.scala:303)
        at dotty.tools.backend.jvm.BCodeBodyBuilder$PlainBodyBuilder.loop$1(BCodeBodyBuilder.scala:1202)
        at dotty.tools.backend.jvm.BCodeBodyBuilder$PlainBodyBuilder.genLoadArguments(BCodeBodyBuilder.scala:1209)
        at dotty.tools.backend.jvm.BCodeBodyBuilder$PlainBodyBuilder.genApply(BCodeBodyBuilder.scala:832)
        at dotty.tools.backend.jvm.BCodeBodyBuilder$PlainBodyBuilder.genLoadTo(BCodeBodyBuilder.scala:382)
        at dotty.tools.backend.jvm.BCodeBodyBuilder$PlainBodyBuilder.genLoad(BCodeBodyBuilder.scala:303)
        at dotty.tools.backend.jvm.BCodeBodyBuilder$PlainBodyBuilder.genStat(BCodeBodyBuilder.scala:117)
        at dotty.tools.backend.jvm.BCodeBodyBuilder$PlainBodyBuilder.genBlockTo$$anonfun$1(BCodeBodyBuilder.scala:1087)
        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.backend.jvm.BCodeBodyBuilder$PlainBodyBuilder.genBlockTo(BCodeBodyBuilder.scala:1087)
        at dotty.tools.backend.jvm.BCodeBodyBuilder$PlainBodyBuilder.genLoadTo(BCodeBodyBuilder.scala:454)
        at dotty.tools.backend.jvm.BCodeSkelBuilder$PlainSkelBuilder.emitNormalMethodBody$1(BCodeSkelBuilder.scala:827)
        at dotty.tools.backend.jvm.BCodeSkelBuilder$PlainSkelBuilder.genDefDef(BCodeSkelBuilder.scala:850)
        at dotty.tools.backend.jvm.BCodeSkelBuilder$PlainSkelBuilder.gen(BCodeSkelBuilder.scala:632)
        at dotty.tools.backend.jvm.BCodeSkelBuilder$PlainSkelBuilder.gen$$anonfun$1(BCodeSkelBuilder.scala:638)
        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.backend.jvm.BCodeSkelBuilder$PlainSkelBuilder.gen(BCodeSkelBuilder.scala:638)
        at dotty.tools.backend.jvm.BCodeSkelBuilder$PlainSkelBuilder.genPlainClass(BCodeSkelBuilder.scala:233)
        at dotty.tools.backend.jvm.CodeGen.genClass(CodeGen.scala:138)
        at dotty.tools.backend.jvm.CodeGen.genClassDef$1(CodeGen.scala:55)
        at dotty.tools.backend.jvm.CodeGen.genClassDefs$1(CodeGen.scala:101)
        at dotty.tools.backend.jvm.CodeGen.genClassDefs$1$$anonfun$1(CodeGen.scala:99)
        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.backend.jvm.CodeGen.genClassDefs$1(CodeGen.scala:99)
        at dotty.tools.backend.jvm.CodeGen.genUnit(CodeGen.scala:104)
        at dotty.tools.backend.jvm.GenBCode.run(GenBCode.scala:76)
        at dotty.tools.dotc.core.Phases$Phase.runOn$$anonfun$1(Phases.scala:327)
        at scala.collection.immutable.List.map(List.scala:250)
        at dotty.tools.dotc.core.Phases$Phase.runOn(Phases.scala:331)
        at dotty.tools.backend.jvm.GenBCode.runOn(GenBCode.scala:87)
        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.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:193)
        at scala.runtime.java8.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.java:23)
        at sbt.internal.inc.MixedAnalyzingCompiler.timed(MixedAnalyzingCompiler.scala:248)
        at sbt.internal.inc.MixedAnalyzingCompiler.$anonfun$compile$4(MixedAnalyzingCompiler.scala:183)
        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:211)
        at sbt.internal.inc.IncrementalCompilerImpl.$anonfun$compileInternal$1(IncrementalCompilerImpl.scala:534)
        at sbt.internal.inc.IncrementalCompilerImpl.$anonfun$compileInternal$1$adapted(IncrementalCompilerImpl.scala:534)
        at sbt.internal.inc.Incremental$.$anonfun$apply$5(Incremental.scala:180)
        at sbt.internal.inc.Incremental$.$anonfun$apply$5$adapted(Incremental.scala:178)
        at sbt.internal.inc.Incremental$$anon$2.run(Incremental.scala:464)
        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:419)
        at sbt.internal.inc.Incremental$.withClassfileManager(Incremental.scala:506)
        at sbt.internal.inc.Incremental$.incrementalCompile(Incremental.scala:406)
        at sbt.internal.inc.Incremental$.apply(Incremental.scala:172)
        at sbt.internal.inc.IncrementalCompilerImpl.compileInternal(IncrementalCompilerImpl.scala:534)
        at sbt.internal.inc.IncrementalCompilerImpl.$anonfun$compileIncrementally$1(IncrementalCompilerImpl.scala:488)
        at sbt.internal.inc.IncrementalCompilerImpl.handleCompilationError(IncrementalCompilerImpl.scala:332)
        at sbt.internal.inc.IncrementalCompilerImpl.compileIncrementally(IncrementalCompilerImpl.scala:425)
        at sbt.internal.inc.IncrementalCompilerImpl.compile(IncrementalCompilerImpl.scala:137)
        at sbt.Defaults$.compileIncrementalTaskImpl(Defaults.scala:2369)
        at sbt.Defaults$.$anonfun$compileIncrementalTask$2(Defaults.scala:2319)
        at sbt.internal.server.BspCompileTask$.$anonfun$compute$1(BspCompileTask.scala:31)
        at sbt.internal.io.Retry$.apply(Retry.scala:47)
        at sbt.internal.io.Retry$.apply(Retry.scala:29)
        at sbt.internal.io.Retry$.apply(Retry.scala:24)
        at sbt.internal.server.BspCompileTask$.compute(BspCompileTask.scala:31)
        at sbt.Defaults$.$anonfun$compileIncrementalTask$1(Defaults.scala:2317)
        at scala.Function1.$anonfun$compose$1(Function1.scala:49)
        at sbt.internal.util.$tilde$greater.$anonfun$$u2219$1(TypeFunctions.scala:63)
        at sbt.std.Transform$$anon$4.work(Transform.scala:69)
        at sbt.Execute.$anonfun$submit$2(Execute.scala:283)
        at sbt.internal.util.ErrorHandling$.wideConvert(ErrorHandling.scala:24)
        at sbt.Execute.work(Execute.scala:292)
        at sbt.Execute.$anonfun$submit$1(Execute.scala:283)
        at sbt.ConcurrentRestrictions$$anon$4.$anonfun$submitValid$1(ConcurrentRestrictions.scala:265)
        at sbt.CompletionService$$anon$2.call(CompletionService.scala:65)
        at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
        at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
        at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
        at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
        at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
        at java.base/java.lang.Thread.run(Thread.java:829)

pshirshov avatar Aug 22 '23 13:08 pshirshov

Actually, this time the repro is stable and laughably simple: https://scastie.scala-lang.org/lUnGyx2XSXu81ZLWKCvw8A

@odersky

pshirshov avatar Aug 22 '23 13:08 pshirshov

I've been getting errors like cannot be unpickled because no class file was found for denot: val <none>, but at the scaladoc stage of my build rather than compile. I hit this in mill, but it's easy to reproduce in scala-cli.

Start with a file hello.txt.scala:

def hello(name : String) : String = s"Hi $name"

Place it alone in a directory and cd in. Then

% scala-cli doc .
Compiling project (Scala 3.3.0, JVM)
Compiled project (Scala 3.3.0, JVM)
class hello.txt$package cannot be unpickled because no class file was found for denot: val <none>
1 error found
[error]  Scaladoc generation failed (exit code: 1)

If you build the jar file and use the scaladoc shell command on that, it will seem to work, but nothing will have been documented, there will be no index.html in the output dir.

That's probably just a default package thing! If you put a package declaration in hello.txt.scala, build a jar file and run scaladoc, you'll see the sole function documented in <pacakge-name>.html.

So, from a jar file it works. But if you compile, search .scala-build to find the tasty .tasty file, and try to scaladoc from that, you get...

% find .scala-build -name '*.tasty' -print 
.scala-build/unpickle-bug_103be31561/classes/main/hello$u002Etxt$package.tasty
.scala-build/.bloop/unpickle-bug_103be31561/bloop-internal-classes/main-Q--LQ5riT_266sHJJdSS2w==/hello$u002Etxt$package.tasty
% cd .scala-build/unpickle-bug_103be31561/classes/main/
% mkdir scala-doc
% scaladoc -d scala-doc 'hello$u002Etxt$package.tasty'
class hello.txt$package cannot be unpickled because no class file was found for denot: val <none>
1 error found

Ah ha!

Everything works (including scaladoc from the tasty file) if you just rename the file hello.scala and build from that.


TL; DR: Avoid source file names with . characters before the .scala

The error message could be a bit clearer, though.

swaldman avatar Sep 05 '23 22:09 swaldman

@pshirshov Thanks! But I actually think it would be easier to start with the problem experienced by @Nexus6. The problem you are seeing is when the compiler tries to find suggestions for imports. That process depends not just on the files you compile and their dependencies but the whole classpath. That makes it hard to reproduce by definition. As far as I can see the problem experienced by @Nexus6 is a full compiler crash for normal compilation. As a first step it would be good to find out whether it is still present in 3.3.0.

@odersky I'm still seeing this crash on 3.3.1 (Linux, x86_64 and ARM64, openjdk 19.0.2 & 21-ea) with sbt 1.9.5.

[info] tree: EmptyTree [info] tree position: : [info] tree type: [info] symbol: val [info] call site: package in module class [error] java.lang.AssertionError: assertion failed: trait AutoRollback has non-class parent: TypeRef(TermRef(ThisType(TypeRef(NoPrefix,moduleclass specs2)),object mutable),After) [error] scala.runtime.Scala3RunTime$.assertFailed(Scala3RunTime.scala:8) [error] dotty.tools.dotc.core.SymDenotations$ClassDenotation.traverse$1(SymDenotations.scala:1968) [error] dotty.tools.dotc.core.SymDenotations$ClassDenotation.computeBaseData(SymDenotations.scala:1973) [error] dotty.tools.dotc.core.SymDenotations$BaseDataImpl.apply(SymDenotations.scala:2960) [error] dotty.tools.dotc.core.SymDenotations$ClassDenotation.baseData(SymDenotations.scala:1939) [error] dotty.tools.dotc.core.SymDenotations$ClassDenotation.baseClassSet(SymDenotations.scala:1955) [error] dotty.tools.dotc.core.SymDenotations$ClassDenotation.derivesFrom(SymDenotations.scala:1981) [error] dotty.tools.dotc.core.Types$Type.loop$1(Types.scala:273) [error] dotty.tools.dotc.core.Types$Type.derivesFrom(Types.scala:297) [error] dotty.tools.dotc.typer.Namer$ClassCompleter.checkedParentType$1(Namer.scala:1524) [error] dotty.tools.dotc.typer.Namer$ClassCompleter.$anonfun$29(Namer.scala:1592) [error] scala.collection.immutable.List.map(List.scala:246) ... (snip) It's 100% reproducible on test builds ("sbt test") but not when simply building+packaging the project.

Nexus6 avatar Sep 15 '23 04:09 Nexus6

Actually, this time the repro is stable and laughably simple: https://scastie.scala-lang.org/lUnGyx2XSXu81ZLWKCvw8A

@pshirshov's minimization is still valid:

//> using dep dev.zio::izumi-reflect:2.3.8
import izumi.reflect.Tag
@main def main = println(Tag[Array[Byte]])

We still need a minimization without the izumi-reflect dependency, however.

Gedochao avatar Apr 03 '24 13:04 Gedochao

Well, as @odersky said once, our macros are one of the toughest compiler stresstests. These things are prohibitively hard to untangle.

pshirshov avatar Apr 03 '24 13:04 pshirshov

The Tag[Array[Byte]] is a totally different issue. That one is most likely the macro's fault: it generates a classOf[Array] instead of classOf[Array[Byte]]. classOf[Array] makes no sense since it is ill-kinded.

sjrd avatar Apr 29 '24 08:04 sjrd

@Nexus6 Your link is not active anymore. Is there any chance you could repost your reproduction to somewhere more stable?

sjrd avatar Apr 29 '24 08:04 sjrd

I could reliably reproduce https://github.com/scala/scala3/issues/16036#issuecomment-1426022497 on 3.2.2. On the latest main of scala3, however, several runs have not reported any AssertionError in the logs. It seems to me that this was fixed at some point.


Note that to be able to compile all the tests on the nightly, I had to apply the following change to the test sources. The previous code was rule out as unsound.

diff --git a/distage/distage-testkit-scalatest/src/main/scala-3/izumi/distage/testkit/scalatest/SpecWiring.scala b/distage/distage-testkit-scalatest/src/main/scala-3/izumi/distage/testkit/scalatest/SpecWiring.scala
index 620e618d4..4aebd4d30 100644
--- a/distage/distage-testkit-scalatest/src/main/scala-3/izumi/distage/testkit/scalatest/SpecWiring.scala
+++ b/distage/distage-testkit-scalatest/src/main/scala-3/izumi/distage/testkit/scalatest/SpecWiring.scala
@@ -3,14 +3,14 @@ package izumi.distage.testkit.scalatest
 import izumi.distage.framework.{CheckableApp, PlanCheckConfig, PlanCheckMaterializer}
 import izumi.distage.modules.DefaultModule
 
-abstract class SpecWiring[AppMain <: CheckableApp, Cfg <: PlanCheckConfig.Any](
+abstract class SpecWiring[F[_], AppMain <: CheckableApp { type AppEffectType[X] = F[X] }, Cfg <: PlanCheckConfig.Any](
   val app: AppMain,
   val cfg: Cfg = PlanCheckConfig.empty,
   val checkAgainAtRuntime: Boolean = true,
 )(implicit
   val planCheck: PlanCheckMaterializer[AppMain, Cfg],
-  defaultModule: DefaultModule[app.AppEffectType],
-) extends Spec1[app.AppEffectType]()(app.tagK, defaultModule)
+  defaultModule: DefaultModule[F],
+) extends Spec1[F]()(app.tagK, defaultModule)
   with WiringAssertions {
 
   s"Wiring check for `${planCheck.app.getClass.getCanonicalName}`" should {

However, that is not related to the previous crash. Even with that fix, 3.2.2 still reliably logged AssertionErrors.

sjrd avatar Apr 29 '24 11:04 sjrd

@Nexus6 Your link is not active anymore. Is there any chance you could repost your reproduction to somewhere more stable?

Sorry about that. I pushed to a new repo, you can grab the code here: https://github.com/Nexus6/dotty16036.git . Just run "sbt test" on it.

The crash is still happening on 3.4.1, when compiling the HeaderSpec.scala class. I'm seeing

[error] java.lang.AssertionError: assertion failed: trait AutoRollback has non-class parent: TypeRef(TermRef(ThisType(TypeRef(NoPrefix,moduleclass specs2)),object mutable),After) [error] at scala.runtime.Scala3RunTime$.assertFailed(Scala3RunTime.scala:8) [error] at dotty.tools.dotc.core.SymDenotations$ClassDenotation.traverse$1(SymDenotations.scala:1999) [error] at dotty.tools.dotc.core.SymDenotations$ClassDenotation.computeBaseData(SymDenotations.scala:2004) [error] at dotty.tools.dotc.core.SymDenotations$BaseDataImpl.apply(SymDenotations.scala:2996) [error] at dotty.tools.dotc.core.SymDenotations$ClassDenotation.baseData(SymDenotations.scala:1970) [error] at dotty.tools.dotc.core.SymDenotations$ClassDenotation.baseClassSet(SymDenotations.scala:1986) [error] at dotty.tools.dotc.core.SymDenotations$ClassDenotation.derivesFrom(SymDenotations.scala:2012) [error] at dotty.tools.dotc.core.Types$Type.loop$1(Types.scala:279) [error] at dotty.tools.dotc.core.Types$Type.derivesFrom(Types.scala:303) [error] at dotty.tools.dotc.typer.Namer$ClassCompleter.checkedParentType$1(Namer.scala:1556) [error] at dotty.tools.dotc.typer.Namer$ClassCompleter.$anonfun$29(Namer.scala:1624) [error] at scala.collection.immutable.List.map(List.scala:246)

Nexus6 avatar Apr 29 '24 17:04 Nexus6

Thanks.

I minimized down to using only the following dependency:

"org.scalikejdbc" %% "scalikejdbc-test" % "4.0.0"

with the following Scala code:

import scalikejdbc.specs2.mutable.AutoRollback

class Foo extends AutoRollback

It still crashes on the main branch, with the same error message.

sjrd avatar May 01 '24 12:05 sjrd

OK looks to me like it makes sense, actually. There is no org.specs2.mutable.After type at all in version 5.2.0, which is referenced from the build.

The scalikejdbc-test dependency does not seem to declare an actual dependency to specs2, but contains references to its org.specs2.mutable.After. I guess it was compiled a previous version of Specs2 that did define that class. Usually this would result in a resolution warning/error in sbt, saying that 2 incompatible versions of a library are requested. But here, since there is no explicit dependency, sbt cannot possibly tell.

So it doesn't seem like a bug in the compiler to me. It seems like a corrupted/mis-published library.

sjrd avatar May 01 '24 12:05 sjrd

Using the following dependencies fixes the issue:

    libraryDependencies ++= Seq(
      "org.scalikejdbc" %% "scalikejdbc-test" % "4.0.0",
      "org.specs2" %% "specs2-core" % "4.20.5",
    )

So yes, I don't think this is a compiler issue.

sjrd avatar May 01 '24 12:05 sjrd

Nice sleuthing. Can confirm that your test-case tweak of using specs2-core 4.20.5 makes the assertion error go away - no more compiler crash.

My question is then: is a fatal AssertionError with a cryptic error message the best way to handle this condition in the released builds of the compiler? Could it, and should it, be handled in a more user-friendly way? From your description of the problem it sounds like this might be a fairly common occurrence, so maybe 1) issue an informative error message, then 2) perform an orderly compiler exit?

Nexus6 avatar May 01 '24 19:05 Nexus6

The scalikejdbc-test dependency does not seem to declare an actual dependency to specs2, but contains references to its org.specs2.mutable.After.

This is the core issue. That library must have actively configured something to go against the current. In doing so, they are bypassing the user-friendly checks that are normally in place. There's not much we can do about that, I'm afraid.

sjrd avatar May 01 '24 21:05 sjrd

I'm going to optimistically close this issue, since I believe I have exhausted all the reproductions that have been mentioned in this thread. Feel free to reopen if it still happens on nightly, or on the soon-to-be-released 3.5.0-RC1.

sjrd avatar May 06 '24 07:05 sjrd