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-14097] Improve diagnostic for trying to bind tuple fields in lambda expression #56483

Open
typesanitizer opened this issue Jan 25, 2021 · 1 comment
Labels
compiler The Swift compiler in itself improvement

Comments

@typesanitizer
Copy link

Previous ID SR-14097
Radar rdar://problem/73554387
Original Reporter @typesanitizer
Type Improvement
Additional Detail from JIRA
Votes 0
Component/s Compiler
Labels Improvement
Assignee None
Priority Medium

md5: 60ed400fe7321e538540c2ed6bc55e02

Issue Description:

When you try to pattern match against tuple arguments, the resulting diagnostic is next to inscrutable.

let f: ((Int, Int), Int) -> Int = { (x, y), z in x }

tmp.swift:1:43: error: consecutive statements on a line must be separated by ';'
let f: ((Int, Int), Int) -> Int = { (x, y), z in x }
                                          ^
                                          ;
tmp.swift:1:43: error: expected expression
let f: ((Int, Int), Int) -> Int = { (x, y), z in x }
                                          ^
tmp.swift:1:38: error: cannot find 'x' in scope
let f: ((Int, Int), Int) -> Int = { (x, y), z in x }
                                     ^
tmp.swift:1:41: error: cannot find 'y' in scope
let f: ((Int, Int), Int) -> Int = { (x, y), z in x }
                                        ^ 

We should fix this.

Reproduces with recent main @ 21e99917142c11f

@typesanitizer
Copy link
Author

@swift-ci create

@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
compiler The Swift compiler in itself improvement
Projects
None yet
Development

No branches or pull requests

1 participant