Hi all,
I have a possible problem in Scala 2.12.0-RC2 that doesn't happen with
Scala 2.11.8 or with Scala 2.10.6.
My sample unfortunately isn't minimal, due to time constraints. However
I have a Gist with the code producing it, with the macro expansion that
happens and with the problem, if you care to take a look:
https://gist.github.com/alexandru/26400bfc6209d4884d9cc916ad48d196
What happens is that I have code like this:
new MyInterface {
val scheduler = s
}
Which translates into a node like this (since vals in scala are just
private vars with a public def):
ValDef(Modifiers(PRIVATE | LOCAL), TermName("scheduler ") ...
Which in Scala 2.12 all of a sudden is rewritten like this due to my
macro:
ValDef(Modifiers(), TermName("scheduler ") ...
So the `private[this]` part of that definition is gone, with the
compiler then generating an error message because all of a sudden this
is in conflict with its own generated `DefDef`. It's very confusing why
this happens as in my code I see nowhere the possibility for this and as
I said, Scala 2.11 and 2.10 work just fine with my macro.
I must mention that I'm using as dependencies:
- "org.typelevel" %%% "macro-compat" % "1.1.1"
- "org.scalamacros" % "paradise" % "2.1.0" cross CrossVersion.full
Cheers,
--
Alexandru Nedelcu
alexn.org