diff --git a/compiler/src/scala/quoted/runtime/impl/QuoteMatcher.scala b/compiler/src/scala/quoted/runtime/impl/QuoteMatcher.scala index e3d5355eaffa..221bcfc71c91 100644 --- a/compiler/src/scala/quoted/runtime/impl/QuoteMatcher.scala +++ b/compiler/src/scala/quoted/runtime/impl/QuoteMatcher.scala @@ -460,10 +460,10 @@ class QuoteMatcher(debug: Boolean) { */ def matchTypeDef(sctypedef: TypeDef, pttypedef: TypeDef): MatchingExprs = sctypedef match case TypeDef(_, TypeBoundsTree(sclo, schi, EmptyTree)) - if sclo.tpe == defn.NothingType && schi.tpe == defn.AnyType => + if sclo.tpe.isNothingType && schi.tpe.isAny => pttypedef match case TypeDef(_, TypeBoundsTree(ptlo, pthi, EmptyTree)) - if sclo.tpe == defn.NothingType && schi.tpe == defn.AnyType => + if sclo.tpe.isNothingType && schi.tpe.isAny => matched case _ => notMatched case _ => notMatched diff --git a/tests/pos-macros/i23589/Macro_1.scala b/tests/pos-macros/i23589/Macro_1.scala new file mode 100644 index 000000000000..19df8f6c68f6 --- /dev/null +++ b/tests/pos-macros/i23589/Macro_1.scala @@ -0,0 +1,11 @@ +import scala.quoted.* +import scala.language.experimental.quotedPatternsWithPolymorphicFunctions + +inline def testMacro(inline body: Any) = ${test('body)} +def test(outsideBody: Expr[Any])(using Quotes): Expr[Unit] = + val insideBody = '{[B] => (a : B, b : B) => (a, b)} + outsideBody match + case '{ [A] => (x : A, y : A) => $b[A](x, y): (A, A) } => () + insideBody match + case '{ [A] => (x : A, y : A) => $b[A](x, y): (A, A) } => () + '{()} diff --git a/tests/pos-macros/i23589/Main_2.scala b/tests/pos-macros/i23589/Main_2.scala new file mode 100644 index 000000000000..64dd8e6698a3 --- /dev/null +++ b/tests/pos-macros/i23589/Main_2.scala @@ -0,0 +1,3 @@ +//> using options -experimental +@main def main() = + testMacro([B] => (a : B, b : B) => (a, b))