Skip to content

[Dependency Scanning] Refine cross-import overlay detection algorithm #79676

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

Merged

Conversation

artemcm
Copy link
Contributor

@artemcm artemcm commented Feb 27, 2025

The algorithm already performs pairwise checks on module dependencies brought into compilation per-source-file. Previously, the algorithm considered the entire sub-graph of a given source file. Actual source compiles do not consider the full transitive module dependency set for cross-import-overlay lookup, but rather only directly-imported modules in a given source file, and '@_exported import' Swift transitive dependencies.

This change adds tracking of whether a given import statement is 'exported' to the dependency scanner and then refines the cross-import overlay lookup logic to only consider transitive modules that are exported by directly-imported dependencies.

@artemcm
Copy link
Contributor Author

artemcm commented Feb 27, 2025

@swift-ci test

@artemcm artemcm force-pushed the RefineCrossImportOverlayResolutionLogic branch from 4a2521f to 26c8f2f Compare February 27, 2025 21:58
@artemcm artemcm force-pushed the RefineCrossImportOverlayResolutionLogic branch from 26c8f2f to 886f8c8 Compare February 27, 2025 22:00
@artemcm
Copy link
Contributor Author

artemcm commented Feb 27, 2025

@swift-ci test

@@ -60,6 +60,8 @@ using IsStaticField = BCFixed<1>;
using IsForceLoadField = BCFixed<1>;
/// A bit taht indicates whether or not an import statement is optional
using IsOptionalImport = BCFixed<1>;
/// A bit taht indicates whether or not an import statement is @_exported
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's a repeated typo on taht with the lines above.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed. Tahnks!

The algorithm already performs pairwise checks on module dependencies brought into compilation per-source-file. Previously, the algorithm considered the entire sub-graph of a given source file. Actual source compiles do not consider the full transitive module dependency set for cross-import-overlay lookup, but rather only directly-imported modules in a given source file, and '@_exported import' Swift transitive dependencies.

This change adds tracking of whether a given import statement is 'exported' to the dependency scanner and then refines the cross-import overlay lookup logic to only consider transitive modules that are exported by directly-imported dependencies.
@artemcm artemcm force-pushed the RefineCrossImportOverlayResolutionLogic branch from 886f8c8 to 0555764 Compare February 27, 2025 23:48
@artemcm
Copy link
Contributor Author

artemcm commented Feb 27, 2025

@swift-ci test

@artemcm artemcm merged commit 78153f1 into swiftlang:main Feb 28, 2025
5 checks passed
@artemcm artemcm deleted the RefineCrossImportOverlayResolutionLogic branch February 28, 2025 17:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants