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
419 B
Rust
14 lines
419 B
Rust
// expect: run
|
|
// result: 42
|
|
// phase: 6
|
|
// spec: docs/spec/15-source-language.md §5
|
|
module test.field_len
|
|
struct Field<T: Copy> { len: T }
|
|
fn read<T: Copy>(f: ref<Field<T>>) -> T effects [] { return f.len; }
|
|
fn main() -> u32 effects [] {
|
|
var f: Field<u32> = Field::<u32> { len: 42u32 };
|
|
var flag: Field<bool> = Field::<bool> { len: true };
|
|
assert(read::<bool>(ref flag));
|
|
return read::<u32>(ref f);
|
|
}
|