google / google/xls

Confusing error message when forgetting a comma before `..` in struct

Open
#834 0 comments 0 reactions 0 assignees View on GitHub
bug dslx
Dominant language
C++
Stars
1.9k
Forks
283
Avg merge
2d 10h
Merged PRs (30d)
135

Description

Example:

```
struct S {
y: u32
}

struct T {
s: S,
x: u32,
}

fn foo(t: T) -> T {
T { s: S { y: u32:1 }
..t }
}
```

Note missing comma after ` s: S { y: u32:1 }`.

Error message:
```
0009:
0010: fn foo(t: T) -> T {
0011: T { s: S { y: u32:1 }
____________^
0012: | ..t }
|_________^ XlsTypeError: struct 'S' structure: S { y: uN[32] } vs struct 'T' structure: T { s: S { y: uN[32] }, x: uN[32] }: Range start and end types didn't match.
0013: }
0014: // #[test]
```

A better message would suggest adding a comma

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.