Inside the annotation macro, I list the members of the class and want the types of the methods to be found.
So, I happily iterate over the class bodyand collect all the members DefDef.
... which I cannot verify.
For each, DefDefI tried to wrap it in Exprand use it actualType. I tried to duplicate a thing and transplant it into an ad-hoc class (via quasivotes). I tried everything I can think of :)
The best I can get is either NoType, or Any, depending on the technique used. The worst I get is the exception I selected.
These are simple methods, forms def foo(i: String) = i, so you need to specify the type of return, but no external information is required. There are no abstract types, or params of a type, or other class members involved here. I would like to handle more complex cases later, but first I want these trivial examples to work.
In the plugin, that would be easy. I would just describe the whole block with suppressed errors and get what I want with characters, and then reset the attributes of the tree for further processing. Like a macro ... I'm at a standstill.
What am I missing?
source
share