Skip to content

[4.0] Treat irrefutable casts as irrefutable patterns. #9469

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
May 14, 2017

Conversation

CodaFi
Copy link
Contributor

@CodaFi CodaFi commented May 10, 2017

Explanation: Treat irrefutable casts as irrefutable patterns
Scope: Limited. Silences what were spurious warnings.
Radar/SR: Reported
Risk: Low
Testing: Regression tests included in patch

This is a cherry-pick of #9449 and #9464.

CodaFi added 2 commits May 10, 2017 12:13
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 test

@CodaFi CodaFi requested a review from jrose-apple May 11, 2017 01:11
@CodaFi
Copy link
Contributor Author

CodaFi commented May 11, 2017

@jrose-apple mind one more review for 4.0?

@jrose-apple
Copy link
Contributor

Looks good to me, but at this point a manager should probably look at it too.

@jrose-apple jrose-apple requested review from tkremenek and ematejska and removed request for jrose-apple May 11, 2017 01:23
@tkremenek
Copy link
Member

@swift-ci test source compatibility

@CodaFi
Copy link
Contributor Author

CodaFi commented May 11, 2017

Unexpected pass by Sourcery? // @lplarson

@CodaFi
Copy link
Contributor Author

CodaFi commented May 12, 2017

@swift-ci test source compatibility

@lplarson
Copy link
Contributor

I'm reviewing the expected failures.

@CodaFi
Copy link
Contributor Author

CodaFi commented May 14, 2017

@swift-ci test source compatibility

@CodaFi
Copy link
Contributor Author

CodaFi commented May 14, 2017

There we go.

Over to you @tkremenek

@tkremenek tkremenek merged commit e5015e7 into swiftlang:swift-4.0-branch May 14, 2017
@CodaFi CodaFi deleted the proof-by-handwaving branch May 14, 2017 14:33
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.

4 participants