0

For example:

q"import scala.collection.mutable.Buffer\ndef foo: Buffer[Int] = ???"

This gives an error, because the newline characters is not resolved.

0__
  • 66,707
  • 21
  • 171
  • 266

1 Answers1

2

Sample from my tmp dir:

    evals += q"""assert ($x.productArity >= ${args.length - 1},
    "Bad product arity ("+ $x.productArity +") for assignment")"""

Or, just use a semi:

q"import scala.collection.mutable.Buffer; def foo: Buffer[Int] = ???"

You can't splice something that is parsed away.

som-snytt
  • 39,429
  • 2
  • 47
  • 129