From 4277bc4d6f55297603a8f7d9a9a6b8d99b23a395 Mon Sep 17 00:00:00 2001 From: Nicolas Stucki Date: Mon, 1 Jul 2019 13:27:30 +0200 Subject: [PATCH] Fix #6765: Add regression test --- tests/run-macros/i6765-b.check | 8 ++++++++ tests/run-macros/i6765-b/Macro_1.scala | 9 +++++++++ tests/run-macros/i6765-b/Test_2.scala | 8 ++++++++ tests/run-macros/i6765.check | 8 ++++++++ tests/run-macros/i6765/Macro_1.scala | 12 ++++++++++++ tests/run-macros/i6765/Test_2.scala | 8 ++++++++ 6 files changed, 53 insertions(+) create mode 100644 tests/run-macros/i6765-b.check create mode 100644 tests/run-macros/i6765-b/Macro_1.scala create mode 100644 tests/run-macros/i6765-b/Test_2.scala create mode 100644 tests/run-macros/i6765.check create mode 100644 tests/run-macros/i6765/Macro_1.scala create mode 100644 tests/run-macros/i6765/Test_2.scala diff --git a/tests/run-macros/i6765-b.check b/tests/run-macros/i6765-b.check new file mode 100644 index 000000000000..5b3a32df1825 --- /dev/null +++ b/tests/run-macros/i6765-b.check @@ -0,0 +1,8 @@ +{ + val x$1: java.lang.String = "One" + scala.Nil.::[java.lang.String](x$1) +} +{ + val x$1: java.lang.String = "One" + scala.Nil.::[java.lang.String](x$1) +} diff --git a/tests/run-macros/i6765-b/Macro_1.scala b/tests/run-macros/i6765-b/Macro_1.scala new file mode 100644 index 000000000000..b1977d73c388 --- /dev/null +++ b/tests/run-macros/i6765-b/Macro_1.scala @@ -0,0 +1,9 @@ +import scala.quoted._ +import delegate scala.quoted._ + +inline def foo = ${fooImpl} + +def fooImpl given (qctx: QuoteContext) = { + val res = List('{"One"}).toExprOfList + res.show.toExpr +} diff --git a/tests/run-macros/i6765-b/Test_2.scala b/tests/run-macros/i6765-b/Test_2.scala new file mode 100644 index 000000000000..4900ac973855 --- /dev/null +++ b/tests/run-macros/i6765-b/Test_2.scala @@ -0,0 +1,8 @@ +object Test { + def main(args: Array[String]): Unit = { + val res = foo + println(res) + + println(foo) + } +} diff --git a/tests/run-macros/i6765.check b/tests/run-macros/i6765.check new file mode 100644 index 000000000000..5b3a32df1825 --- /dev/null +++ b/tests/run-macros/i6765.check @@ -0,0 +1,8 @@ +{ + val x$1: java.lang.String = "One" + scala.Nil.::[java.lang.String](x$1) +} +{ + val x$1: java.lang.String = "One" + scala.Nil.::[java.lang.String](x$1) +} diff --git a/tests/run-macros/i6765/Macro_1.scala b/tests/run-macros/i6765/Macro_1.scala new file mode 100644 index 000000000000..de5709fd9b05 --- /dev/null +++ b/tests/run-macros/i6765/Macro_1.scala @@ -0,0 +1,12 @@ +import scala.quoted._ +import delegate scala.quoted._ + +delegate for Toolbox = Toolbox.make(getClass.getClassLoader) + +inline def foo = ${fooImpl} + +def fooImpl given (qctx: QuoteContext) = { + import qctx.tasty._ + val res = List('{"One"}).toExprOfList + res.show.toExpr +} diff --git a/tests/run-macros/i6765/Test_2.scala b/tests/run-macros/i6765/Test_2.scala new file mode 100644 index 000000000000..4900ac973855 --- /dev/null +++ b/tests/run-macros/i6765/Test_2.scala @@ -0,0 +1,8 @@ +object Test { + def main(args: Array[String]): Unit = { + val res = foo + println(res) + + println(foo) + } +}