Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support quoted PolyFunction #14222

Merged
merged 1 commit into from
Jan 6, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 0 additions & 5 deletions compiler/src/dotty/tools/dotc/quoted/PickledQuotes.scala
Original file line number Diff line number Diff line change
Expand Up @@ -91,11 +91,6 @@ object PickledQuotes {
val quotedType = typeHole(idx, reifiedArgs)
PickledQuotes.quotedTypeToTree(quotedType)
}
case tree: Select =>
// Retain selected members
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Happy to see a bug fixed by deleting code, but I don't really understand what this code was there for in the first place 😅. What does retaining means here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I do not remember exactly. There was an issue where the selects lost their symbol and this was a workaround. We must have fixed the actual source of the issue in the meantime.

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 {
Expand Down
3 changes: 3 additions & 0 deletions tests/pos-macros/i14180/Macro_1.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import scala.quoted._
def impl(using Quotes): Expr[Unit] =
'{ ([V] => (v: V) => println(v)).apply[Int](2) }
2 changes: 2 additions & 0 deletions tests/pos-macros/i14180/Test_2.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
inline def foo = ${ impl }
def example = foo