Skip to content

[Dependency Scanning] Remove hard failure mode (crash) during cross-import resolution #79702

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
merged 1 commit into from
Mar 3, 2025

Conversation

artemcm
Copy link
Contributor

@artemcm artemcm commented Feb 28, 2025

When failing to resolve an import to a module ID, proceed ignoring this import, instead of crashing.
Unresolved imports will be properly handled downstream in the scanner, with corresponding diagnostics.

@artemcm
Copy link
Contributor Author

artemcm commented Feb 28, 2025

@swift-ci test

@artemcm artemcm force-pushed the FixCrossImportFailureMode branch from 7ca7c4e to c56ca92 Compare February 28, 2025 19:18
@artemcm
Copy link
Contributor Author

artemcm commented Feb 28, 2025

@swift-ci test

Copy link
Contributor

@cachemeifyoucan cachemeifyoucan left a comment

Choose a reason for hiding this comment

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

LGTM in general.

@@ -1,6 +1,6 @@
// RUN: %empty-directory(%t)
// RUN: %empty-directory(%t/module-cache)
// RUN: %target-swift-frontend -scan-dependencies -module-cache-path %t/module-cache %s -o %t/deps.json -I %S/Inputs/CHeaders -I %S/Inputs/Swift -target %target-cpu-apple-macosx10.14
// RUN: %target-swift-frontend -scan-dependencies -module-cache-path %t/module-cache %s -o %t/deps.json -I %S/Inputs/CHeaders -I %S/Inputs/Swift -target %target-cpu-apple-macosx10.14 -disable-implicit-concurrency-module-import -disable-implicit-string-processing-module-import
Copy link
Contributor

Choose a reason for hiding this comment

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

Does this test mean it usually triggered from implicit imported modules? And implicit module cannot trigger cross import?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No, these implicit imports do not actually result in any cross-import overlays. The way we noticed an issue here is that implicitly-imported Concurrency module was not able to be resolved for a given target platform. And that caused there to be a hanging unresolved import, which caused the code this PR is changing to crash.

So I wanted to both address this issue and also fix the test to not have a possibility of this missing module error which is fully unrelated to what it is meant to be testing.

Copy link
Contributor

Choose a reason for hiding this comment

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

Is it possible to write a test for the failing case previously?

@artemcm artemcm force-pushed the FixCrossImportFailureMode branch from c56ca92 to 6f0bc1e Compare February 28, 2025 21:03
@artemcm
Copy link
Contributor Author

artemcm commented Feb 28, 2025

@swift-ci test

@artemcm artemcm merged commit bd67268 into swiftlang:main Mar 3, 2025
5 checks passed
@artemcm artemcm deleted the FixCrossImportFailureMode branch March 3, 2025 02:17
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