Closed
Description
When defining opaque type in the companion of an opaque type with the same name.
Test code:
object O {
opaque type T = Int
object T {
opaque type T = Int
}
}
Output:
-- Error: opaque-conflict.scala:4:16 -------------------------------
4 | opaque type T = Int
| ^^^^^^^^^^^^^^^^^^^
| T is already defined as type T
exception occurred while typechecking opaque-conflict.scala
exception occurred while compiling opaque-conflict.scala
java.lang.AssertionError: NoDenotation.owner while compiling opaque-conflict.scala
Exception in thread "main" java.lang.AssertionError: NoDenotation.owner
at dotty.tools.dotc.core.SymDenotations$NoDenotation$.owner(SymDenotations.scala:2075)
at dotty.tools.dotc.core.SymDenotations$SymDenotation.typeRef(SymDenotations.scala:1241)
at dotty.tools.dotc.typer.Namer$ClassCompleter.refineOpaqueCompanionSelfType$1(Namer.scala:1165)
at dotty.tools.dotc.typer.Namer$ClassCompleter.completeInCreationContext(Namer.scala:1176)
at dotty.tools.dotc.typer.Namer$Completer.complete(Namer.scala:797)
at dotty.tools.dotc.core.SymDenotations$SymDenotation.completeFrom(SymDenotations.scala:236)
at dotty.tools.dotc.core.Denotations$Denotation.completeInfo$1(Denotations.scala:180)
at dotty.tools.dotc.core.Denotations$Denotation.info(Denotations.scala:182)
at dotty.tools.dotc.core.SymDenotations$SymDenotation.ensureCompleted(SymDenotations.scala:342)
at dotty.tools.dotc.core.SymDenotations$SymDenotation.isAbsent(SymDenotations.scala:469)
at dotty.tools.dotc.typer.TypeAssigner.reallyExists(TypeAssigner.scala:170)
at dotty.tools.dotc.typer.TypeAssigner.reallyExists$(TypeAssigner.scala:167)
at dotty.tools.dotc.typer.Typer.reallyExists(Typer.scala:87)
at dotty.tools.dotc.typer.Typer.qualifies$1(Typer.scala:139)
at dotty.tools.dotc.typer.Typer.loop$1(Typer.scala:287)
at dotty.tools.dotc.typer.Typer.findRefRecur$1(Typer.scala:349)
at dotty.tools.dotc.typer.Typer.findRef(Typer.scala:352)
at dotty.tools.dotc.typer.Typer.$anonfun$typedIdent$1(Typer.scala:386)
at dotty.tools.dotc.util.Stats$.track(Stats.scala:37)
at dotty.tools.dotc.typer.Typer.typedIdent(Typer.scala:362)
at dotty.tools.dotc.typer.Typer.typedNamed$1(Typer.scala:2048)
at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:2122)
at dotty.tools.dotc.typer.Typer.$anonfun$typed$2(Typer.scala:2157)
at dotty.tools.dotc.reporting.TraceSyntax.apply(trace.scala:56)
at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2150)
at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2169)
at dotty.tools.dotc.typer.Typer.typedExpr(Typer.scala:2245)
at dotty.tools.dotc.typer.Typer.typeSelectOnTerm$1(Typer.scala:462)
at dotty.tools.dotc.typer.Typer.$anonfun$typedSelect$1(Typer.scala:485)
at dotty.tools.dotc.util.Stats$.track(Stats.scala:37)
at dotty.tools.dotc.typer.Typer.typedSelect(Typer.scala:459)
at dotty.tools.dotc.typer.Typer.typedNamed$1(Typer.scala:2049)
at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:2122)
at dotty.tools.dotc.typer.Typer.$anonfun$typed$2(Typer.scala:2157)
at dotty.tools.dotc.reporting.TraceSyntax.apply(trace.scala:56)
at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2150)
at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2169)
at dotty.tools.dotc.typer.Namer.$anonfun$typedAheadType$1(Namer.scala:1209)
at dotty.tools.dotc.typer.Namer.typedAhead(Namer.scala:1202)
at dotty.tools.dotc.typer.Namer.typedAheadType(Namer.scala:1209)
at dotty.tools.dotc.typer.Namer.typeDefSig(Namer.scala:1477)
at dotty.tools.dotc.typer.Namer$TypeDefCompleter.typeSig(Namer.scala:918)
at dotty.tools.dotc.typer.Namer$Completer.completeInCreationContext(Namer.scala:882)
at dotty.tools.dotc.typer.Namer$Completer.complete(Namer.scala:797)
at dotty.tools.dotc.core.SymDenotations$SymDenotation.completeFrom(SymDenotations.scala:236)
at dotty.tools.dotc.core.Denotations$Denotation.completeInfo$1(Denotations.scala:180)
at dotty.tools.dotc.core.Denotations$Denotation.info(Denotations.scala:182)
at dotty.tools.dotc.core.Denotations$SingleDenotation.computeAsSeenFrom(Denotations.scala:1118)
at dotty.tools.dotc.core.Denotations$SingleDenotation.computeAsSeenFrom(Denotations.scala:718)
at dotty.tools.dotc.core.Denotations$PreDenotation.asSeenFrom(Denotations.scala:128)
at dotty.tools.dotc.core.SymDenotations$ClassDenotation.findMember(SymDenotations.scala:1722)
at dotty.tools.dotc.core.Types$Type.go$1(Types.scala:562)
at dotty.tools.dotc.core.Types$Type.findMember(Types.scala:712)
at dotty.tools.dotc.core.Types$Type.memberBasedOnFlags(Types.scala:545)
at dotty.tools.dotc.core.Types$Type.$anonfun$member$1(Types.scala:530)
at dotty.tools.dotc.util.Stats$.track(Stats.scala:37)
at dotty.tools.dotc.core.Types$Type.member(Types.scala:530)
at dotty.tools.dotc.typer.Typer.memberInSelfButNotThis$1(Typer.scala:1646)
at dotty.tools.dotc.typer.Typer.$anonfun$typedClassDef$7(Typer.scala:1648)
at dotty.tools.dotc.typer.Typer.$anonfun$typedClassDef$7$adapted(Typer.scala:1647)
at scala.collection.TraversableOnce.$anonfun$foldLeft$1(TraversableOnce.scala:160)
at scala.collection.TraversableOnce.$anonfun$foldLeft$1$adapted(TraversableOnce.scala:160)
at scala.collection.Iterator.foreach(Iterator.scala:941)
at scala.collection.Iterator.foreach$(Iterator.scala:941)
at scala.collection.AbstractIterator.foreach(Iterator.scala:1429)
at scala.collection.TraversableOnce.foldLeft(TraversableOnce.scala:160)
at scala.collection.TraversableOnce.foldLeft$(TraversableOnce.scala:158)
at scala.collection.AbstractIterator.foldLeft(Iterator.scala:1429)
at dotty.tools.dotc.typer.Typer.classExistsOnSelf$1(Typer.scala:1647)
at dotty.tools.dotc.typer.Typer.$anonfun$typedClassDef$1(Typer.scala:1668)
at dotty.tools.dotc.util.Stats$.track(Stats.scala:37)
at dotty.tools.dotc.typer.Typer.typedClassDef(Typer.scala:1580)
at dotty.tools.dotc.typer.Typer.typedNamed$1(Typer.scala:2059)
at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:2122)
at dotty.tools.dotc.typer.Typer.$anonfun$typed$2(Typer.scala:2157)
at dotty.tools.dotc.reporting.TraceSyntax.apply(trace.scala:56)
at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2150)
at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2169)
at dotty.tools.dotc.typer.Typer.traverse$1(Typer.scala:2188)
at dotty.tools.dotc.typer.Typer.typedStats(Typer.scala:2234)
at dotty.tools.dotc.typer.Typer.$anonfun$typedClassDef$1(Typer.scala:1674)
at dotty.tools.dotc.util.Stats$.track(Stats.scala:37)
at dotty.tools.dotc.typer.Typer.typedClassDef(Typer.scala:1580)
at dotty.tools.dotc.typer.Typer.typedNamed$1(Typer.scala:2059)
at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:2122)
at dotty.tools.dotc.typer.Typer.$anonfun$typed$2(Typer.scala:2157)
at dotty.tools.dotc.reporting.TraceSyntax.apply(trace.scala:56)
at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2150)
at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2169)
at dotty.tools.dotc.typer.Typer.traverse$1(Typer.scala:2188)
at dotty.tools.dotc.typer.Typer.typedStats(Typer.scala:2234)
at dotty.tools.dotc.typer.Typer.$anonfun$typedPackageDef$1(Typer.scala:1794)
at dotty.tools.dotc.util.Stats$.track(Stats.scala:37)
at dotty.tools.dotc.typer.Typer.typedPackageDef(Typer.scala:1787)
at dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:2099)
at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:2123)
at dotty.tools.dotc.typer.Typer.$anonfun$typed$2(Typer.scala:2157)
at dotty.tools.dotc.reporting.TraceSyntax.apply(trace.scala:56)
at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2150)
at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2169)
at dotty.tools.dotc.typer.Typer.typedExpr(Typer.scala:2245)
at dotty.tools.dotc.typer.FrontEnd.$anonfun$typeCheck$1(FrontEnd.scala:61)
at dotty.tools.dotc.typer.FrontEnd.monitor(FrontEnd.scala:35)
at dotty.tools.dotc.typer.FrontEnd.typeCheck(FrontEnd.scala:59)
at dotty.tools.dotc.typer.FrontEnd.$anonfun$runOn$6(FrontEnd.scala:89)
at dotty.tools.dotc.typer.FrontEnd.$anonfun$runOn$6$adapted(FrontEnd.scala:89)
at scala.collection.immutable.List.foreach(List.scala:392)
at dotty.tools.dotc.typer.FrontEnd.runOn(FrontEnd.scala:89)
at dotty.tools.dotc.Run.$anonfun$compileUnits$3(Run.scala:158)
at scala.runtime.java8.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.java:23)
at dotty.tools.dotc.util.Stats$.trackTime(Stats.scala:49)
at dotty.tools.dotc.Run.$anonfun$compileUnits$2(Run.scala:155)
at dotty.tools.dotc.Run.$anonfun$compileUnits$2$adapted(Run.scala:153)
at scala.collection.IndexedSeqOptimized.foreach(IndexedSeqOptimized.scala:36)
at scala.collection.IndexedSeqOptimized.foreach$(IndexedSeqOptimized.scala:33)
at scala.collection.mutable.ArrayOps$ofRef.foreach(ArrayOps.scala:198)
at dotty.tools.dotc.Run.runPhases$1(Run.scala:153)
at dotty.tools.dotc.Run.$anonfun$compileUnits$1(Run.scala:178)
at scala.runtime.java8.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.java:23)
at dotty.tools.dotc.util.Stats$.maybeMonitored(Stats.scala:102)
at dotty.tools.dotc.Run.compileUnits(Run.scala:133)
at dotty.tools.dotc.Run.compileSources(Run.scala:120)
at dotty.tools.dotc.Run.compile(Run.scala:104)
at dotty.tools.dotc.Driver.doCompile(Driver.scala:33)
at dotty.tools.dotc.Driver.process(Driver.scala:170)
at dotty.tools.dotc.Driver.process(Driver.scala:139)
at dotty.tools.dotc.Driver.process(Driver.scala:151)
at dotty.tools.dotc.Driver.main(Driver.scala:178)
at dotty.tools.dotc.Main.main(Main.scala)
Metadata
Metadata
Assignees
Labels
No labels