Skip to content

Commit f703838

Browse files
Backport "Fix TypeTreeTypeTest to not match TypeBoundsTrees" to LTS (#20984)
Backports #19485 to the LTS branch. PR submitted by the release tooling. [skip ci]
2 parents 02ea1d8 + 217d0e1 commit f703838

File tree

5 files changed

+25
-1
lines changed

5 files changed

+25
-1
lines changed

compiler/src/scala/quoted/runtime/impl/QuotesImpl.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1084,7 +1084,7 @@ class QuotesImpl private (using val ctx: Context) extends Quotes, QuoteUnpickler
10841084

10851085
object TypeTreeTypeTest extends TypeTest[Tree, TypeTree]:
10861086
def unapply(x: Tree): Option[TypeTree & x.type] = x match
1087-
case x: (tpd.TypeBoundsTree & x.type) => None
1087+
case TypeBoundsTreeTypeTest(_) => None
10881088
case x: (tpd.Tree & x.type) if x.isType => Some(x)
10891089
case _ => None
10901090
end TypeTreeTypeTest

tests/pos-macros/i19480/Macro_1.scala

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import scala.quoted.*
2+
3+
inline def whatever: Int = ${whateverImpl}
4+
5+
def whateverImpl(using Quotes): Expr[Int] = {
6+
import quotes.reflect.*
7+
val t = '{class K[T]}.asTerm
8+
object mapper extends TreeMap
9+
mapper.transformTree(t)(Symbol.spliceOwner)
10+
'{42}
11+
}

tests/pos-macros/i19480/Test_2.scala

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
def test = whatever
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import scala.quoted.*
2+
3+
inline def whatever: Int = ${whateverImpl}
4+
5+
def whateverImpl(using Quotes): Expr[Int] = {
6+
import quotes.reflect.*
7+
val t = '{class K[T[_]]}.asTerm
8+
object mapper extends TreeMap
9+
mapper.transformTree(t)(Symbol.spliceOwner)
10+
'{42}
11+
}

tests/pos-macros/i19480b/Test_2.scala

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
def test = whatever

0 commit comments

Comments
 (0)