-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Cyclic reference involving variable with match type #13495
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
The code snippet as is doesn't emit any error when pasted in a file, but it does emit the cyclic reference error if I wrap it in an The stack trace we get for the cyclic error is: java.lang.Exception: Stack trace
at java.lang.Thread.dumpStack(Thread.java:1336)
at dotty.tools.dotc.core.CyclicReference.<init>(TypeErrors.scala:113)
at dotty.tools.dotc.core.CyclicReference$.apply(TypeErrors.scala:157)
at dotty.tools.dotc.core.SymDenotations$SymDenotation.completeFrom(SymDenotations.scala:149)
at dotty.tools.dotc.core.Denotations$Denotation.completeInfo$1(Denotations.scala:188)
at dotty.tools.dotc.core.Denotations$Denotation.info(Denotations.scala:190)
at dotty.tools.dotc.core.SymDenotations$SymDenotation.ensureCompleted(SymDenotations.scala:369)
at dotty.tools.dotc.core.SymDenotations$SymDenotation.completeChildrenIn$3$$anonfun$2(SymDenotations.scala:1615)
at scala.runtime.function.JProcedure1.apply(JProcedure1.java:15)
at scala.runtime.function.JProcedure1.apply(JProcedure1.java:10)
at scala.collection.IterableOnceOps.foreach(IterableOnce.scala:563)
at scala.collection.IterableOnceOps.foreach$(IterableOnce.scala:561)
at scala.collection.AbstractIterable.foreach(Iterable.scala:919)
at scala.collection.IterableOps$WithFilter.foreach(Iterable.scala:889)
at dotty.tools.dotc.core.SymDenotations$SymDenotation.completeChildrenIn$1(SymDenotations.scala:1615)
at dotty.tools.dotc.core.SymDenotations$SymDenotation.children(SymDenotations.scala:1623)
at dotty.tools.dotc.transform.SymUtils$.hasAnonymousChild(SymUtils.scala:247)
at dotty.tools.dotc.core.TypeComparer.isClosedSum$1(TypeComparer.scala:2531)
at dotty.tools.dotc.core.TypeComparer.provablyDisjoint$$anonfun$2(TypeComparer.scala:2573)
at dotty.tools.dotc.reporting.TraceSyntax.doTrace(trace.scala:65)
at dotty.tools.dotc.reporting.TraceSyntax.dotty$tools$dotc$reporting$TraceSyntax$$inline$doTrace(trace.scala:61)
at dotty.tools.dotc.reporting.TraceSyntax.dotty$tools$dotc$reporting$TraceSyntax$$inline$doTrace$(trace.scala:23)
at dotty.tools.dotc.reporting.trace$.dotty$tools$dotc$reporting$TraceSyntax$$inline$doTrace(trace.scala:10)
at dotty.tools.dotc.core.TypeComparer.provablyDisjoint(TypeComparer.scala:2516)
at dotty.tools.dotc.core.TypeComparer.provablyDisjoint$$anonfun$2(TypeComparer.scala:2647)
at dotty.tools.dotc.reporting.TraceSyntax.doTrace(trace.scala:65)
at dotty.tools.dotc.reporting.TraceSyntax.dotty$tools$dotc$reporting$TraceSyntax$$inline$doTrace(trace.scala:61)
at dotty.tools.dotc.reporting.TraceSyntax.dotty$tools$dotc$reporting$TraceSyntax$$inline$doTrace$(trace.scala:23)
at dotty.tools.dotc.reporting.trace$.dotty$tools$dotc$reporting$TraceSyntax$$inline$doTrace(trace.scala:10)
at dotty.tools.dotc.core.TypeComparer.provablyDisjoint(TypeComparer.scala:2516)
at dotty.tools.dotc.core.TrackingTypeComparer.matchCase$2$$anonfun$2(TypeComparer.scala:2913)
at dotty.tools.dotc.reporting.TraceSyntax.doTrace(trace.scala:65)
at dotty.tools.dotc.reporting.TraceSyntax.dotty$tools$dotc$reporting$TraceSyntax$$inline$doTrace(trace.scala:61)
at dotty.tools.dotc.reporting.TraceSyntax.dotty$tools$dotc$reporting$TraceSyntax$$inline$doTrace$(trace.scala:23)
at dotty.tools.dotc.reporting.trace$.dotty$tools$dotc$reporting$TraceSyntax$$inline$doTrace(trace.scala:10)
at dotty.tools.dotc.core.TrackingTypeComparer.matchCase$3(TypeComparer.scala:2891)
at dotty.tools.dotc.core.TrackingTypeComparer.recur$1(TypeComparer.scala:2923)
at dotty.tools.dotc.core.TrackingTypeComparer.op$proxy68$1(TypeComparer.scala:2954)
at dotty.tools.dotc.core.TrackingTypeComparer.matchCases(TypeComparer.scala:2955)
at dotty.tools.dotc.core.Types$MatchType.liftedTree1$2(Types.scala:4709)
at dotty.tools.dotc.core.Types$MatchType.matchCases$1(Types.scala:4714)
at dotty.tools.dotc.core.Types$MatchType.reduced$$anonfun$4$$anonfun$1(Types.scala:4718)
at dotty.tools.dotc.core.TypeComparer.inSubComparer(TypeComparer.scala:2663)
at dotty.tools.dotc.core.TypeComparer.tracked(TypeComparer.scala:2673)
at dotty.tools.dotc.core.TypeComparer$.tracked(TypeComparer.scala:2826)
at dotty.tools.dotc.core.Types$MatchType.reduced$$anonfun$3(Types.scala:4718)
at dotty.tools.dotc.reporting.TraceSyntax.doTrace(trace.scala:65)
at dotty.tools.dotc.reporting.TraceSyntax.dotty$tools$dotc$reporting$TraceSyntax$$inline$doTrace(trace.scala:61)
at dotty.tools.dotc.reporting.TraceSyntax.dotty$tools$dotc$reporting$TraceSyntax$$inline$doTrace$(trace.scala:23)
at dotty.tools.dotc.reporting.trace$.dotty$tools$dotc$reporting$TraceSyntax$$inline$doTrace(trace.scala:10)
at dotty.tools.dotc.core.Types$MatchType.reduced(Types.scala:4719)
at dotty.tools.dotc.core.Types$MatchType.tryNormalize(Types.scala:4667)
at dotty.tools.dotc.core.Types$AppliedType.tryMatchAlias$4$$anonfun$3$$anonfun$1(Types.scala:4143)
at dotty.tools.dotc.core.MatchTypeTrace$.recurseWith(MatchTypeTrace.scala:83)
at dotty.tools.dotc.core.Types$AppliedType.tryMatchAlias$5$$anonfun$4(Types.scala:4144)
at dotty.tools.dotc.reporting.TraceSyntax.doTrace(trace.scala:65)
at dotty.tools.dotc.reporting.TraceSyntax.dotty$tools$dotc$reporting$TraceSyntax$$inline$doTrace(trace.scala:61)
at dotty.tools.dotc.reporting.TraceSyntax.dotty$tools$dotc$reporting$TraceSyntax$$inline$doTrace$(trace.scala:23)
at dotty.tools.dotc.reporting.trace$.dotty$tools$dotc$reporting$TraceSyntax$$inline$doTrace(trace.scala:10)
at dotty.tools.dotc.core.Types$AppliedType.tryMatchAlias$1(Types.scala:4145)
at dotty.tools.dotc.core.Types$AppliedType.tryNormalize(Types.scala:4149)
at dotty.tools.dotc.core.TypeOps$.simplify(TypeOps.scala:145)
at dotty.tools.dotc.core.TypeOps$.mapArgs$1(TypeOps.scala:146)
at dotty.tools.dotc.core.TypeOps$.mapArgs$1(TypeOps.scala:146)
at dotty.tools.dotc.core.TypeOps$.simplify(TypeOps.scala:146)
at dotty.tools.dotc.core.Types$Type.simplified(Types.scala:1863)
at dotty.tools.dotc.core.TrackingTypeComparer.matchCase$2$$anonfun$2(TypeComparer.scala:2908)
at dotty.tools.dotc.reporting.TraceSyntax.doTrace(trace.scala:65)
at dotty.tools.dotc.reporting.TraceSyntax.dotty$tools$dotc$reporting$TraceSyntax$$inline$doTrace(trace.scala:61)
at dotty.tools.dotc.reporting.TraceSyntax.dotty$tools$dotc$reporting$TraceSyntax$$inline$doTrace$(trace.scala:23)
at dotty.tools.dotc.reporting.trace$.dotty$tools$dotc$reporting$TraceSyntax$$inline$doTrace(trace.scala:10)
at dotty.tools.dotc.core.TrackingTypeComparer.matchCase$3(TypeComparer.scala:2891)
at dotty.tools.dotc.core.TrackingTypeComparer.recur$1(TypeComparer.scala:2923)
at dotty.tools.dotc.core.TrackingTypeComparer.op$proxy68$1(TypeComparer.scala:2954)
at dotty.tools.dotc.core.TrackingTypeComparer.matchCases(TypeComparer.scala:2955)
at dotty.tools.dotc.core.Types$MatchType.liftedTree1$2(Types.scala:4709)
at dotty.tools.dotc.core.Types$MatchType.matchCases$1(Types.scala:4714)
at dotty.tools.dotc.core.Types$MatchType.reduced$$anonfun$4$$anonfun$1(Types.scala:4718)
at dotty.tools.dotc.core.TypeComparer.inSubComparer(TypeComparer.scala:2663)
at dotty.tools.dotc.core.TypeComparer.tracked(TypeComparer.scala:2673)
at dotty.tools.dotc.core.TypeComparer$.tracked(TypeComparer.scala:2826)
at dotty.tools.dotc.core.Types$MatchType.reduced$$anonfun$3(Types.scala:4718)
at dotty.tools.dotc.reporting.TraceSyntax.doTrace(trace.scala:65)
at dotty.tools.dotc.reporting.TraceSyntax.dotty$tools$dotc$reporting$TraceSyntax$$inline$doTrace(trace.scala:61)
at dotty.tools.dotc.reporting.TraceSyntax.dotty$tools$dotc$reporting$TraceSyntax$$inline$doTrace$(trace.scala:23)
at dotty.tools.dotc.reporting.trace$.dotty$tools$dotc$reporting$TraceSyntax$$inline$doTrace(trace.scala:10)
at dotty.tools.dotc.core.Types$MatchType.reduced(Types.scala:4719)
at dotty.tools.dotc.core.Types$MatchType.tryNormalize(Types.scala:4667)
at dotty.tools.dotc.core.Types$AppliedType.tryMatchAlias$4$$anonfun$3$$anonfun$1(Types.scala:4143)
at dotty.tools.dotc.core.MatchTypeTrace$.recurseWith(MatchTypeTrace.scala:83)
at dotty.tools.dotc.core.Types$AppliedType.tryMatchAlias$5$$anonfun$4(Types.scala:4144)
at dotty.tools.dotc.reporting.TraceSyntax.doTrace(trace.scala:65)
at dotty.tools.dotc.reporting.TraceSyntax.dotty$tools$dotc$reporting$TraceSyntax$$inline$doTrace(trace.scala:61)
at dotty.tools.dotc.reporting.TraceSyntax.dotty$tools$dotc$reporting$TraceSyntax$$inline$doTrace$(trace.scala:23)
at dotty.tools.dotc.reporting.trace$.dotty$tools$dotc$reporting$TraceSyntax$$inline$doTrace(trace.scala:10)
at dotty.tools.dotc.core.Types$AppliedType.tryMatchAlias$1(Types.scala:4145)
at dotty.tools.dotc.core.Types$AppliedType.tryNormalize(Types.scala:4149)
at dotty.tools.dotc.core.TypeOps$.simplify(TypeOps.scala:145)
at dotty.tools.dotc.core.TypeOps$.mapArgs$1(TypeOps.scala:146)
at dotty.tools.dotc.core.TypeOps$.mapArgs$1(TypeOps.scala:146)
at dotty.tools.dotc.core.TypeOps$.simplify(TypeOps.scala:146)
at dotty.tools.dotc.core.Types$Type.simplified(Types.scala:1863)
at dotty.tools.dotc.core.TrackingTypeComparer.matchCase$2$$anonfun$2(TypeComparer.scala:2908)
at dotty.tools.dotc.reporting.TraceSyntax.doTrace(trace.scala:65)
at dotty.tools.dotc.reporting.TraceSyntax.dotty$tools$dotc$reporting$TraceSyntax$$inline$doTrace(trace.scala:61)
at dotty.tools.dotc.reporting.TraceSyntax.dotty$tools$dotc$reporting$TraceSyntax$$inline$doTrace$(trace.scala:23)
at dotty.tools.dotc.reporting.trace$.dotty$tools$dotc$reporting$TraceSyntax$$inline$doTrace(trace.scala:10)
at dotty.tools.dotc.core.TrackingTypeComparer.matchCase$3(TypeComparer.scala:2891)
at dotty.tools.dotc.core.TrackingTypeComparer.recur$1(TypeComparer.scala:2923)
at dotty.tools.dotc.core.TrackingTypeComparer.op$proxy68$1(TypeComparer.scala:2954)
at dotty.tools.dotc.core.TrackingTypeComparer.matchCases(TypeComparer.scala:2955)
at dotty.tools.dotc.core.Types$MatchType.liftedTree1$2(Types.scala:4709)
at dotty.tools.dotc.core.Types$MatchType.matchCases$1(Types.scala:4714)
at dotty.tools.dotc.core.Types$MatchType.reduced$$anonfun$4$$anonfun$1(Types.scala:4718)
at dotty.tools.dotc.core.TypeComparer.inSubComparer(TypeComparer.scala:2663)
at dotty.tools.dotc.core.TypeComparer.tracked(TypeComparer.scala:2673)
at dotty.tools.dotc.core.TypeComparer$.tracked(TypeComparer.scala:2826)
at dotty.tools.dotc.core.Types$MatchType.reduced$$anonfun$3(Types.scala:4718)
at dotty.tools.dotc.reporting.TraceSyntax.doTrace(trace.scala:65)
at dotty.tools.dotc.reporting.TraceSyntax.dotty$tools$dotc$reporting$TraceSyntax$$inline$doTrace(trace.scala:61)
at dotty.tools.dotc.reporting.TraceSyntax.dotty$tools$dotc$reporting$TraceSyntax$$inline$doTrace$(trace.scala:23)
at dotty.tools.dotc.reporting.trace$.dotty$tools$dotc$reporting$TraceSyntax$$inline$doTrace(trace.scala:10)
at dotty.tools.dotc.core.Types$MatchType.reduced(Types.scala:4719)
at dotty.tools.dotc.core.Types$MatchType.tryNormalize(Types.scala:4667)
at dotty.tools.dotc.core.Types$AppliedType.tryMatchAlias$4$$anonfun$3$$anonfun$1(Types.scala:4143)
at dotty.tools.dotc.core.MatchTypeTrace$.recurseWith(MatchTypeTrace.scala:83)
at dotty.tools.dotc.core.Types$AppliedType.tryMatchAlias$5$$anonfun$4(Types.scala:4144)
at dotty.tools.dotc.reporting.TraceSyntax.doTrace(trace.scala:65)
at dotty.tools.dotc.reporting.TraceSyntax.dotty$tools$dotc$reporting$TraceSyntax$$inline$doTrace(trace.scala:61)
at dotty.tools.dotc.reporting.TraceSyntax.dotty$tools$dotc$reporting$TraceSyntax$$inline$doTrace$(trace.scala:23)
at dotty.tools.dotc.reporting.trace$.dotty$tools$dotc$reporting$TraceSyntax$$inline$doTrace(trace.scala:10)
at dotty.tools.dotc.core.Types$AppliedType.tryMatchAlias$1(Types.scala:4145)
at dotty.tools.dotc.core.Types$AppliedType.tryNormalize(Types.scala:4149)
at dotty.tools.dotc.core.TypeOps$.simplify(TypeOps.scala:145)
at dotty.tools.dotc.core.Types$Type.simplified(Types.scala:1863)
at dotty.tools.dotc.typer.Typer.simplify(Typer.scala:2835)
at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:2820)
at dotty.tools.dotc.typer.Typer.typed$$anonfun$3(Typer.scala:2883)
at dotty.tools.dotc.reporting.TraceSyntax.doTrace(trace.scala:65)
at dotty.tools.dotc.reporting.TraceSyntax.dotty$tools$dotc$reporting$TraceSyntax$$inline$doTrace(trace.scala:61)
at dotty.tools.dotc.reporting.TraceSyntax.dotty$tools$dotc$reporting$TraceSyntax$$inline$doTrace$(trace.scala:23)
at dotty.tools.dotc.reporting.trace$.dotty$tools$dotc$reporting$TraceSyntax$$inline$doTrace(trace.scala:10)
at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2884)
at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2887)
at dotty.tools.dotc.typer.Typer.typedType(Typer.scala:3005)
at dotty.tools.dotc.typer.Namer.typedAheadType$$anonfun$1(Namer.scala:1426)
at dotty.tools.dotc.typer.Namer.typedAhead(Namer.scala:1419)
at dotty.tools.dotc.typer.Namer.typedAheadType(Namer.scala:1426)
at dotty.tools.dotc.typer.Namer.valOrDefDefSig(Namer.scala:1508)
at dotty.tools.dotc.typer.Namer$Completer.typeSig(Namer.scala:751)
at dotty.tools.dotc.typer.Namer$Completer.completeInCreationContext(Namer.scala:887)
at dotty.tools.dotc.typer.Namer$Completer.complete(Namer.scala:779)
at dotty.tools.dotc.core.SymDenotations$SymDenotation.completeFrom(SymDenotations.scala:153)
at dotty.tools.dotc.core.Denotations$Denotation.completeInfo$1(Denotations.scala:188)
at dotty.tools.dotc.core.Denotations$Denotation.info(Denotations.scala:190)
at dotty.tools.dotc.core.SymDenotations$SymDenotation.ensureCompleted(SymDenotations.scala:369)
at dotty.tools.dotc.typer.Typer.retrieveSym(Typer.scala:2697)
at dotty.tools.dotc.typer.Typer.typedNamed$1(Typer.scala:2722)
at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:2817)
at dotty.tools.dotc.typer.Typer.typed$$anonfun$3(Typer.scala:2883)
at dotty.tools.dotc.reporting.TraceSyntax.doTrace(trace.scala:65)
at dotty.tools.dotc.reporting.TraceSyntax.dotty$tools$dotc$reporting$TraceSyntax$$inline$doTrace(trace.scala:61)
at dotty.tools.dotc.reporting.TraceSyntax.dotty$tools$dotc$reporting$TraceSyntax$$inline$doTrace$(trace.scala:23)
at dotty.tools.dotc.reporting.trace$.dotty$tools$dotc$reporting$TraceSyntax$$inline$doTrace(trace.scala:10)
at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2884)
at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2887)
at dotty.tools.dotc.typer.Typer.traverse$1(Typer.scala:2909)
at dotty.tools.dotc.typer.Typer.typedStats(Typer.scala:2959)
at dotty.tools.dotc.typer.Typer.typedClassDef(Typer.scala:2409)
at dotty.tools.dotc.typer.Typer.typedTypeOrClassDef$2(Typer.scala:2743)
at dotty.tools.dotc.typer.Typer.typedNamed$1(Typer.scala:2747)
at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:2817)
at dotty.tools.dotc.typer.Typer.typed$$anonfun$3(Typer.scala:2883)
at dotty.tools.dotc.reporting.TraceSyntax.doTrace(trace.scala:65)
at dotty.tools.dotc.reporting.TraceSyntax.dotty$tools$dotc$reporting$TraceSyntax$$inline$doTrace(trace.scala:61)
at dotty.tools.dotc.reporting.TraceSyntax.dotty$tools$dotc$reporting$TraceSyntax$$inline$doTrace$(trace.scala:23)
at dotty.tools.dotc.reporting.trace$.dotty$tools$dotc$reporting$TraceSyntax$$inline$doTrace(trace.scala:10)
at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2884)
at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2887)
at dotty.tools.dotc.typer.Typer.traverse$1(Typer.scala:2909)
at dotty.tools.dotc.typer.Typer.typedStats(Typer.scala:2959)
at dotty.tools.dotc.typer.Typer.typedPackageDef(Typer.scala:2532)
at dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:2788)
at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:2818)
at dotty.tools.dotc.typer.Typer.typed$$anonfun$3(Typer.scala:2883)
at dotty.tools.dotc.reporting.TraceSyntax.doTrace(trace.scala:65)
at dotty.tools.dotc.reporting.TraceSyntax.dotty$tools$dotc$reporting$TraceSyntax$$inline$doTrace(trace.scala:61)
at dotty.tools.dotc.reporting.TraceSyntax.dotty$tools$dotc$reporting$TraceSyntax$$inline$doTrace$(trace.scala:23)
at dotty.tools.dotc.reporting.trace$.dotty$tools$dotc$reporting$TraceSyntax$$inline$doTrace(trace.scala:10)
at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2884)
at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2887)
at dotty.tools.dotc.typer.Typer.typedExpr(Typer.scala:3003)
at dotty.tools.dotc.typer.TyperPhase.liftedTree1$1(TyperPhase.scala:56)
at dotty.tools.dotc.typer.TyperPhase.typeCheck$$anonfun$1(TyperPhase.scala:62)
at dotty.tools.dotc.core.Phases$Phase.monitor(Phases.scala:411)
at dotty.tools.dotc.typer.TyperPhase.typeCheck(TyperPhase.scala:63)
at dotty.tools.dotc.typer.TyperPhase.runOn$$anonfun$1(TyperPhase.scala:105)
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:105)
at dotty.tools.dotc.Run.runPhases$4$$anonfun$4(Run.scala:261)
at scala.runtime.function.JProcedure1.apply(JProcedure1.java:15)
at scala.runtime.function.JProcedure1.apply(JProcedure1.java:10)
at scala.collection.ArrayOps$.foreach$extension(ArrayOps.scala:1323)
at dotty.tools.dotc.Run.runPhases$5(Run.scala:272)
at dotty.tools.dotc.Run.compileUnits$$anonfun$1(Run.scala:280)
at scala.runtime.java8.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.scala:18)
at dotty.tools.dotc.util.Stats$.maybeMonitored(Stats.scala:68)
at dotty.tools.dotc.Run.compileUnits(Run.scala:289)
at dotty.tools.dotc.Run.compileSources(Run.scala:222)
at dotty.tools.dotc.Run.compile(Run.scala:206)
at dotty.tools.dotc.Driver.doCompile(Driver.scala:39)
at dotty.tools.dotc.Driver.process(Driver.scala:199)
at dotty.tools.dotc.Driver.process(Driver.scala:167)
at dotty.tools.dotc.Driver.process(Driver.scala:179)
at dotty.tools.dotc.Driver.main(Driver.scala:209)
at dotty.tools.dotc.Main.main(Main.scala)
-- [E046] Cyclic Error: try/i13495.scala:21:9 ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- So basically while completing diff --git compiler/src/dotty/tools/dotc/core/SymDenotations.scala compiler/src/dotty/tools/dotc/core/SymDenotations.scala
index fcfbba208eb..067faa09689 100644
--- compiler/src/dotty/tools/dotc/core/SymDenotations.scala
+++ compiler/src/dotty/tools/dotc/core/SymDenotations.scala
@@ -1611,7 +1611,7 @@ object SymDenotations {
case _ => false
if owner.isClass then
- for c <- owner.info.decls.toList if maybeChild(c) do
+ for c <- owner.info.decls.toList if !c.isCompleting && maybeChild(c) do
c.ensureCompleted()
end completeChildrenIn which seemingly fixed the issue but lead to a crash in PostTyper:
```scala
java.lang.AssertionError: assertion failed: no member this.h . ==, members = Scope{
def (): Test.Component
} while compiling try/i13495.scala
Exception in thread "main" java.lang.AssertionError: assertion failed: no member this.h . ==, members = Scope{
def (): Test.Component
}
at scala.runtime.Scala3RunTime$.assertFailed(Scala3RunTime.scala:8)
at dotty.tools.dotc.ast.Trees$Instance.applyOverloaded(Trees.scala:1738)
at dotty.tools.dotc.ast.tpd$TreeOps$.equal$extension(tpd.scala:962)
at dotty.tools.dotc.transform.SyntheticMembers.$anonfun$12(SyntheticMembers.scala:253)
at scala.collection.immutable.List.map(List.scala:246)
at dotty.tools.dotc.transform.SyntheticMembers.equalsBody$1(SyntheticMembers.scala:253)
at dotty.tools.dotc.transform.SyntheticMembers.syntheticRHS$1(SyntheticMembers.scala:144)
at dotty.tools.dotc.transform.SyntheticMembers.syntheticDef$3$$anonfun$2$$anonfun$1(SyntheticMembers.scala:153)
at dotty.tools.dotc.transform.SyntheticMembers.synthesizeDef$$anonfun$1(SyntheticMembers.scala:83)
at dotty.tools.dotc.ast.tpd$.DefDef(tpd.scala:285)
at dotty.tools.dotc.transform.SyntheticMembers.synthesizeDef(SyntheticMembers.scala:83)
at dotty.tools.dotc.transform.SyntheticMembers.syntheticDef$1(SyntheticMembers.scala:153)
at dotty.tools.dotc.transform.SyntheticMembers.syntheticDefIfMissing$1(SyntheticMembers.scala:108)
at dotty.tools.dotc.transform.SyntheticMembers.caseAndValueMethods$$anonfun$1(SyntheticMembers.scala:381)
at scala.collection.immutable.List.flatMap(List.scala:293)
at dotty.tools.dotc.transform.SyntheticMembers.caseAndValueMethods(SyntheticMembers.scala:381)
at dotty.tools.dotc.transform.SyntheticMembers.addSyntheticMembers(SyntheticMembers.scala:602)
at dotty.tools.dotc.transform.PostTyper$PostTyperTransformer.transform$$anonfun$4(PostTyper.scala:348)
at dotty.tools.dotc.transform.PostTyper$PostTyperTransformer.withNoCheckNews(PostTyper.scala:98)
at dotty.tools.dotc.transform.PostTyper$PostTyperTransformer.transform(PostTyper.scala:349)
at dotty.tools.dotc.ast.Trees$Instance$TreeMap.transform(Trees.scala:1473)
at dotty.tools.dotc.transform.MacroTransform$Transformer.transform(MacroTransform.scala:51)
at dotty.tools.dotc.transform.PostTyper$PostTyperTransformer.transform(PostTyper.scala:378)
at dotty.tools.dotc.transform.MacroTransform$Transformer.transformStat$1(MacroTransform.scala:39)
at dotty.tools.dotc.transform.MacroTransform$Transformer.transformStats$$anonfun$1(MacroTransform.scala:42)
at dotty.tools.dotc.core.Decorators$ListDecorator$.loop$1(Decorators.scala:92)
at dotty.tools.dotc.core.Decorators$ListDecorator$.mapconserve$extension(Decorators.scala:108)
at dotty.tools.dotc.transform.MacroTransform$Transformer.transformStats(MacroTransform.scala:42)
at dotty.tools.dotc.transform.PostTyper$PostTyperTransformer.transformStats(PostTyper.scala:452)
at dotty.tools.dotc.transform.MacroTransform$Transformer.transform(MacroTransform.scala:58)
at dotty.tools.dotc.transform.PostTyper$PostTyperTransformer.transform$$anonfun$8$$anonfun$1(PostTyper.scala:347)
at dotty.tools.dotc.transform.SuperAccessors.wrapTemplate(SuperAccessors.scala:210)
at dotty.tools.dotc.transform.PostTyper$PostTyperTransformer.transform$$anonfun$4(PostTyper.scala:347)
at dotty.tools.dotc.transform.PostTyper$PostTyperTransformer.withNoCheckNews(PostTyper.scala:98)
at dotty.tools.dotc.transform.PostTyper$PostTyperTransformer.transform(PostTyper.scala:349)
at dotty.tools.dotc.ast.Trees$Instance$TreeMap.transform(Trees.scala:1473)
at dotty.tools.dotc.transform.MacroTransform$Transformer.transform(MacroTransform.scala:51)
at dotty.tools.dotc.transform.PostTyper$PostTyperTransformer.transform(PostTyper.scala:378)
at dotty.tools.dotc.transform.MacroTransform$Transformer.transformStat$1(MacroTransform.scala:39)
at dotty.tools.dotc.transform.MacroTransform$Transformer.transformStats$$anonfun$1(MacroTransform.scala:42)
at dotty.tools.dotc.core.Decorators$ListDecorator$.loop$1(Decorators.scala:92)
at dotty.tools.dotc.core.Decorators$ListDecorator$.mapconserve$extension(Decorators.scala:108)
at dotty.tools.dotc.transform.MacroTransform$Transformer.transformStats(MacroTransform.scala:42)
at dotty.tools.dotc.transform.PostTyper$PostTyperTransformer.transformStats(PostTyper.scala:452)
at dotty.tools.dotc.ast.Trees$Instance$TreeMap.transform(Trees.scala:1484)
at dotty.tools.dotc.transform.MacroTransform$Transformer.transform(MacroTransform.scala:51)
at dotty.tools.dotc.transform.PostTyper$PostTyperTransformer.transform(PostTyper.scala:443)
at dotty.tools.dotc.transform.MacroTransform.run(MacroTransform.scala:21)
at dotty.tools.dotc.core.Phases$Phase.runOn$$anonfun$1(Phases.scala:308)
at scala.collection.immutable.List.map(List.scala:246)
at dotty.tools.dotc.core.Phases$Phase.runOn(Phases.scala:309)
at dotty.tools.dotc.Run.runPhases$4$$anonfun$4(Run.scala:261)
at scala.runtime.function.JProcedure1.apply(JProcedure1.java:15)
at scala.runtime.function.JProcedure1.apply(JProcedure1.java:10)
at scala.collection.ArrayOps$.foreach$extension(ArrayOps.scala:1323)
at dotty.tools.dotc.Run.runPhases$5(Run.scala:272)
at dotty.tools.dotc.Run.compileUnits$$anonfun$1(Run.scala:280)
at scala.runtime.java8.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.scala:18)
at dotty.tools.dotc.util.Stats$.maybeMonitored(Stats.scala:68)
at dotty.tools.dotc.Run.compileUnits(Run.scala:289)
at dotty.tools.dotc.Run.compileSources(Run.scala:222)
at dotty.tools.dotc.Run.compile(Run.scala:206)
at dotty.tools.dotc.Driver.doCompile(Driver.scala:39)
at dotty.tools.dotc.Driver.process(Driver.scala:199)
at dotty.tools.dotc.Driver.process(Driver.scala:167)
at dotty.tools.dotc.Driver.process(Driver.scala:179)
at dotty.tools.dotc.Driver.main(Driver.scala:209)
at dotty.tools.dotc.Main.main(Main.scala)
```
I don't know if this is the right approach or if we should try to not normalize on completions to avoid this sort of issue instead. |
Something like this seems to work: diff --git compiler/src/dotty/tools/dotc/core/SymDenotations.scala compiler/src/dotty/tools/dotc/core/SymDenotations.scala
index fcfbba208eb..5bf766d6c9b 100644
--- compiler/src/dotty/tools/dotc/core/SymDenotations.scala
+++ compiler/src/dotty/tools/dotc/core/SymDenotations.scala
@@ -1611,7 +1611,7 @@ object SymDenotations {
case _ => false
if owner.isClass then
- for c <- owner.info.decls.toList if maybeChild(c) do
+ for c <- owner.info.decls.toList if maybeChild(c) && (c.isClass || c.is(EnumVal)) do
c.ensureCompleted()
end completeChildrenIn |
Compiler version
Scala 3.0.2 (Scastie)
Minimized code
Output
Compiler error:
Expectation
No compiler error. I expect the type of x to be
(A | Deleted) &: (B | Deleted) &: CNil
.The text was updated successfully, but these errors were encountered: