scala - "too few argument lists for macro invocation" -


given following code:

case class jetdim(dimension: int) {   require(dimension > 0) }  object jetdim {   def build(dimension: int): int = macro jetdimmacro.apply } 

and macro calls:

def apply(dimension: int): int = macro applyimpl  def applyimpl(c: context)(dimension: c.expr[int]): c.expr[int] = ... 

i'm getting compile-time error:

[error]  few argument lists macro invocation [error]  def build(dimension: int): int = macro jetdimmacro.apply 

why?

the macro keyword takes method should have context parameter first parameter list (and many expr arguments in subsequent lists). in jetdim you're giving macro method has macro implementation. isn't valid syntax—you can't "nest" macro this. you'll need either call jetdimmacro.apply directly (as normal method call) in jetdim.build, or use macro jetdimmacro.applyimpl (which more want).


Comments

Popular posts from this blog

php - failed to open stream: HTTP request failed! HTTP/1.0 400 Bad Request -

java - How to filter a backspace keyboard input -

java - Show Soft Keyboard when EditText Appears -