-
Notifications
You must be signed in to change notification settings - Fork 10.5k
Fix issue with expression patterns in switch exhaustivity checking #23804
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
@swift-ci Please test |
@swift-ci Please test source compatibility |
@@ -1448,6 +1449,8 @@ namespace { | |||
} | |||
} else if (SP->getKind() == PatternKind::Tuple) { | |||
Space argTupleSpace = projectPattern(TC, SP); | |||
if (argTupleSpace.isEmpty()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Short comment here please.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Same source compat failures seen elsewhere. @rintaro (current Apple build czar), do we have bugs tracking these? |
Expression patterns (and cast patterns) don't actually contribute to the exhaustivity of a switch statement---if you're matching against a String, matching "abc" doesn't meaningfully reduce the full space of the values you have to match. This was already handled, but didn't do the right thing in a particular case involving a tuple payload in an enum after the Space Engine (exhaustivity checker) optimizations that went out in Swift 5. https://bugs.swift.org/browse/SR-10301
68faabe
to
2caa4ee
Compare
@swift-ci Please smoke test |
Yes. rdar://problem/49610988 |
…wiftlang#23804) Expression patterns (and cast patterns) don't actually contribute to the exhaustivity of a switch statement---if you're matching against a String, matching "abc" doesn't meaningfully reduce the full space of the values you have to match. This was already handled, but didn't do the right thing in a particular case involving a tuple payload in an enum after the Space Engine (exhaustivity checker) optimizations that went out in Swift 5. https://bugs.swift.org/browse/SR-10301 (cherry picked from commit d36a739)
Expression patterns (and cast patterns) don't actually contribute to the exhaustivity of a switch statement—if you're matching against a String, matching "abc" doesn't meaningfully reduce the full space of the values you have to match. This was already handled, but didn't do the right thing in a particular case involving a tuple payload in an enum after the Space Engine (exhaustivity checker) optimizations that went out in Swift 5.
SR-10301 / rdar://problem/49609445