storm-enroute/macrogl — pull request #31 by inmost-light (2014-04-10 16:41:51+00:00)
Title: Scala update

Ok, so here it is again.

Still haven't found a good solution for `inlineAndReset` problem. [Here](https://groups.google.com/forum/#!msg/scala-internals/rIyJ4yHdPDU/qS-7DreEbCwJ) I read that `resetLocalAttrs` should help:

> To make sure that there aren't any problems with transplanting symbols, you unattribute all trees that you plan to transplant using `c.resetLocalAttrs`, destroying all symbols and types that have been assigned to them.

But I don't think it does?

```
import language.experimental.macros
import scala.reflect.macros.whitebox.Context

object Macros {
def f(x: Int): Unit = macro fmacro
def fmacro(c: Context)(x: c.Tree) = {
import c.universe._
println(x.symbol)
println(c.untypecheck(x).symbol)
println(c.resetLocalAttrs(x).symbol)
println(c.parse(showCode(x)).symbol)
q"println($x)"
}
}

```

```
import Macros._

object Test {
def main(args: Array[String]): Unit = {
val num = 123
f(num)
}
}
```

And the output from `fmacro` is the following:
```
value num
value num
value num

```

At the moment I'm converting trees to strings and then back to trees via `Context.parse`, which strips the symbols data, but that's obviously just a hack.