Bug with macros and static functions, including Equatable's ==

Trying to drum up some interest in a bug that keeps getting in my way when doing Macro Schtuff™. Essentially, it seems that although a macro can create a static function, it can't then be called, or used as a witness of a protocol?

I'm aware of at least 5 bug reports in this area, only one of which has even been triaged:

Can anyone help get this fixed? (I got absolutely nowhere trying to find the problem in the compiler source myself!)

2 Likes

@Douglas_Gregor perhaps? (sorry)

In case anyone else ends up here when faced with this bug, it seems to be fixed on the latest toolchain snapshot (April 4, 2024), if using that is an option for you

Thanks, possibly fixed by [Macros] Reproduce issue with peer+extension macro extension's methods not being checked as witnesses by ktoso · Pull Request #71717 · apple/swift · GitHub?

They marked ExtensionMacro extension methods are always (and incorrectly) fileprivate access only · Issue #69073 · apple/swift · GitHub as closed, which is very similar to the others in this thread.

Yes, all of the bugs that I know of around visibility of methods added by extension macros, which could manifest as protocol conformance failures, were fixed by [Macros] Reproduce issue with peer+extension macro extension's methods not being checked as witnesses by ktoso · Pull Request #71717 · apple/swift · GitHub.

1 Like