Skip to content

Remove @_implementationOnly annotations #225

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Merged
merged 1 commit into from
Mar 9, 2024

Conversation

marcosgriselli
Copy link
Contributor

These annotations produce warnings when compiling without library evolution using Swift ≥5.10.

Replace them by private import when compiling using Swift ≥5.11.

Mirrors swiftlang/swift-syntax#2429

Checklist

  • I've added at least one test that validates that my change is working, if appropriate
  • I've followed the code style of the rest of the project
  • I've read the Contribution Guidelines
  • I've updated the documentation if necessary

Signed-off-by: Marcos Griselli <marcosg@lyft.com>
@marcosgriselli marcosgriselli changed the title Remove @_implementationOnly annotations Remove @_implementationOnly annotations Feb 29, 2024
@marcosgriselli
Copy link
Contributor Author

@natecook1000 sorry for the ping, can we add a reviewer for this?

@LucianoPAlmeida
Copy link
Contributor

@swift-ci Please test

@natecook1000
Copy link
Member

Looks great, thanks @marcosgriselli!

@natecook1000 natecook1000 merged commit 33abb69 into apple:main Mar 9, 2024
2 checks passed
#if swift(>=5.11)
internal import RealModule
#elseif swift(>=5.10)
import RealModule

Choose a reason for hiding this comment

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

Importing RealModule without @_implementationOnly in Swift 5.10, but with @_implementationOnly in Swift 5.9 doesn't make sense to me. With @_implementationOnly the dependency is hidden from dependents entirely. Without it, the dependency is exposed to dependents. If in practice it is ok to expose the RealModule dependency to dependents (as it seems it must be) then it would be more consistent to simply remove @_implementationOnly for <= 5.10, rather than having different semantics for 5.10 and <= 5.9.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants