I want to do something like this:
def assuming[A](condition: => Boolean)(f: => A): A = { require(condition, /* print source-code of condition */) f
Have you consulted the docs at:
http://www.scala-lang.org/api/2.11.0/scala-reflect/#scala.reflect.api.Printers
scala> show(q"-1 < 0") res6: String = -1.$less(0) scala> showCode(q"-1 < 0") res7: String = (-1).<(0)
Alternatively, folks have used source positions to glean snippets to print.