google / google/xls

Match bindings do not support typed-alias arrays name references

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

Description

Example:
```
type x31 = u15;
proc main {
x3: chan in;
x10: chan in;
config(x3: chan in, x10: chan in) {
(x3, x10)
}
init {
u31:715827882
}
next(x0: token, x1: u31) {
let x2: u31 = !(x1);
let x4: (token, u42, bool) = recv_non_blocking(x0, x3);
let x5: token = x4.0;
let x6: u42 = x4.1;
let x7: bool = x4.2;
let x8: u42 = -(x6);
let x9: u17 = (x1)[14+:u17];
let x11: (token, u56) = recv_if(x5, x10, x7);
let x12: token = x11.0;
let x13: u56 = x11.1;
let x14: bool = x4.2;
let x15: u42 = -(x6);
let x16: u42 = (x6) << (if (x9) >= (u17:0xe) { u17:0xe } else { x9 });
let x17: u42 = -(x15);
let x27: u15 = u15:0x2aaa;
let x28: u56 = (x13) * (((x2) as u56));
let x29: bool = and_reduce(x13);
let x30: bool = (x17) < (x6);
let x32: x31[2] = [x27, x27];
let x33: u42 = (x16)[x9+:u42];
let x34: u1 = u1:false;
let x35: x31 = (x32)[if (x6) >= (u42:0x0) { u42:0x0 } else { x6 }];
let x36: u43 = (x28)[x34+:u43];
let x37: x31[2] = update(x32, if (x36) >= (u43:0x0) { u43:0x0 } else { x36 }, x35);
let x38: u56 = (x13) | (((x17) as u56));
let x39: u56 = x11.1;
let x40: bool = (x14) & (((x29) as bool));
let x41: (u51, u40, u2) = match x32 {
x32 => (u51:0x5_5555_5555_5555, u40:131072, u2:0x2),
x37 => (u51:0x5_5555_5555_5555, u40:0xaa_aaaa_aaaa, u2:0x1),
_ => (u51:0x2_aaaa_aaaa_aaaa, u40:0x0, u2:0x3),
};
let x42: bool = and_reduce(x34);
let x43: u42 = (x16) / (u42:0x2aa_aaaa_aaaa);
x2
}
}
```

Error:
```
Could not find slot or binding for name: x37 @ sample.x:35:9-35:12
```

Contributor guide

Open the contributing guide

Research direction

Start by running the supplied sample.x reproducer and inspect the match-binding resolution path for the reported x37 error at line 35. The fix is complete when typed-alias array bindings resolve correctly and the example no longer reports that x37 cannot be found.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
compilers
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.