sirthias / parboiled2

A macro-based PEG parser generator for Scala 2.10+
Other
717 stars 86 forks source link

Non-absolute reference to java.lang.Character triggers macro compilation error #60

Closed landonf closed 10 years ago

landonf commented 10 years ago

In updating to 2.0-M2 from 2.0-M1, I started seeing this error:

[error] YParser.scala:217: value toLowerCase is not a member of org.parboiled2.Rule[shapeless.HNil,shapeless.HNil]
[error]   def YamlTrue = rule { ignoreCase("true") ~ ScalarTerminatorGuard ~ push(YBool(value = true)) }

After scratching my head about macros and toggling -Ymacro-debug-lite, I realized that this rule was the problem:

def Character = rule { EscapedChar | NormalChar }

My choice of method name conflicts with the IgnoreCaseString macro-generated reference to Character.toLowerCase(). My wisdom in using the name Character aside, perhaps this should be an absolute reference to java.lang.Character.toLowerCase()?

sirthias commented 10 years ago

Thanks, Landon! Your analysis was spot on. If you upgrade to the latest SNAPSHOT this problem should be gone...