cli: resolve struct len fields by receiver type
Use ordinary field lowering and declared field types for nominal receivers while preserving array and slice lengths. Make array field type hints available to chained access. Missing struct len now reports E7002 instead of the builtin-length E7005. Add 15 source regressions and imported generic CLI checks. Unit tests, all 1201 conformance cases, per-instruction collection for new cases, formatter corpus and original public check/lower compatibility pass.
This commit is contained in:
1 parent
184cb7b321
commit
1495650587
18 files changed
+244
-4
No files matched your search
@@ -0,0 +1,18 @@
|
||||
// expect: run
|
||||
// result: 42
|
||||
// phase: 6
|
||||
// spec: docs/spec/15-source-language.md §5
|
||||
module test.field_len
|
||||
struct Header { len: u32 }
|
||||
fn read(s: slice<Header>, i: usize) -> u32 effects [] {
|
||||
assert(s.len == 2usize);
|
||||
if i < s.len { return s[i].len; }
|
||||
return 0u32;
|
||||
}
|
||||
fn main() -> u32 effects [] {
|
||||
var data: [Header; 2] = [Header { len: 40u32 }, Header { len: 42u32 }];
|
||||
assert(data.len == 2usize);
|
||||
{ ref r = data; assert(r.len == 2usize); }
|
||||
{ mut s = data[0..2]; assert(s.len == 2usize); s[1].len = s[0].len + 2; }
|
||||
return read(ref data[0..2], 1usize);
|
||||
}
|
||||
Reference in new issue
Block a user