Files
aji/tests/conformance/source/generics/std_option_result.aji
T
dev 7eea31518d cli: add explicit source generics and Copy option/result
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.
2026-10-06 19:53:26 +03:00

24 lines
923 B
Rust

// expect: run
// result: 42
// phase: 6
// spec: docs/spec/15-source-language.md §15
module demo.generic
import std.option;
import std.result;
fn main() -> u64 effects [] {
let absent = std.option.Option::<u8>::none;
assert(not std.option.is_some::<u8>(absent));
let present: std.option.Option<u64> = std.option.Option::<u64>::some(42);
assert(std.option.is_some::<u64>(present));
let failure = std.result.Result::<u64, u8>::err(7);
assert(not std.result.is_ok::<u64, u8>(failure));
match present {
std.option.Option::<u64>::some(value) => {
let success = std.result.Result::<u64, u8>::ok(value);
assert(std.result.is_ok::<u64, u8>(success));
match success { std.result.Result::<u64, u8>::ok(n) => { return n; } std.result.Result::<u64, u8>::err(e) => { return e as u64; } }
}
std.option.Option::<u64>::none => { return 0; }
}
}