From 129ca7db22a7675d021d5460b36b4ca9289516b2 Mon Sep 17 00:00:00 2001 From: Nicolas Stucki Date: Mon, 17 Jan 2022 17:33:18 +0100 Subject: [PATCH] Add regression test --- tests/pos-macros/null-by-name/Macro_1.scala | 10 ++++++++++ tests/pos-macros/null-by-name/Test_2.scala | 1 + 2 files changed, 11 insertions(+) create mode 100644 tests/pos-macros/null-by-name/Macro_1.scala create mode 100644 tests/pos-macros/null-by-name/Test_2.scala diff --git a/tests/pos-macros/null-by-name/Macro_1.scala b/tests/pos-macros/null-by-name/Macro_1.scala new file mode 100644 index 000000000000..7d57990dd136 --- /dev/null +++ b/tests/pos-macros/null-by-name/Macro_1.scala @@ -0,0 +1,10 @@ +import scala.quoted.* + +inline def foo(x: => Any): Unit = + ${ impl('x) } + +private def impl(x: Expr[Any])(using Quotes) : Expr[Unit] = { + '{ + val a = $x + } +} diff --git a/tests/pos-macros/null-by-name/Test_2.scala b/tests/pos-macros/null-by-name/Test_2.scala new file mode 100644 index 000000000000..34f5a3111ac6 --- /dev/null +++ b/tests/pos-macros/null-by-name/Test_2.scala @@ -0,0 +1 @@ +def test = foo(null)