diff --git a/tests/pos-macros/i15475.scala b/tests/pos-macros/i15475.scala new file mode 100644 index 000000000000..20993cd46d15 --- /dev/null +++ b/tests/pos-macros/i15475.scala @@ -0,0 +1,13 @@ +def test = + transform { + val a: Seq[Generic[?]] = ??? + a.foreach { to => + to.mthd() + } + } + +transparent inline def transform[T](expr: T): T = ??? + +trait Generic[+T] { + def mthd(): Generic[T] = ??? +} diff --git a/tests/pos-macros/i15475a/Macro_1.scala b/tests/pos-macros/i15475a/Macro_1.scala new file mode 100644 index 000000000000..b1bd676e7e17 --- /dev/null +++ b/tests/pos-macros/i15475a/Macro_1.scala @@ -0,0 +1,17 @@ +package x + +import scala.quoted.* + + +transparent inline def xtransform[T](inline expr:T) = ${ + X.transform('expr) +} + +object X { + + def transform[T:Type](x: Expr[T])(using Quotes):Expr[T] = { + import quotes.reflect.* + x + } + +} diff --git a/tests/pos-macros/i15475a/Test_2.scala b/tests/pos-macros/i15475a/Test_2.scala new file mode 100644 index 000000000000..7757a14950de --- /dev/null +++ b/tests/pos-macros/i15475a/Test_2.scala @@ -0,0 +1,15 @@ +package x + +def hello = { + xtransform { + val a: Seq[Generic[?]] = null + a + .foreach { to => + to.mthd() + } + } +} + +trait Generic[+T] { + def mthd(): Generic[T] = this +}