When i try to use the reflection API to create an instance of an unknown type-class that contains extension methods, say something like the following, I run into trouble:
trait Show[A]:
extension (a: A)
def show: String
If i include Flags.ExtensionMethod in the flags argument passed to Symbol.newMethod(...), then the macro expansion fails with the following error with -Xcheck-macros. Without that flag it works just fine, and overrides the method without any issue. Is there something I am missing, or is this a bug?
[error] ./main.scala:13:17
[error] Exception occurred while executing macro expansion.
[error] java.lang.AssertionError: Received invalid flags.
Expected flags Flags.ExtensionMethod | Flags.Method to only contain
a subset of
Flags.Artifact | Flags.Deferred | Flags.Final | Flags.Given | Flags.Implicit |
Flags.JavaStatic | Flags.Local | Flags.Method | Flags.Override | Flags.Private |
Flags.PrivateLocal | Flags.Protected | Flags.Synthetic.