swiftlang / swiftlang/swift-syntax

No recovery when expecting `>` as a token prefix

Open
#1,923 2 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

### Issue Kind

Bad Diagnostic Produced

### Source Code

```swift
protocol Test {}
```

### Description

Produces the following diagnostics
```
1 │ protocol Test {}
│ ├─ error: expected '>' to end primary associated type clause
│ ╰─ error: unexpected code 'Bar>' in protocol
```

We should be consuming `Bar` as an unexpected token when looking for the closing `>` in the primary associated value clause. The tricky part is that none of our recovery infrastructure supports the recovery to a token prefix.

Came up in https://github.com/apple/swift-syntax/pull/1910#discussion_r1266001556

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.