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
[SR-8253] Catch clause should allow multiple patterns #50785
Comments
@swift-ci create |
Series of catch blocks are already mostly treated analogously to case labels in a switch, so hopefully this is a matter of extending the parser to accept comma-delimited lists of patterns and form the appropriate `CaseLabel` AST in response. |
This does seem like it ought to be a simple addition. It needs Evolution sign-off, but I'd expect that to be as close to a rubber-stamp as language proposals ever get. |
Thanks for weighing in! Unless somebody else gets to it first, I can look into starting a pitch thread later this week. |
I created a pitch thread: https://forums.swift.org/t/allow-multiple-patterns-in-catch-clauses/14637. |
Owen Voorhees has authored a proposal for this that’s now in review: https://github.com/apple/swift-evolution/blob/master/proposals/0276-multi-pattern-catch-clauses.md |
Comment by Jason R Tibbetts (JIRA) The proposal was accepted and this was released in version 5.3. Can this ticket be closed? |
Looks good to me, marking as resolved! |
Attachment: Download
Environment
Swift 4.2, Xcode Version 10.0 beta 3 (10L201y)
Additional Detail from JIRA
md5: b4c86fd321a914b3b953049c7ef2f1c9
Issue Description:
I was surprised to find that the
catch
clause doesn't accept the same patterns that cases in aswitch
do. This fails to compile:I've attached a playground that reproduces the issue.
The text was updated successfully, but these errors were encountered: