Sometimes it is just useful to see the typechecked AST of a scala expression.
Macros to the rescue:
import scala.reflect.macros.Context
import scala.language.experimental.macros
def astImpl(c: Context)(expr: c.Expr[Any]): c.Expr[Unit] = {
import c.universe._
println(showRaw(expr.tree))
reify{}
}
def ast(expr: Any) = macro astImpl
Copy the snippet to the REPL and use it like:
scala> ast{
| println(1)
| }
Apply(Select(Select(This(newTypeName("scala")), scala.Predef), newTermName("println")), List(Literal(Constant(1))))