-
Notifications
You must be signed in to change notification settings - Fork 10.5k
[SourceKit/InterfaceGen] Also print the cross-import overlays of a module in its interface. #30521
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[SourceKit/InterfaceGen] Also print the cross-import overlays of a module in its interface. #30521
Conversation
…dule in its interface. When printing the generated interface of a module, also print the decls from any underscored cross-import overlays it is the direct, or indirect underlying module of. Declarations are grouped by overlay, with a descriptive `MARK:` comment introducing each overlay, and a regular comment above each decl listing the required bystander modules that must be imported for the decl to be available. In addition in each overlay: - import declarations of any underlying modules are filtered out, since they are either other underscored cross-import overlays, or the target module they are being presented as being part of. - import declarations that are also in the target module are filtered out, since the overlay is being presented as a conditional part of the target module. Resolves rdar://problem/59445385
@swift-ci please test |
Build failed |
@swift-ci test Linux |
@swift-ci test Windows |
Build failed |
|
||
import B | ||
|
||
// Available when B is imported with A |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How does this synthesized comment relate to a user documentation comment, could you add some doc-comments in the test cases?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The synthesized comment is printed before it at the moment. Added a test case showing the current behavior.
…erlays as coming from the underylying module. Also refactor some of the interface generation cross-import support code to be shared.
7f6af09
to
36cf4ad
Compare
/// Prints a single decl using the \p Printer and \p Options provided. | ||
/// | ||
/// \returns Whether the given decl was printed. | ||
static bool printModuleInterfaceDecl(Decl *D, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This isn't new code - it's just pulled out of printSubmoduleInterface()
below.
@swift-ci please test |
Build failed |
test/SourceKit/InterfaceGen/gen_swift_module_cross_import.swift.A.response
Show resolved
Hide resolved
…er the required bystanders comment.
36cf4ad
to
a355a56
Compare
@swift-ci please test |
Build failed |
Build failed |
@swift-ci please test |
@brentdax I'm going to go ahead and merge this so I can land a few subsequent PRs based on some the APIs added in this one, but it'd be great if you could take a look when you get the chance (I know you're probably busy build czar-ing). I'm not sure I've used the right terminology everywhere, and am probably missing some interesting test cases. |
When printing the generated interface of a module, also print the decls from any underscored cross-import overlays it is the direct, or indirect underlying module of. Declarations are grouped by overlay, with a
MARK:
comment introducing each overlay, and a regular comment above each decl listing the required bystander modules that must be imported for the decl to beavailable.
In addition, in each overlay:
@brentdax does that handling of import decls in overlays make sense?
Also update cursor info to report the owning module of the symbol under the cursor as the underlying/primary module when the symbol comes from a cross-import overlay.
Resolves rdar://problem/59445385