Closed jrduncans closed 3 years ago
That's a lot of code — have you attempted to minimize it?
A proper minimization would 1) have less code in it, probably a lot less, and 2) if at all possible, not involve an external dependency.
(Regardless, thanks for the report, it is already valuable.)
Not having a clue what the error means, I didn't have any idea where to start minimizing. I will update if I find the time to trial and error into anything simpler.
Minimized to:
object PagedResponse {
type Aux[Item0] = PagedResponse { type Item = Item0 }
}
trait PagedResponse {
type Item
sealed trait NextPage
case class NoMorePages() extends NextPage
}
object Test {
def foo[A](next: PagedResponse.Aux[A]#NextPage): Unit = next match {
case _: PagedResponse.Aux[A]#NoMorePages => ???
}
}
$ scalac -2.12.15 t12467.scala // ok
$ scalac -2.13.5 t12467.scala // ok
$ scalac -3.0.2 t12467.scala // ok
$ scalac -2.13.6 t12467.scala
error: java.lang.AssertionError: assertion failed:
mkAttributedQualifier(PagedResponse{type Item = A}, <none>) parents = List(PagedResponse)
while compiling: t12467.scala
during phase: patmat
library version: version 2.13.6
compiler version: version 2.13.6
reconstructed args:
last tree to typer: Ident(x)
tree position: line 8 of t12467.scala
tree tpe: Boolean
symbol: value x
symbol definition: x: Boolean (a TermSymbol)
symbol package: <none>
symbol owners: value x
call site: method foo in object Test in package <empty>
== Source file context for tree position ==
5 trait PagedResponse {
6 type Item
7 sealed trait NextPage
8 case class NoMorePages() extends NextPage
9 }
10
11 object Test {
at scala.reflect.internal.SymbolTable.throwAssertionError(SymbolTable.scala:171)
at scala.reflect.internal.TreeGen.mkAttributedQualifier(TreeGen.scala:117)
at scala.reflect.internal.TreeGen.mkAttributedQualifier(TreeGen.scala:74)
at scala.reflect.internal.TreeGen.mkAttributedQualifierIfPossible(TreeGen.scala:152)
at scala.tools.nsc.transform.patmat.MatchTreeMaking$TreeMakers$TypeTestTreeMaker$treeCondStrategy$.withOuterTest(MatchTreeMaking.scala:431)
at scala.tools.nsc.transform.patmat.MatchTreeMaking$TreeMakers$TypeTestTreeMaker$treeCondStrategy$.withOuterTest(MatchTreeMaking.scala:339)
at scala.tools.nsc.transform.patmat.MatchTreeMaking$TreeMakers$TypeTestTreeMaker.addOuterTest$1(MatchTreeMaking.scala:520)
at scala.tools.nsc.transform.patmat.MatchTreeMaking$TreeMakers$TypeTestTreeMaker.mkDefault$1(MatchTreeMaking.scala:530)
at scala.tools.nsc.transform.patmat.MatchTreeMaking$TreeMakers$TypeTestTreeMaker.renderCondition(MatchTreeMaking.scala:554)
at scala.tools.nsc.transform.patmat.MatchTreeMaking$TreeMakers$TypeTestTreeMaker.<init>(MatchTreeMaking.scala:558)
Thanks, Tom!
It isn't obvious to me what PR might be responsible. @lrytz @dwijnand do you have a guess? if not, I guess the next step would be bisecting it
Thanks for the minimisation, Tom!
https://github.com/scala/scala/pull/9504. That's @retronym's code, that looks to improving how we validate that the prefixes align. But here the prefixes are not stable values, they're just refined types (behind the aux type alias) so there's no outer test to emit. I'll send a patch.
reproduction steps
Produces error:
problem
This code compiled under numerous previous version of Scala, including Scala 2.13.5.