-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
opaque type regression in nightly causes type mismatch by missing an extension method #13021
Comments
Note: some things appear unrelated here, but if you remove them the error disappears. This is the most minimized version I managed to make. |
Can we find out which commit causes the regression? |
Unfortunately, on my machine I can barely compile Scala3, so I'm unable to bisect it. |
It seems the error as reported began with #12815, however the example fails to compile beginning with #12541, giving the following stack trace: assertion failure for DFBits.type <:< ?{ Token: ? }, frozen = false
exception occurred while typechecking DFToken.scala
java.lang.AssertionError: NoDenotation.owner while compiling DFBits.scala, DFToken.scala, Width.scala
Exception in thread "main" java.lang.AssertionError: NoDenotation.owner
at dotty.tools.dotc.core.SymDenotations$NoDenotation$.owner(SymDenotations.scala:2428)
at dotty.tools.dotc.core.SymDenotations$.stillValidInOwner(SymDenotations.scala:2489)
at dotty.tools.dotc.core.SymDenotations$.stillValidInOwner(SymDenotations.scala:2496)
at dotty.tools.dotc.core.SymDenotations$.stillValid(SymDenotations.scala:2485)
at dotty.tools.dotc.core.Denotations$SingleDenotation.bringForward(Denotations.scala:744)
at dotty.tools.dotc.core.Denotations$SingleDenotation.toNewRun$1(Denotations.scala:803)
at dotty.tools.dotc.core.Denotations$SingleDenotation.current(Denotations.scala:877)
at dotty.tools.dotc.core.Symbols$Symbol.recomputeDenot(Symbols.scala:122)
at dotty.tools.dotc.core.Symbols$Symbol.computeDenot(Symbols.scala:116)
at dotty.tools.dotc.core.Symbols$Symbol.denot(Symbols.scala:109)
at dotty.tools.dotc.core.SymDenotations$.stillValidInOwner(SymDenotations.scala:2489)
at dotty.tools.dotc.core.SymDenotations$.stillValid(SymDenotations.scala:2485)
at dotty.tools.dotc.core.Denotations$SingleDenotation.bringForward(Denotations.scala:744)
at dotty.tools.dotc.core.Denotations$SingleDenotation.toNewRun$1(Denotations.scala:803)
at dotty.tools.dotc.core.Denotations$SingleDenotation.current(Denotations.scala:877)
at dotty.tools.dotc.core.Symbols$Symbol.recomputeDenot(Symbols.scala:122)
at dotty.tools.dotc.core.Symbols$Symbol.computeDenot(Symbols.scala:116)
at dotty.tools.dotc.core.Symbols$Symbol.denot(Symbols.scala:109)
at dotty.tools.dotc.core.SymDenotations$.stillValidInOwner(SymDenotations.scala:2489)
at dotty.tools.dotc.core.SymDenotations$.stillValid(SymDenotations.scala:2483)
at dotty.tools.dotc.core.Symbols$Symbol.isValidInCurrentRun(Symbols.scala:151)
at dotty.tools.dotc.core.Types$NamedType.computeSymbol(Types.scala:2123)
at dotty.tools.dotc.core.Types$NamedType.symbol(Types.scala:2118)
at dotty.tools.dotc.core.TypeOps$AsSeenFromMap.apply(TypeOps.scala:99)
at dotty.tools.dotc.core.Types$TypeMap.mapOver(Types.scala:5281)
at dotty.tools.dotc.core.TypeOps$AsSeenFromMap.apply(TypeOps.scala:109)
at dotty.tools.dotc.core.Types$TypeMap.mapOverLambda(Types.scala:5259)
at dotty.tools.dotc.core.TypeOps$AsSeenFromMap.apply(TypeOps.scala:103)
at dotty.tools.dotc.core.Types$TypeMap.mapOver(Types.scala:5293)
at dotty.tools.dotc.core.TypeOps$AsSeenFromMap.apply(TypeOps.scala:109)
at dotty.tools.dotc.core.TypeOps$.asSeenFrom(TypeOps.scala:54)
at dotty.tools.dotc.core.Types$Type.asSeenFrom(Types.scala:1024)
at dotty.tools.dotc.core.Denotations$SingleDenotation.derived$1(Denotations.scala:1096)
at dotty.tools.dotc.core.Denotations$SingleDenotation.computeAsSeenFrom(Denotations.scala:1118)
at dotty.tools.dotc.core.Denotations$SingleDenotation.computeAsSeenFrom(Denotations.scala:1076)
at dotty.tools.dotc.core.Denotations$PreDenotation.asSeenFrom(Denotations.scala:135)
at dotty.tools.dotc.core.SymDenotations$ClassDenotation.findMember(SymDenotations.scala:1992)
at dotty.tools.dotc.core.Types$Type.go$1(Types.scala:683)
at dotty.tools.dotc.core.Types$Type.findMember(Types.scala:870)
at dotty.tools.dotc.core.Types$Type.memberBasedOnFlags(Types.scala:666)
at dotty.tools.dotc.core.Types$Type.member(Types.scala:650)
at dotty.tools.dotc.typer.ProtoTypes$SelectionProto.isMatchedBy(ProtoTypes.scala:198)
at dotty.tools.dotc.core.TypeComparer.isMatchedByProto(TypeComparer.scala:1856)
at dotty.tools.dotc.core.TypeComparer.firstTry$1(TypeComparer.scala:305)
at dotty.tools.dotc.core.TypeComparer.recur(TypeComparer.scala:1282)
at dotty.tools.dotc.core.TypeComparer.isSubType(TypeComparer.scala:185)
at dotty.tools.dotc.core.TypeComparer.isSubType(TypeComparer.scala:195)
at dotty.tools.dotc.core.TypeComparer.topLevelSubType(TypeComparer.scala:128)
at dotty.tools.dotc.core.TypeComparer.testSubType(TypeComparer.scala:144)
at dotty.tools.dotc.core.TypeComparer$.testSubType(TypeComparer.scala:2688)
at dotty.tools.dotc.typer.Typer.adaptNoArgsOther$4(Typer.scala:3524)
at dotty.tools.dotc.typer.Typer.adaptNoArgs$1(Typer.scala:3620)
at dotty.tools.dotc.typer.Typer.adapt1(Typer.scala:3811)
at dotty.tools.dotc.typer.Typer.adapt(Typer.scala:3163)
at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2823)
at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2827)
at dotty.tools.dotc.typer.Typer.typedExpr(Typer.scala:2943)
at dotty.tools.dotc.typer.Typer.typeSelectOnTerm$1(Typer.scala:609)
at dotty.tools.dotc.typer.Typer.typedSelect(Typer.scala:659)
at dotty.tools.dotc.typer.Typer.typedNamed$1(Typer.scala:2665)
at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:2757)
at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2823)
at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2827)
at dotty.tools.dotc.typer.Typer.typedAppliedTypeTree(Typer.scala:1862)
at dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:2721)
at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:2758)
at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2823)
at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2827)
at dotty.tools.dotc.typer.Namer.typedAheadType$$anonfun$1(Namer.scala:1389)
at dotty.tools.dotc.typer.Namer.typedAhead(Namer.scala:1381)
at dotty.tools.dotc.typer.Namer.typedAheadType(Namer.scala:1389)
at dotty.tools.dotc.typer.Namer.valOrDefDefSig(Namer.scala:1635)
at dotty.tools.dotc.typer.Namer$Completer.typeSig(Namer.scala:699)
at dotty.tools.dotc.typer.Namer$Completer.completeInCreationContext(Namer.scala:826)
at dotty.tools.dotc.typer.Namer$Completer.complete(Namer.scala:727)
at dotty.tools.dotc.core.SymDenotations$SymDenotation.completeFrom(SymDenotations.scala:167)
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:2637)
at dotty.tools.dotc.typer.Typer.typedNamed$1(Typer.scala:2662)
at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:2757)
at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2823)
at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2827)
at dotty.tools.dotc.typer.Namer.typedAheadExpr$$anonfun$1(Namer.scala:1394)
at dotty.tools.dotc.typer.Namer.typedAhead(Namer.scala:1381)
at dotty.tools.dotc.typer.Namer.typedAheadExpr(Namer.scala:1394)
at dotty.tools.dotc.typer.Namer.completeParams$$anonfun$1(Namer.scala:1410)
at scala.collection.immutable.List.foreach(List.scala:333)
at dotty.tools.dotc.typer.Namer.completeParams(Namer.scala:1410)
at dotty.tools.dotc.typer.Namer.defDefSig$$anonfun$3(Namer.scala:1673)
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.Namer.defDefSig(Namer.scala:1673)
at dotty.tools.dotc.typer.Namer$Completer.typeSig(Namer.scala:703)
at dotty.tools.dotc.typer.Namer$Completer.completeInCreationContext(Namer.scala:826)
at dotty.tools.dotc.typer.Namer$Completer.complete(Namer.scala:727)
at dotty.tools.dotc.core.SymDenotations$SymDenotation.completeFrom(SymDenotations.scala:167)
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:2637)
at dotty.tools.dotc.typer.Typer.typedNamed$1(Typer.scala:2662)
at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:2757)
at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2823)
at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2827)
at dotty.tools.dotc.typer.Typer.traverse$1(Typer.scala:2849)
at dotty.tools.dotc.typer.Typer.typedStats(Typer.scala:2899)
at dotty.tools.dotc.typer.Typer.typedClassDef(Typer.scala:2354)
at dotty.tools.dotc.typer.Typer.typedTypeOrClassDef$2(Typer.scala:2683)
at dotty.tools.dotc.typer.Typer.typedNamed$1(Typer.scala:2687)
at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:2757)
at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2823)
at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2827)
at dotty.tools.dotc.typer.Typer.traverse$1(Typer.scala:2849)
at dotty.tools.dotc.typer.Typer.typedStats(Typer.scala:2899)
at dotty.tools.dotc.typer.Typer.typedPackageDef(Typer.scala:2477)
at dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:2728)
at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:2758)
at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2823)
at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2827)
at dotty.tools.dotc.typer.Typer.typedExpr(Typer.scala:2943)
at dotty.tools.dotc.typer.FrontEnd.liftedTree1$1(FrontEnd.scala:79)
at dotty.tools.dotc.typer.FrontEnd.typeCheck$$anonfun$1(FrontEnd.scala:84)
at dotty.tools.dotc.typer.FrontEnd.monitor(FrontEnd.scala:43)
at dotty.tools.dotc.typer.FrontEnd.typeCheck(FrontEnd.scala:85)
at dotty.tools.dotc.typer.FrontEnd.runOn$$anonfun$3(FrontEnd.scala:120)
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.FrontEnd.runOn(FrontEnd.scala:120)
at dotty.tools.dotc.Run.runPhases$4$$anonfun$4(Run.scala:205)
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:216)
at dotty.tools.dotc.Run.compileUnits$$anonfun$1(Run.scala:224)
at scala.runtime.java8.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.scala:18)
at dotty.tools.dotc.util.Stats$.maybeMonitored(Stats.scala:67)
at dotty.tools.dotc.Run.compileUnits(Run.scala:231)
at dotty.tools.dotc.Run.compileUnits(Run.scala:172)
at dotty.tools.dotc.Driver.finish(Driver.scala:60)
at dotty.tools.dotc.Driver.doCompile(Driver.scala:40)
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) |
this compiles in 3.2.0, 3.3.3, 3.4.0, 3.4.2-RC1 I'll add a regression test |
Backports #20104 to the LTS branch. PR submitted by the release tooling. [skip ci]
Compilation order seems to affect the ability to use an extension method on an opaque type that has an underlying value in the same name (
data
in this case). The features interacting here are opaque types, extension methods, transparent inline macros, and incremental compilation. I believe the transparent inline macro is just affecting the compilation order and has nothing to do with the actual bug here.Compiler version
Error in 3.0.2-RC1-bin-20210701-9f97b0b-NIGHTLY
v3.0.1-RC2 is OK!
The regression may be in the inline and opaque type changes, but I have not bisected it (not possible to do on my machine).
Minimized code
Minimized project at: https://github.com/soronpo/dottybug/tree/opaque_fail
Width.scala
DFToken.scala
DFBits.scala
Output
Expectation
No error.
The text was updated successfully, but these errors were encountered: