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.
15 lines
383 B
Rust
15 lines
383 B
Rust
// expect: run
|
|
// trap: T0008
|
|
// phase: 6
|
|
// spec: docs/spec/15-source-language.md §5
|
|
module test.field_len
|
|
struct Header { len: usize }
|
|
fn read(s: slice<u64>, h: Header, i: usize) -> u64 effects [] {
|
|
if i < h.len { return s[i]; }
|
|
return 0;
|
|
}
|
|
fn main() -> u64 effects [] {
|
|
var data: [u64; 1] = [42u64];
|
|
return read(ref data[0..1], Header { len: 2usize }, 1usize);
|
|
}
|