Skip to content

[5.9] Limit loading error when importing a module with package name built from interface #65854

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 2 commits into from
May 23, 2023

Conversation

elsh
Copy link
Contributor

@elsh elsh commented May 11, 2023

Cherry-pick of #65481 & #65855

Explanation: Previously a diagnostic was added to show an error when loading a module with package name if it was built from interface. It was expected if the file being built is a .swift file. If it's an interface, however, it should not throw an error (since interface files do not contain package symbols unless inlinable or usableFromInline). The change in this PR adds the check and was previously merged to main (Ref: rdar://108633068). This PR needs to be in 5.9 as it happens to fix a blocker for adoption of the package access modifier: the error occurs during a build that runs api-digester which treats the source as an interface, leading to a build failure.

Scope: Unblocks building Swift projects containing package access modifier that run api-digester.
Issue: rdar://108945440
Risk: Low. The change is minimal as it checks the source kind before throwing an error.
Testing: Tests were added to ensure that it does not throw an error if the source kind is interface.
Reviewer: @xymus @tshortli @nkcsgexi

…has package-name.

This disallows building an interface file that imports such module which should be allowed
since interface does not contain package symbols unless usableFromInline or inlinable.
This change limits erroring only when building a .swift file.

Resolves rdar://108633068
@elsh elsh requested a review from a team as a code owner May 11, 2023 09:24
@elsh
Copy link
Contributor Author

elsh commented May 11, 2023

#65481 & #65855 merged in main

@elsh
Copy link
Contributor Author

elsh commented May 11, 2023

@swift-ci smoke test

@elsh elsh force-pushed the es-rel-interface branch from 03c8461 to 92cb05b Compare May 11, 2023 22:56
@elsh
Copy link
Contributor Author

elsh commented May 11, 2023

@swift-ci smoke test

@elsh elsh force-pushed the es-rel-interface branch 2 times, most recently from 213b117 to 192a97d Compare May 11, 2023 23:03
Copy link
Contributor

@xymus xymus left a comment

Choose a reason for hiding this comment

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

It looks good!

@elsh
Copy link
Contributor Author

elsh commented May 11, 2023

@swift-ci smoke 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, Ellie!

@elsh elsh force-pushed the es-rel-interface branch from 192a97d to fb9cdc7 Compare May 11, 2023 23:42
@elsh elsh force-pushed the es-rel-interface branch from fb9cdc7 to ffa6ebd Compare May 11, 2023 23:58
@elsh
Copy link
Contributor Author

elsh commented May 12, 2023

@swift-ci smoke test

1 similar comment
@elsh
Copy link
Contributor Author

elsh commented May 12, 2023

@swift-ci smoke test

@elsh
Copy link
Contributor Author

elsh commented May 14, 2023

@swift-ci test

@elsh elsh merged commit 5bf8f62 into release/5.9 May 23, 2023
@elsh elsh deleted the es-rel-interface branch May 23, 2023 20:01
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.

3 participants