Closed
Description
Compiler version
3.1.0 with -Ycheck:all
Minimized code
object Bar {
def unapply(x: Any): Option[Int *: Int *: EmptyTuple] = ???
}
def test =
"" match
case Bar((a, b)) =>
Output
exception while typing {
case val x3: Int *: Int *: EmptyTuple = x2.get
case val x4: Int *: Int *: EmptyTuple = x3
if x4.ne(null) then
{
case val a: Int = x4._1.$asInstanceOf[Int]
case val b: Int = x4._2.$asInstanceOf[Int]
return[matchResult1]
{
()
}
}
else ()
} of class class dotty.tools.dotc.ast.Trees$Block # -1
...
Exception in thread "main" java.lang.AssertionError: assertion failed: symbols differ for x4._1
was : getter _1
alternatives by type: of types
qualifier type : (x4 : Int *: Int *: EmptyTuple)
tree type : (x4._1 : => T1) of class class dotty.tools.dotc.core.Types$CachedTermRef while compiling tests/pos-macros/contruct-desturct/DestructExpr.scala
java.lang.AssertionError: assertion failed: symbols differ for x4._1
was : getter _1
alternatives by type: of types
qualifier type : (x4 : Int *: Int *: EmptyTuple)
tree type : (x4._1 : => T1) of class class dotty.tools.dotc.core.Types$CachedTermRef
The issue is that we have a Int *: Int *: EmptyTuple
and not a Tuple2[Int, Int]
and therefore we do not have the member _1
. We do have the apply(0)
which does the same and erases/optimized to _1
in this case.
Expectation
We should generate x4.apply(0)
instead of x4._1
. This should make it possible to also scale above the 22 tuple limit.