Created
April 21, 2014 20:13
-
-
Save dstu/11155020 to your computer and use it in GitHub Desktop.
Dead code error in Scala macro definintion
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package errordemo | |
import scala.annotation.StaticAnnotation | |
import scala.reflect.macros.whitebox.Context | |
class mymacro extends StaticAnnotation { | |
def macroTransform(annottees: Any*): Any = macro MacroImpl.macroImpl | |
} | |
class MacroImpl(val c: Context) { | |
import c.universe._ | |
def macroImpl(annottees: c.Expr[Any]*): c.Expr[Any] = c.literalUnit | |
} |
NB: This crops up as an error when -Ywarn-dead-code and -Xfatal-warnings are passed to scalac. The warning is spurious, and a patch has been written. This should be fixed in Scala 2.11.1.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Scala 2.11.0, macroparadise 2.0.0, sbt 0.13.2. Error message: "dead code following this construct" at "macro MacroImpl.macroImpl".