diff --git a/compiler/src/scala/quoted/runtime/impl/QuotesImpl.scala b/compiler/src/scala/quoted/runtime/impl/QuotesImpl.scala index 04d8d7bc51a0..c802d2a9201d 100644 --- a/compiler/src/scala/quoted/runtime/impl/QuotesImpl.scala +++ b/compiler/src/scala/quoted/runtime/impl/QuotesImpl.scala @@ -1105,7 +1105,7 @@ class QuotesImpl private (using val ctx: Context) extends Quotes, QuoteUnpickler object TypeTreeTypeTest extends TypeTest[Tree, TypeTree]: def unapply(x: Tree): Option[TypeTree & x.type] = x match - case x: (tpd.TypeBoundsTree & x.type) => None + case TypeBoundsTreeTypeTest(_) => None case x: (tpd.Tree & x.type) if x.isType => Some(x) case _ => None end TypeTreeTypeTest diff --git a/tests/pos-macros/i19480/Macro_1.scala b/tests/pos-macros/i19480/Macro_1.scala new file mode 100644 index 000000000000..bf3ea577a20e --- /dev/null +++ b/tests/pos-macros/i19480/Macro_1.scala @@ -0,0 +1,11 @@ +import scala.quoted.* + +inline def whatever: Int = ${whateverImpl} + +def whateverImpl(using Quotes): Expr[Int] = { + import quotes.reflect.* + val t = '{class K[T]}.asTerm + object mapper extends TreeMap + mapper.transformTree(t)(Symbol.spliceOwner) + '{42} +} diff --git a/tests/pos-macros/i19480/Test_2.scala b/tests/pos-macros/i19480/Test_2.scala new file mode 100644 index 000000000000..f12d2935bb9a --- /dev/null +++ b/tests/pos-macros/i19480/Test_2.scala @@ -0,0 +1 @@ +def test = whatever diff --git a/tests/pos-macros/i19480b/Macro_1.scala b/tests/pos-macros/i19480b/Macro_1.scala new file mode 100644 index 000000000000..150c0e93002d --- /dev/null +++ b/tests/pos-macros/i19480b/Macro_1.scala @@ -0,0 +1,11 @@ +import scala.quoted.* + +inline def whatever: Int = ${whateverImpl} + +def whateverImpl(using Quotes): Expr[Int] = { + import quotes.reflect.* + val t = '{class K[T[_]]}.asTerm + object mapper extends TreeMap + mapper.transformTree(t)(Symbol.spliceOwner) + '{42} +} diff --git a/tests/pos-macros/i19480b/Test_2.scala b/tests/pos-macros/i19480b/Test_2.scala new file mode 100644 index 000000000000..f12d2935bb9a --- /dev/null +++ b/tests/pos-macros/i19480b/Test_2.scala @@ -0,0 +1 @@ +def test = whatever