From 2c760780fefab37d87629fa4bc1678b78afcf182 Mon Sep 17 00:00:00 2001 From: Nicolas Stucki Date: Thu, 6 Jan 2022 10:04:23 +0100 Subject: [PATCH] Support quoted PolyFunction Fixes #14180 --- compiler/src/dotty/tools/dotc/quoted/PickledQuotes.scala | 5 ----- tests/pos-macros/i14180/Macro_1.scala | 3 +++ tests/pos-macros/i14180/Test_2.scala | 2 ++ 3 files changed, 5 insertions(+), 5 deletions(-) create mode 100644 tests/pos-macros/i14180/Macro_1.scala create mode 100644 tests/pos-macros/i14180/Test_2.scala diff --git a/compiler/src/dotty/tools/dotc/quoted/PickledQuotes.scala b/compiler/src/dotty/tools/dotc/quoted/PickledQuotes.scala index 0b323836d59a..6347e6bc4dec 100644 --- a/compiler/src/dotty/tools/dotc/quoted/PickledQuotes.scala +++ b/compiler/src/dotty/tools/dotc/quoted/PickledQuotes.scala @@ -91,11 +91,6 @@ object PickledQuotes { val quotedType = typeHole(idx, reifiedArgs) PickledQuotes.quotedTypeToTree(quotedType) } - case tree: Select => - // Retain selected members - val qual = transform(tree.qualifier) - qual.select(tree.symbol).withSpan(tree.span) - case tree => if tree.isDef then tree.symbol.annotations = tree.symbol.annotations.map { diff --git a/tests/pos-macros/i14180/Macro_1.scala b/tests/pos-macros/i14180/Macro_1.scala new file mode 100644 index 000000000000..ee6396c1d1d8 --- /dev/null +++ b/tests/pos-macros/i14180/Macro_1.scala @@ -0,0 +1,3 @@ +import scala.quoted._ +def impl(using Quotes): Expr[Unit] = + '{ ([V] => (v: V) => println(v)).apply[Int](2) } diff --git a/tests/pos-macros/i14180/Test_2.scala b/tests/pos-macros/i14180/Test_2.scala new file mode 100644 index 000000000000..a98ba87e8729 --- /dev/null +++ b/tests/pos-macros/i14180/Test_2.scala @@ -0,0 +1,2 @@ +inline def foo = ${ impl } +def example = foo