Skip to content

"Duplicate attachment" assertion on self-referencing type #7820

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

Closed
sir-wabbit opened this issue Dec 20, 2019 · 0 comments
Closed

"Duplicate attachment" assertion on self-referencing type #7820

sir-wabbit opened this issue Dec 20, 2019 · 0 comments

Comments

@sir-wabbit
Copy link

minimized code

trait A { type F[X >: F, Y] }
Stack trace
exception occurred while typechecking testing/Test.scala
exception occurred while compiling testing/Test.scala
java.lang.AssertionError: assertion failed: duplicate attachment for key dotty.tools.dotc.util.Property$Key@7d61eccf while compiling testing/Test.scala
Exception in thread "main" java.lang.AssertionError: assertion failed: duplicate attachment for key dotty.tools.dotc.util.Property$Key@7d61eccf
	at dotty.DottyPredef$.assertFail(DottyPredef.scala:17)
	at dotty.tools.dotc.util.Attachment$Container.pushAttachment(Attachment.scala:118)
	at dotty.tools.dotc.ast.Trees$Tree.pushAttachment(Trees.scala:55)
	at dotty.tools.dotc.typer.Namer.recordSym(Namer.scala:264)
	at dotty.tools.dotc.typer.Namer.createOrRefine$1(Namer.scala:373)
	at dotty.tools.dotc.typer.Namer.createSymbol(Namer.scala:428)
	at dotty.tools.dotc.typer.Namer.recur$1(Namer.scala:534)
	at dotty.tools.dotc.typer.Namer.indexExpanded(Namer.scala:544)
	at dotty.tools.dotc.typer.Namer.$anonfun$2(Namer.scala:767)
	at scala.collection.LinearSeqOps.foldLeft(LinearSeq.scala:169)
	at scala.collection.LinearSeqOps.foldLeft$(LinearSeq.scala:165)
	at scala.collection.immutable.List.foldLeft(List.scala:79)
	at dotty.tools.dotc.typer.Namer.index(Namer.scala:767)
	at dotty.tools.dotc.typer.Namer.completeParams(Namer.scala:1277)
	at dotty.tools.dotc.typer.Namer$TypeDefCompleter.completerTypeParams(Namer.scala:963)
	at dotty.tools.dotc.core.TypeApplications$.typeParams$extension(TypeApplications.scala:176)
	at dotty.tools.dotc.core.TypeApplications$.typeParamSymbols$extension(TypeApplications.scala:205)
	at dotty.tools.dotc.typer.Typer.adaptType$1(Typer.scala:3072)
	at dotty.tools.dotc.typer.Typer.adapt1(Typer.scala:3138)
	at dotty.tools.dotc.typer.Typer.adapt(Typer.scala:2544)
	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2213)
	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2225)
	at dotty.tools.dotc.typer.Typer.typedTypeBoundsTree(Typer.scala:1492)
	at dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:2148)
	at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:2177)
	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2213)
	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2225)
	at dotty.tools.dotc.typer.Namer.typedAheadType$$anonfun$1(Namer.scala:1260)
	at dotty.tools.dotc.typer.Namer.typedAhead(Namer.scala:1253)
	at dotty.tools.dotc.typer.Namer.typedAheadType(Namer.scala:1260)
	at dotty.tools.dotc.typer.Namer.typeDefSig(Namer.scala:1534)
	at dotty.tools.dotc.typer.Namer$TypeDefCompleter.typeSig(Namer.scala:971)
	at dotty.tools.dotc.typer.Namer$Completer.completeInCreationContext(Namer.scala:935)
	at dotty.tools.dotc.typer.Namer$Completer.complete(Namer.scala:843)
	at dotty.tools.dotc.core.SymDenotations$SymDenotation.completeFrom(SymDenotations.scala:258)
	at dotty.tools.dotc.core.Denotations$Denotation.completeInfo$1(Denotations.scala:185)
	at dotty.tools.dotc.core.Denotations$Denotation.info(Denotations.scala:187)
	at dotty.tools.dotc.core.SymDenotations$SymDenotation.ensureCompleted(SymDenotations.scala:398)
	at dotty.tools.dotc.typer.Typer.retrieveSym(Typer.scala:2071)
	at dotty.tools.dotc.typer.Typer.typedNamed$1(Typer.scala:2096)
	at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:2176)
	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2213)
	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2225)
	at dotty.tools.dotc.typer.Namer.typedAheadExpr$$anonfun$1(Namer.scala:1263)
	at dotty.tools.dotc.typer.Namer.typedAhead(Namer.scala:1253)
	at dotty.tools.dotc.typer.Namer.typedAheadExpr(Namer.scala:1263)
	at dotty.tools.dotc.typer.Namer.completeParams$$anonfun$1(Namer.scala:1278)
	at scala.collection.immutable.List.foreach(List.scala:305)
	at dotty.tools.dotc.typer.Namer.completeParams(Namer.scala:1278)
	at dotty.tools.dotc.typer.Namer$TypeDefCompleter.completerTypeParams(Namer.scala:963)
	at dotty.tools.dotc.typer.Namer$TypeDefCompleter.typeSig(Namer.scala:971)
	at dotty.tools.dotc.typer.Namer$Completer.completeInCreationContext(Namer.scala:935)
	at dotty.tools.dotc.typer.Namer$Completer.complete(Namer.scala:843)
	at dotty.tools.dotc.core.SymDenotations$SymDenotation.completeFrom(SymDenotations.scala:258)
	at dotty.tools.dotc.core.Denotations$Denotation.completeInfo$1(Denotations.scala:185)
	at dotty.tools.dotc.core.Denotations$Denotation.info(Denotations.scala:187)
	at dotty.tools.dotc.core.SymDenotations$SymDenotation.ensureCompleted(SymDenotations.scala:398)
	at dotty.tools.dotc.typer.Typer.retrieveSym(Typer.scala:2071)
	at dotty.tools.dotc.typer.Typer.typedNamed$1(Typer.scala:2096)
	at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:2176)
	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2213)
	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2225)
	at dotty.tools.dotc.typer.Typer.traverse$1(Typer.scala:2247)
	at dotty.tools.dotc.typer.Typer.typedStats(Typer.scala:2291)
	at dotty.tools.dotc.typer.Typer.typedClassDef(Typer.scala:1784)
	at dotty.tools.dotc.typer.Typer.typedNamed$1(Typer.scala:2109)
	at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:2176)
	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2213)
	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2225)
	at dotty.tools.dotc.typer.Typer.traverse$1(Typer.scala:2247)
	at dotty.tools.dotc.typer.Typer.typedStats(Typer.scala:2291)
	at dotty.tools.dotc.typer.Typer.typedPackageDef(Typer.scala:1910)
	at dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:2150)
	at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:2177)
	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2213)
	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2225)
	at dotty.tools.dotc.typer.Typer.typedExpr(Typer.scala:2333)
	at dotty.tools.dotc.typer.FrontEnd.liftedTree1$2(FrontEnd.scala:78)
	at dotty.tools.dotc.typer.FrontEnd.typeCheck$$anonfun$1(FrontEnd.scala:83)
	at dotty.runtime.function.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.java:12)
	at dotty.tools.dotc.typer.FrontEnd.monitor(FrontEnd.scala:42)
	at dotty.tools.dotc.typer.FrontEnd.typeCheck(FrontEnd.scala:84)
	at dotty.tools.dotc.typer.FrontEnd.runOn$$anonfun$3(FrontEnd.scala:114)
	at dotty.runtime.function.JProcedure1.apply(JProcedure1.java:15)
	at dotty.runtime.function.JProcedure1.apply(JProcedure1.java:10)
	at scala.collection.immutable.List.foreach(List.scala:305)
	at dotty.tools.dotc.typer.FrontEnd.runOn(FrontEnd.scala:114)
	at dotty.tools.dotc.Run.runPhases$4$$anonfun$4(Run.scala:161)
	at dotty.runtime.function.JProcedure1.apply(JProcedure1.java:15)
	at dotty.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:171)
	at dotty.tools.dotc.Run.compileUnits$$anonfun$1(Run.scala:179)
	at dotty.runtime.function.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.java:12)
	at dotty.tools.dotc.util.Stats$.maybeMonitored(Stats.scala:65)
	at dotty.tools.dotc.Run.compileUnits(Run.scala:186)
	at dotty.tools.dotc.Run.compileSources(Run.scala:123)
	at dotty.tools.dotc.Run.compile(Run.scala:106)
	at dotty.tools.dotc.Driver.doCompile(Driver.scala:36)
	at dotty.tools.dotc.Driver.process(Driver.scala:189)
	at dotty.tools.dotc.Driver.process(Driver.scala:158)
	at dotty.tools.dotc.Driver.process(Driver.scala:170)
	at dotty.tools.dotc.Driver.main(Driver.scala:197)
	at dotty.tools.dotc.Main.main(Main.scala)
smarter added a commit that referenced this issue Dec 25, 2019
Fix #7820: Break cycle when computing completerTypeParams
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant