Reputation: 3343
Basically I'm imagining the following.
trait A[T] {
def get(idx: Int): U
}
The macro comes in the use. Ideally I want to be able to use get(0), get(1) as macros where the proper return type will be known. Is this possible?
Upvotes: 0
Views: 30
Reputation: 13048
Yes. Just specify the return type as Any
and make your macro whitebox (http://docs.scala-lang.org/overviews/macros/blackbox-whitebox.html#blackbox_and_whitebox_macros). Whitebox macro expansions assume their actual type, not the declared type of the macro definition.
Upvotes: 1