Skip to content

Implement quote auto-lifting under an import #5986

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

Closed
nicolasstucki opened this issue Feb 25, 2019 · 1 comment
Closed

Implement quote auto-lifting under an import #5986

nicolasstucki opened this issue Feb 25, 2019 · 1 comment
Assignees

Comments

@nicolasstucki
Copy link
Contributor

The idea is to have an implicit conversion that converts a T to an Expr[T] using the toExpr conversion. This would allow us to write

def plus(n: Int, m: Expr[Int]): Expr[Int] = 
  if (n == 0) m else '{ $n + $m }

instead of

def plus(n: Int, m: Expr[Int]): Expr[Int] = 
  if (n == 0) m else '{ ${n.toExpr} + $m }
@nicolasstucki
Copy link
Contributor Author

It would be enabled by importing

import scala.quoted.autolift

biboudis added a commit to dotty-staging/dotty that referenced this issue Mar 27, 2019
nicolasstucki added a commit that referenced this issue Apr 2, 2019
Fix #5986: Add autolift implicit conversion
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants