From 3560d65c11e4c19c44719bee05718b712dd0af57 Mon Sep 17 00:00:00 2001 From: Nicolas Stucki Date: Mon, 25 Apr 2022 13:32:30 +0200 Subject: [PATCH] Add regression test Closes #9685 --- tests/neg-macros/i9685.check | 5 +++++ tests/neg-macros/i9685/Macros_1.scala | 11 +++++++++++ tests/neg-macros/i9685/Test_2.scala | 4 ++++ 3 files changed, 20 insertions(+) create mode 100644 tests/neg-macros/i9685.check create mode 100644 tests/neg-macros/i9685/Macros_1.scala create mode 100644 tests/neg-macros/i9685/Test_2.scala diff --git a/tests/neg-macros/i9685.check b/tests/neg-macros/i9685.check new file mode 100644 index 000000000000..bb25a0808aca --- /dev/null +++ b/tests/neg-macros/i9685.check @@ -0,0 +1,5 @@ + +-- [E008] Not Found Error: tests/neg-macros/i9685/Test_2.scala:3:4 ----------------------------------------------------- +3 | 1.asdf // error + | ^^^^^^ + | value asdf is not a member of Int diff --git a/tests/neg-macros/i9685/Macros_1.scala b/tests/neg-macros/i9685/Macros_1.scala new file mode 100644 index 000000000000..b986afc2213f --- /dev/null +++ b/tests/neg-macros/i9685/Macros_1.scala @@ -0,0 +1,11 @@ +import scala.language.implicitConversions + +class Clue[+T](val value: T) + +object Clue { + import scala.quoted._ + + inline implicit def generate[T](value: T): Clue[T] = ${ clueImpl('value) } + + def clueImpl[T:Type](value: Expr[T])(using Quotes): Expr[Clue[T]] = '{ new Clue($value) } +} diff --git a/tests/neg-macros/i9685/Test_2.scala b/tests/neg-macros/i9685/Test_2.scala new file mode 100644 index 000000000000..4fbb2ca1ab13 --- /dev/null +++ b/tests/neg-macros/i9685/Test_2.scala @@ -0,0 +1,4 @@ +object Main { + def toClue[A](a: A): Clue[A] = Clue.generate(a) + 1.asdf // error +} \ No newline at end of file