diff --git a/tests/pos-macros/i8576.scala b/tests/pos-macros/i8576.scala new file mode 100644 index 000000000000..29227ae5d9b1 --- /dev/null +++ b/tests/pos-macros/i8576.scala @@ -0,0 +1,11 @@ +import scala.quoted._ +type Opt[A] = A | Null +object Opt { + def f[T](x: T): T = x + private def mapMacro[A: Type](v: Expr[Opt[A]])(using Quotes): Expr[Unit] = + '{ + val result: Opt[A] = $v + if result != null then + ${f('{result})} + } +}