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

AST: Make sure malscoped extensions get their extended nominal computed #40082

Merged
merged 1 commit into from Nov 8, 2021

Conversation

AnthonyLatsis
Copy link
Collaborator

An extension nested inside a closure would get its extended nominal queried by name lookup before it got explicitly computed by the declaration checker, causing it to fall out of sync with the extended type. To prevent this from happening, amend getExtendedNominal() to always compute itself for extensions with an invalid parent context.

Resolves SR-15447

@AnthonyLatsis
Copy link
Collaborator Author

@swift-ci please smoke test

Copy link
Member

@slavapestov slavapestov left a comment

Choose a reason for hiding this comment

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

Thanks! This might allow other checks of canNeverBeBound() to be removed as well.

@@ -37,6 +37,19 @@ protocol NestingTest5 {
func nestingTest6() {
extension Foo {} // expected-error {{declaration is only valid at file scope}}
}
extension Array {
Copy link
Member

Choose a reason for hiding this comment

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

Might be better to put the original test case in validation-test/compiler_crashers_2_fixed/sr15447.swift.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Let's keep this one as well to spot regressions or improvements in diagnostics.

@slavapestov
Copy link
Member

@swift-ci please smoke test

@AnthonyLatsis
Copy link
Collaborator Author

@swift-ci please smoke test

@AnthonyLatsis
Copy link
Collaborator Author

@swift-ci please smoke test

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.

None yet

2 participants