COMMUNITY

Macro how to do something like Macro.test( Array<String> );

Hej !

I get Expected expression when trying to do something like in the title.

I want to pass a type like that to a macro function, hoc can I do please ?

Hey, there’s no straightforward syntax to pass a ComplexType as an expression. There is/was a proposal to add EComplexType, but it doesn’t seem like it’s going to happen. The next best thing is to pass any other expression that has ComplexType as its part, for example:

  • Macro.test((_:Array<String>)) - ECheckType variant
  • Macro.test(var _:Array<String>) - EVars variant
1 Like

Hej Dan !

Thanks for your reply !

Ok I see, yes it’s a workaround. I wanted to shorten as possible a thing that why I needed that, it will be a bit more verbose, ok.

Thanks ! :wink: