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.
14 lines
376 B
Rust
14 lines
376 B
Rust
// expect: run
|
|
// result: 42
|
|
// phase: 6
|
|
// spec: docs/spec/15-source-language.md §5
|
|
module test.field_len
|
|
struct Header { len: u32 }
|
|
fn make(count: mut<u32>) -> Header effects [] { *count = *count + 1; return Header { len: 42u32 }; }
|
|
fn main() -> u32 effects [] {
|
|
var count: u32 = 0;
|
|
let answer = make(mut count).len;
|
|
assert(count == 1u32);
|
|
return answer;
|
|
}
|