google / google/xls

Apparent parser sensitivity to the positioning of parametric impls

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

Description

Using this modified code example from a test in a pending type_system_v2 change:

```
struct S {}
struct T {}

fn f() -> u32 { N + 1 }

impl S {
const N_PLUS_1_VALUE = f();
}

impl T {
const N_PLUS_2_VALUE = f<{S::N_PLUS_1_VALUE}>();
}
```

When parsing the S impl, the parser appears to deal out a NameRef to N which points to the binding NameDef in T. However, if you move the S impl to immediately after the counterpart struct, it does the right thing.

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.