Nice to see this moving along. Assorted comments:
If swiftoverlay files with the same name are present in both the swiftcrossimport directory itself and the module-triple-specific subdirectories, the compiler takes the union of all of their “modules” lists.
What if some of the modules have the same name, but additional keys that differ? It might be better to define priority rules now, in case they ever grow more attributes. Or to just say it's not allowed.
Imports with the
@testable
or@_private
attributes are not included in the cross-import set; nor are their transitive imports.
What's the standard way to test my cross-import overlay, then? Just be explicit? (@testable import KarrKit; @testable import _KarrKit_Combine
)
Any imports of one of the declaring modules directly in the source file are disabled, so the compiler behaves as though the declaring module was not directly imported into that source file.
I'm sure there is a good reason for this, but what is it? Since you already have to handle cross-import overlays _KarrKit_Combine and _KarrKit_Tractor alongside each other, it seems like looking into the original KarrKit would be just as easy. (Thus eliminating the dependency on @_exported
.)
Also, while the order of lookups into cross-import shouldn't be specified, you should make sure it's deterministic, because I can see it subtly affecting things. (Certainly it can affect diagnostic order.)
- Load the list of cross-import overlay modules for that pair of modules.
What happens if a cross-import overlay is named, but missing? Is that a compiler error, or a warning, or ignored?
It's very weird that this proposal depends on @_exported
when that hasn't officially been made part of the language, even if, as you say, we can hardly break it. I think it's worth formally acknowledging @_exported
at this point, but that would be a separate proposal. Hm.
I also agree with the several people who say this needs SwiftPM support. It may still be a separate, parallel proposal, but it should be considered in parallel with everything else. I suggest that an initial version of the SwiftPM proposal doesn't do anything to reduce dependencies at the package level (so, e.g. you still have to declare the cross-import overlays as explicit dependencies for now, even if they are not imported explicitly in the source).