Skip to content

Access control improvements #17252

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 7 commits into from
Jun 16, 2018

Conversation

slavapestov
Copy link
Contributor

  • Check type references from 'where' clauses in protocols and associated types
  • Clean up some wording around private vs fileprivate
  • Small code cleanups

This is just landing a piece of #16586.

The various 'isExplicit' checks were wrong -- they should apply
to protocol requirements only, not protocol extension members.

Also, we weren't performing this check for type aliases in
protocols, so you would get a misleading diagnostic telling you
the type alias must be declared private/internal, when in fact
type aliases in protocols cannot have their own access control.

Finally, the "should be declared <X>" diagnostics (the
!isExplicit case) need to state the most visible access level
that will work, and in a few cases we would say private instead
of fileprivate here.
…ated types

We weren't checking this before, which would let you define a
public protocol that no public type could conform to.

This is a source-breaking change, so stage it in with a warning.
It becomes an error in -swift-version 5 mode.
@slavapestov
Copy link
Contributor Author

@swift-ci Please smoke test

@slavapestov
Copy link
Contributor Author

@swift-ci Please test source compatibility

@slavapestov slavapestov merged commit 7b91682 into swiftlang:master Jun 16, 2018
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