swiftlang / swiftlang/swift-syntax

[SR-11827] Missing "in" => bad diagnostic

Open
#2,196 3 comments 0 reactions 0 assignees View on GitHub
SwiftParser
Dominant language
Swift
Stars
3.7k
Forks
553
Avg merge
5d 13h
Merged PRs (30d)
16

Description

| | |
|------------------|-----------------|
|Previous ID | SR-11827 |
|Radar | rdar://problem/57418525 |
|Original Reporter | @dabrahams |
|Type | Bug |


Additional Detail from JIRA

| | |
|------------------|-----------------|
|Votes | 0 |
|Component/s | Compiler |
|Labels | Bug |
|Assignee | None |
|Priority | Medium |

md5: 29d9832455f9840f7ae31e4c0ca0baec

**Issue Description:**

```
1> (0..<10).map { x
2. x + 1
3. }
error: repl.swift:1:10: error: cannot invoke 'map' with an argument list of type '(@escaping () -> ())'
(0..<10).map { x
^

repl.swift:1:10: note: expected an argument list of type '((Self.Element) throws -> T)'
(0..<10).map { x
^
```

I've also seen, "Contextual type for closure argument list expects 1 argument, which cannot be implicitly ignored" (small reproducer harder to generate). Either way we should have an error saying "in" is missing and a fixit to insert it.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.