Skip to content

Instantly share code, notes, and snippets.

@runarorama
Last active August 29, 2015 14:04
Show Gist options
  • Save runarorama/e0f00927a1bdf8dd6786 to your computer and use it in GitHub Desktop.
Save runarorama/e0f00927a1bdf8dd6786 to your computer and use it in GitHub Desktop.
import scala.language.experimental.macros
import scala.reflect.macros.whitebox.Context
class Foo {
override def toString: String = macro Foo.toStringImpl
}
object Foo {
def toStringImpl(c: Context): c.Expr[String] = {
import c.universe._
c.Expr[String](q"new ToStringNotAllowed")
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment