Scala Plugin - Inject TypeAlias

Hi,

I want to inject a type alias in trait (based on Annotation). I could not find out if/how I can do it with one of the injectX() methods, that's why I'm asking.
The type alias is used as return type for a macro generated method.

    trait Builder { 
       type T <: Builder
    }

    @Foo
       trait A extends Builder {
       def bar: String
    }


There is a macro involved which will transform the code above to the following:

    trait Builder {
       type T <: Builder
    }

    @Foo
    trait A extends Builder {
       type T = A // <- this is the type alias to inject
       def bar(s: String): T // <- type alias is used here
       def bar: String
    }

 

Best
Tobias

1 comment
Comment actions Permalink

In particular, there is a problem injecting something like:

    type T <: A

This will result in a NPE when parsing the String. 

 

0

Please sign in to leave a comment.