You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The folowing pattern match produces buggy code when hoistLabels is applied in PatternMatcher.
This code can crate bytecode that crashes the JVM.
classTreeAccumulator2 {
deffoo(tasty: Tasty2)(tree: Any):Unit= {
importtasty._
tree match {
caseA() =>caseB() =>caseC() =>caseD() =>
}
}
}
abstractclassTasty2 {
typeXtypeYimplicitdefxct: scala.reflect.ClassTag[X]
implicitdefyct: scala.reflect.ClassTag[Y]
valA:AExtractortraitAExtractor {
defunapply(x: X):Boolean
}
valB:BExtractortraitBExtractor {
defunapply(x: X):Boolean
}
valC:CExtractortraitCExtractor {
defunapply(x: Y):Boolean// Note the type Y
}
valD:DExtractortraitDExtractor {
defunapply(x: X):Boolean
}
}
exception while typing package <empty> {
@scala.annotation.internal.SourceFile("tests/pos/tasty-pat-match.scala") class
TreeAccumulator2() extends Object() {
def foo(tasty: Tasty2)(tree: Any): Unit =
{
{
case val x1: Any(tree) = tree
def case1(): Unit = throw new MatchError(x1)
def case2(case x21: Option[tasty.X]): Unit =
if x21.isEmpty.unary_! then
{
case val x3: tasty.X = x21.get
if x3.asInstanceOf[Object].ne(null).&&(tasty.D.unapply(x3)) then
{
()
}
else case1()
}
else case1()
def case3(case x17: Option[tasty.X]): Unit =
{
case val x5: Option[tasty.Y] = tasty.yct.unapply(x1)
if x5.isEmpty.unary_! then
{
case val x6: tasty.Y = x5.get
if x6.asInstanceOf[Object].ne(null).&&(tasty.C.unapply(x6))
then
{
()
}
else case2(x17)
}
else case2(x17)
}
def case4(case x14: Option[tasty.X]): Unit =
{
case val x9: tasty.X = x14.get
if x9.asInstanceOf[Object].ne(null).&&(tasty.B.unapply(x9)) then
{
()
}
else case3(x14)
}
if x1.asInstanceOf[Object].ne(null) then
{
case val x11: Option[tasty.X] = tasty.xct.unapply(x1)
if x11.isEmpty.unary_! then
{
case val x12: tasty.X = x11.get
if x12.asInstanceOf[Object].ne(null).&&(tasty.A.unapply(x12))
then
{
()
}
else case4(x11)
}
else case3(x14)
}
else case1()
}
}
}
@scala.annotation.internal.SourceFile("tests/pos/tasty-pat-match.scala")
abstract
class Tasty2() extends Object() {
type X
type Y
implicit def xct: ClassTag[Tasty2.this.X]
implicit def yct: ClassTag[Tasty2.this.Y]
val A: Tasty2.this.AExtractor
<trait> interface trait AExtractor() extends Object {
def unapply(x: Tasty2.this.X): Boolean
}
val B: Tasty2.this.BExtractor
<trait> interface trait BExtractor() extends Object {
def unapply(x: Tasty2.this.X): Boolean
}
val C: Tasty2.this.CExtractor
<trait> interface trait CExtractor() extends Object {
def unapply(x: Tasty2.this.Y): Boolean
}
val D: Tasty2.this.DExtractor
<trait> interface trait DExtractor() extends Object {
def unapply(x: Tasty2.this.X): Boolean
}
}
}
The error is that the last call to case3 has x14 as parameter but it should have x11.
The text was updated successfully, but these errors were encountered:
* Define TASTY data types in scala.tasty
* Add method get a TASTY term from a quoted.Expr[T]
* Implement TASTY tree extractors
Use direct extractors for tasty trees
Workaround issue scala#4449
Rename TopLevelStatement to Tree
Uh oh!
There was an error while loading. Please reload this page.
The folowing pattern match produces buggy code when
hoistLabels
is applied inPatternMatcher
.This code can crate bytecode that crashes the JVM.
The error is that the last call to
case3
hasx14
as parameter but it should havex11
.The text was updated successfully, but these errors were encountered: