Skip to content

[6.0][ScanDependencies] Make sure canImport resolution agrees with import #74519

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

Conversation

cachemeifyoucan
Copy link
Contributor

Explanation: Fix a problem where the error of cannot import module can be confusing when the only module can be found is an invalid/out-of-date swift binary module because canImport and import can have different views on if the module can be import or not.
Scope: Provide a better error message to help user understand the failure in such case and canImport will be evaluated to false when the "module" found is invalid.
Issue: rdar://128876895
Original PR: #74199
Risk: Low
Test: Unit Test
Reviewer: @artemcm

Fix the problem that when the only module can be found is an
invalid/out-of-date swift binary module, canImport and import statement
can have different view for if the module can be imported or not.

Now canImport will evaluate to false if the only module can be found for
name is an invalid swiftmodule, with a warning with the path to the
module so users will not be surprised by such behavior.

rdar://128876895
(cherry picked from commit 7d85aa4)
@cachemeifyoucan cachemeifyoucan requested a review from a team as a code owner June 18, 2024 16:21
@cachemeifyoucan
Copy link
Contributor Author

@swift-ci please test

Copy link
Contributor

@nkcsgexi nkcsgexi left a comment

Choose a reason for hiding this comment

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

Thank you for fixing this, Steven!

cachemeifyoucan added a commit to swiftlang/swift-package-manager that referenced this pull request Jun 18, 2024
#7647) (#7678)

Explanation: This is a test-only change to allow for `canImport` change
swiftlang/swift#74519
Scope: Test only. Update a test that relies on an invalid module as test
input. Replace that with a swiftinterface.
Original PR: #7647
Test: Unit-Test
Reviewer: @tshortli
@cachemeifyoucan
Copy link
Contributor Author

@swift-ci please test

@cachemeifyoucan cachemeifyoucan merged commit bdb63ed into swiftlang:release/6.0 Jun 20, 2024
5 checks passed
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