Skip to content

Short circuit subspace check with empty subjects #9464

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 1 commit into from
May 10, 2017

Conversation

CodaFi
Copy link
Contributor

@CodaFi CodaFi commented May 10, 2017

This is the flip side of #9449. Refutable patterns followed by patterns that do not explicitly match a payload were passing through the isSubspace check. Short-circuit when this happens to correctly identify this kind of structure.

When determining whether one constructor pattern is a subspace of
another, we only checked if the right-hand subspace was larger than the
left.  If the left is larger than the right then we can short-circuit
the comparison once more because it cannot be a subspace.

This also takes care of refutable casts in patterns tripping the
duplicate case warning.
@CodaFi
Copy link
Contributor Author

CodaFi commented May 10, 2017

@swift-ci please smoke test and merge

@swift-ci swift-ci merged commit 5bd3428 into swiftlang:master May 10, 2017
@CodaFi CodaFi deleted the type-cast branch May 10, 2017 19:20
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