Skip to content

Sema: Only complain about the import when it does restrict the access level #68644

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

Conversation

xymus
Copy link
Contributor

@xymus xymus commented Sep 19, 2023

Fix the note pointing to the import when using a package type in a public declaration or inlinable code. We want a note on the import only when it actually lowers the access level of the imported decl.

The note about a package import was simply superfluous, while the same note about a public import would trigger an assert later on.

…s level

Fix the note pointing to the import when using a package type in a
public declaration or inlinable code. We want a note on the import only
when it actually lowers the access level of the imported decl.

The note about a `package import` was simply be superfluous, while the
same note about a `public import` would trigger an assert later on.
@xymus
Copy link
Contributor Author

xymus commented Sep 19, 2023

@swift-ci Please smoke test

public import PublicLib
package import PackageLib

public func publicFuncUsesPackageLevelPublicImportedType(_ a: PackageLevelPublicImportedType) {} // expected-error {{function cannot be declared public because its parameter uses a package type}}
Copy link
Contributor

Choose a reason for hiding this comment

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

It should give the same error if PublicImportType is used here right?

Copy link
Contributor Author

@xymus xymus Sep 19, 2023

Choose a reason for hiding this comment

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

PublicImportType would be ok as long as it's publicly imported. It would show the same error for PackageImportType, with the note.

@xymus xymus merged commit 5e38d06 into swiftlang:main Sep 20, 2023
@xymus xymus deleted the skip-superfluous-import-notes branch September 20, 2023 16:02
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