Skip to content

Sema: Ban existentials with associated types from appearing in 'switch' patterns #6244

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

Conversation

slavapestov
Copy link
Contributor

This was allowed on accident in Swift 3, and caused a build regression
with the JaySON project (https://github.com/DanToml/Jay).

…h' patterns

This was allowed on accident in Swift 3, and caused a build regression
with the JaySON project (https://github.com/DanToml/Jay).
@slavapestov
Copy link
Contributor Author

@swift-ci Please smoke test

@slavapestov
Copy link
Contributor Author

@DougGregor @jrose-apple Just to double-check, this was not intentional right?

@slavapestov
Copy link
Contributor Author

Note that we already prohibit this for if case let, which suggests it was an accident.

However I'm wondering if there's a more fundamental ASTWalker bug that's causing us to miss these -- why do we need to special-case SwitchStmt here?

@jckarter
Copy link
Contributor

Looks like a reasonable stopgap. I thought we validated checkUnsupportedProtocolType while resolving an existential TypeRef—any idea why we manage to bypass it on this path?

@slavapestov
Copy link
Contributor Author

@jckarter We do this check after because doing it while resolving types leads to recursion into validateDecl() which can crash -- the check visits all protocol members and caches the result.

@slavapestov slavapestov merged commit 0586bc6 into swiftlang:master Dec 13, 2016
@DougGregor
Copy link
Member

This was not intentional. Thank you for fixing!

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.

3 participants