Skip to content
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

[SR-13655] "Inconsistently imported as implementation-only" diagnostic unclear #56093

Open
beccadax opened this issue Oct 5, 2020 · 3 comments
Labels
compiler The Swift compiler in itself diagnostics QoI Bug: Diagnostics Quality of Implementation improvement type checker Area → compiler: Semantic analysis

Comments

@beccadax
Copy link
Contributor

beccadax commented Oct 5, 2020

Previous ID SR-13655
Radar rdar://problem/69979002
Original Reporter @beccadax
Type Improvement
Additional Detail from JIRA
Votes 1
Component/s Compiler
Labels Improvement, DiagnosticsQoI, TypeChecker
Assignee None
Priority Medium

md5: ad3dc1f93ade7ed3d2867519b11c7d1e

Issue Description:

If some files have normal imports and others have implementation-only imports for the same module, we ignore the @_implementationOnly attribute and emit warnings about the inconsistency. However, the warnings are vague and sound like they could just be some sort of style complaint:

warning: 'SomeModule' inconsistently imported as implementation-only

These warnings should clearly indicate that we are ignoring the @_implementationOnly attribute on other import statements because of this import. Perhaps something like:

warning: other imports of 'SomeModule' will not be implementation-only because this import does not use '@_implementationOnly'

It may also make sense to customize the fix-its for this diagnostic in IDE mode—we could have one fix-it which adds @_implementationOnly wherever it's missing, and another that removes it wherever it's present.

@typesanitizer
Copy link

@swift-ci create

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
@bimawa
Copy link

bimawa commented Dec 9, 2022

Also, can we move up warning level to error? Because it is really critical moment for SPM Frameworks.

@ncooke3
Copy link

ncooke3 commented Dec 22, 2022

Hi @bimawa, in case it wasn't considered, you could try passing the -warnings-as-errors flag to surface this warning as an error. Granted, this would turn all warnings into errors, but it could still be helpful in your use case– in the event you didn't already consider this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
compiler The Swift compiler in itself diagnostics QoI Bug: Diagnostics Quality of Implementation improvement type checker Area → compiler: Semantic analysis
Projects
None yet
Development

No branches or pull requests

4 participants