What is a bystander module?

A code search reveals it is the same as bystander modules for cross import overlays. DocumentationNode.swift - apple/swift-docc - Sourcegraph

It looks like this should be part of the Lexicon.md file and it isn't but you can take a look at the RFC. NNNN-cross-import-overlays.md · GitHub

A cross-import overlay module wraps its declaring module , re-exporting the declaring module’s contents but also adding extra APIs to it. The compiler imports the cross-import overlay module in place of the declaring module only when an additional bystanding module is imported into the same file.

can a module have more than one bystander module?

I might be missing something, but I don't think so. If that were the case, these signatures would probably require passing a collection of bystander names instead of a single name. https://github.com/apple/swift/blob/4453571e461ba23679433024783ddbb3c3f6c164/lib/AST/Module.cpp#L1961-L1966

1 Like