Specialize explicit function, struct and enum templates into deterministic ordinary AIR, with structural constraints and bounded expansion. Preserve source provenance and readable names in specialization diagnostics. Add Copy-only std.option/std.result and vertical specification, grammar, Quick Reference, RFC and source coverage updates. Keep linear aggregates and existing unsupported source from-returns explicit follow-up work. Repair the finite-layout check through arrays under the existing E1003 contract, with positive and rejected source/AIR fixtures. Validation: build, unit tests, 640 conformance cases, 82/82 source constructs, 32-seed generic task stress, agent-reference, formatting, hosted smoke, 20 generic and 36 package CLI checks. Record three-encoding documentation budgets; AIR reference is unchanged.
7 lines
416 B
C++
7 lines
416 B
C++
module app.lib
|
|
struct Pair<T: Copy> { value: T }
|
|
enum Maybe<T: Copy> { some(Pair<T>), none }
|
|
fn wrap<T: Copy>(value: T) -> Maybe<T> effects [] { return Maybe::<T>::some(Pair::<T> { value: value }); }
|
|
fn unwrap<T: Copy>(value: Maybe<T>) -> T effects [] { match value { Maybe::<T>::some(pair) => { return pair.value; } Maybe::<T>::none => { trap; } } }
|
|
fn identity<T: Copy>(value: T) -> T effects [] { return value; }
|