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

Incorrect error about missing bracket in for await case let loop #1974

Open
bbrk24 opened this issue Feb 10, 2025 · 0 comments
Open

Incorrect error about missing bracket in for await case let loop #1974

bbrk24 opened this issue Feb 10, 2025 · 0 comments
Labels

Comments

@bbrk24
Copy link

bbrk24 commented Feb 10, 2025

I got an error about a missing { on line 59 of a file. The relevant excerpt is

/*56*/       var responses: [Int: CalculatedResult] = [:]
/*57*/       for await case let (index, result)? in group {
/*58*/           responses[index] = result
/*59*/       }
/*60*/       return responses

I was initially baffled by the error, but then I figured that maybe it's confused by the for await case let. And indeed, rewriting it to not have that keyword string fixes it -- the following code gives no errors:

            var responses: [Int: CalculatedResult] = [:]
            for await thing in group {
                if let (index, result) = thing {
                    responses[index] = result
                }
            }
            return responses
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants