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

resetLocalAttrs does not work with lazy val #8499

Closed
scabug opened this issue Apr 14, 2014 · 3 comments

Comments

@scabug
Copy link

commented Apr 14, 2014

Welcome to Scala version 2.10.3 (Java HotSpot(TM) 64-Bit Server VM, Java 1.7.0_45).
Type in expressions to have them evaluated.
Type :help for more information.

scala> object Mover {
     |   import scala.reflect.macros.Context
     |   def moveTreeMacro(c: Context)(e: c.Expr[Any]): c.Expr[Any] = {
     |     import c._
     |     import c.universe._
     |     val ee = c.Expr(c.resetLocalAttrs(e.tree))
     |     reify {
     |       new AnyRef {
     |         def moved = {
     |           ee.splice
     |         }
     |       }
     |     }
     |   }
     |   import scala.language.experimental.macros
     |   def moveTree(e: Any): Any = macro moveTreeMacro
     | }
defined module Mover

scala> Mover.moveTree { lazy val a = 1 }
<console>:9: error: missing parameter type
              Mover.moveTree { lazy val a = 1 }
                                        ^
@scabug

This comment has been minimized.

Copy link
Author

commented Apr 14, 2014

Imported From: https://issues.scala-lang.org/browse/SI-8499?orig=1
Reporter: @Atry
Affected Versions: 2.10.3, 2.10.4
See #5464, #5466

@scabug scabug added the macros label Apr 7, 2017
@joroKr21

This comment has been minimized.

Copy link

commented Feb 28, 2018

Works in 2.12 after lazy vals got reworked

@SethTisue SethTisue added this to the 2.12.0 milestone Feb 28, 2018
@SethTisue SethTisue closed this Feb 28, 2018
@SethTisue

This comment has been minimized.

Copy link
Member

commented Feb 28, 2018

@joroKr21 thanks for the ticket triage help, much appreciated

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
4 participants
You can’t perform that action at this time.