Skip to content

[Sema] Report use of decls imported as non-public in inlinable code #64033

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, 2023

Conversation

xymus
Copy link
Contributor

@xymus xymus commented Mar 2, 2023

Update the exportability check to ensure that inlinable code can only refer to public types, so either local public types or public types imported publicly. As a result, we report any decl imported as non-public in inlinable code.

rdar://105902141

Inlinable code can only refer to public types, so either local public
types or public types imported publicly. Report any decl imported as
non-public in inlinable code.

rdar://105902141
@xymus xymus requested review from elsh, tshortli and beccadax March 2, 2023 18:15
@xymus
Copy link
Contributor Author

xymus commented Mar 2, 2023

@swift-ci Please smoke test

package import PackageLib // expected-note 2 {{module 'PackageLib' imported as 'package' here}}
internal import InternalLib // expected-note 12 {{module 'InternalLib' imported as 'internal' here}}
fileprivate import FileprivateLib // expected-note 6 {{module 'FileprivateLib' imported as 'fileprivate' here}}
private import PrivateLib // expected-note 6 {{module 'PrivateLib' imported as 'private' here}}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm thinking about adding the name of the affected decl to this diagnostic. While the current version works well in the terminal it may be harder to follow in an IDE when a big file is open.

@xymus xymus merged commit 517a539 into swiftlang:main Mar 3, 2023
@xymus xymus deleted the access-level-inlinable branch March 3, 2023 03: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.

1 participant