Skip to content
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-1620] Destructuring nested tuples in closure arguments #44229

Open
mbrandonw opened this issue May 25, 2016 · 1 comment
Open

[SR-1620] Destructuring nested tuples in closure arguments #44229

mbrandonw opened this issue May 25, 2016 · 1 comment
Assignees
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. compiler The Swift compiler in itself feature A feature request or implementation

Comments

@mbrandonw
Copy link
Contributor

Previous ID SR-1620
Radar rdar://problem/28449788
Original Reporter @mbrandonw
Type Bug
Additional Detail from JIRA
Votes 1
Component/s Compiler
Labels Bug, LanguageFeatureRequest
Assignee @xedin
Priority Medium

md5: 0b85283bd463cac1ff681552724c2a42

relates to:

  • SR-2135 Multiple Tuple Parameters to a Closure cannot be Decomposed in the Parameter List
  • SR-4738 Can not decompose nested tuple in closure arguments

Issue Description:

This currently doesn't compile:

[(1, 2), (2, 3), (3, 4)].reduce(0) { (accum, (first, second)) in 
  accum + first + second 
}

Instead one has to do

[(1, 2), (2, 3), (3, 4)].reduce(0) { (accum, firstSecond) in
  accum + firstSecond.0 + firstSecond.1
}

Destructuring of tuples is supported in direct use though:

let (a, (b, c)) = (1, (2, 3))

Should this be supported?

@belkadan
Copy link
Contributor

This would have to go through the Swift Evolution Process.

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. compiler The Swift compiler in itself feature A feature request or implementation
Projects
None yet
Development

No branches or pull requests

2 participants