Skip to content

Fix crash when refining protocol from a testable import #25445

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 2 commits into from
Jun 14, 2019

Conversation

slavapestov
Copy link
Contributor

We were giving protocol requirements 'open' access, which trips up other code that assumes 'open' implies its inside a class. Tighten the screws a little so that this no longer happens.

Fixes rdar://problem/51108930, https://bugs.swift.org/browse/SR-10761.

…irements

The way this predicate is used is closely intertwined with 'can have
open access'. For example, we don't want protocol requirements coming
from testable imports to have 'open' access level.
@slavapestov slavapestov requested a review from DougGregor June 14, 2019 00:36
@slavapestov
Copy link
Contributor Author

@swift-ci Please smoke test

@slavapestov
Copy link
Contributor Author

@swift-ci Please test source compatibility

@@ -7177,8 +7177,7 @@ inline bool Decl::isPotentiallyOverridable() const {
isa<SubscriptDecl>(this) ||
isa<FuncDecl>(this) ||
isa<DestructorDecl>(this)) {
return getDeclContext()->getSelfClassDecl() ||
isa<ProtocolDecl>(getDeclContext());
Copy link
Contributor

Choose a reason for hiding this comment

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

Oh. We just…didn't need the protocol case? Oh.

@slavapestov slavapestov merged commit 9993124 into swiftlang:master Jun 14, 2019
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.

2 participants