From d3f50c2f9ba4cbbcb00ced51ca0bf1e31a4fae1a Mon Sep 17 00:00:00 2001 From: Nicolas Stucki Date: Fri, 18 Dec 2020 11:07:45 +0100 Subject: [PATCH] Fix #8865: Add regression test --- tests/neg-macros/i8865.scala | 10 ++++++++++ tests/pos-macros/i8865.scala | 10 ++++++++++ 2 files changed, 20 insertions(+) create mode 100644 tests/neg-macros/i8865.scala create mode 100644 tests/pos-macros/i8865.scala diff --git a/tests/neg-macros/i8865.scala b/tests/neg-macros/i8865.scala new file mode 100644 index 000000000000..990cbd2cdb30 --- /dev/null +++ b/tests/neg-macros/i8865.scala @@ -0,0 +1,10 @@ +import scala.quoted._ +object Macro { + + def impl[A : Type](using Quotes): Expr[A] = { + import quotes.reflect._ + val tpe = TypeRepr.of[A].asType + '{ (a: ${tpe}) => ???} // error: tpe.Underlying cannot be used as a value type + '{???} + } +} \ No newline at end of file diff --git a/tests/pos-macros/i8865.scala b/tests/pos-macros/i8865.scala new file mode 100644 index 000000000000..ed4b5ae48033 --- /dev/null +++ b/tests/pos-macros/i8865.scala @@ -0,0 +1,10 @@ +import scala.quoted._ +object Macro { + + def impl[A : Type](using Quotes): Expr[A] = { + import quotes.reflect._ + TypeRepr.of[A].asType match + case '[tpe] => '{ (a: tpe) => ???} + '{???} + } +} \ No newline at end of file