`@_exported import` does not properly export custom operators

Definitely a bug. I'm surprised because at one point we had the opposite bug, where operators would be exported even when you didn't use @_exported (which, yes, is not officially supported yet, but I'd be surprised if it changed very much when folks get around to finalizing it). The reason for that is because operator lookup goes through a different path than normal name lookup (or at least it used to), and while there was a reason for that in the early Swift compiler architecture (which had more discrete passes) there's not really a good reason now. Someone should make OperatorDecls a kind of ValueDecl and remove all the custom operator lookup code.

(Operator decls aren't values, but neither are modules; it's just how the compiler models normal name lookup. Clang separates "NamedDecls" from ValueDecls for this reason.)

1 Like