You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
class TestTypecheck() extends StaticAnnotation {
def macroTransform(annottees: Any*): Any = macro Predef.TestTypecheckImpl
}
def TestTypecheckImpl(c: whitebox.Context)(annottees: c.Tree*): c.Tree = {
import c._
import universe._
//try {
c.typecheck(q"val a: Int")
//} catch {
// case e => e.printStackTrace
//}
annottees(0)
}
object A2 { @TestTypecheck class B }
This doesn't compile, because we can't have undeclareds member inside of an object.
When we don't catch the Exception, we get an cyclic reference error and a StackTrace which doesn't lead to the cause. This is really ugly to debug.
When we print the exception of typecheck, we can at least find our code in the Stacktrace.
An error message like the following would be great:
scala.reflect.macros.TypecheckException: only classes can have declared but undefined members
A variation of this is probably the cause of the error message in #49. #49
The text was updated successfully, but these errors were encountered:
This is not a blocker for me. It was only annoying to debug.
A simple way to improve the the userexperience could be, to log all exception, which are thrown inside of macros.
object A2 { @TestTypecheck class B }
This doesn't compile, because we can't have undeclareds member inside of an object.
When we don't catch the Exception, we get an cyclic reference error and a StackTrace which doesn't lead to the cause. This is really ugly to debug.
When we print the exception of typecheck, we can at least find our code in the Stacktrace.
An error message like the following would be great:
scala.reflect.macros.TypecheckException: only classes can have declared but undefined members
A variation of this is probably the cause of the error message in #49.
#49
The text was updated successfully, but these errors were encountered: