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.
This commit is contained in:
93 files changed
+1587
-75
No files matched your search
@@ -214,3 +214,16 @@ effects []
|
||||
```
|
||||
|
||||
This checked program is `examples/std/format.aji` and `tests/conformance/source/std/fmt_example.aji`. It returns 17 without grants. Each operation preserves its own destination on short output; a sequence is not transactional across earlier successful calls. Existing alias checks apply even when a write would return short output. Smaller scalar widths require an explicit widening conversion to an appropriate writer; wider integers, float formatting and parsing are outside this increment.
|
||||
|
||||
## Copy option/result templates
|
||||
|
||||
Requires direct `import std.option;` / `import std.result;`; explicit generic spelling is spec 15 §15.
|
||||
|
||||
| Declaration | Contract |
|
||||
|---|---|
|
||||
| `std.option.Option<T: Copy>` | `some(T)`, `none` |
|
||||
| `std.option.is_some<T: Copy>(value: Option<T>) -> bool` | true for some; false for none; effects [] |
|
||||
| `std.result.Result<T: Copy, E: Copy>` | `ok(T)`, `err(E)` |
|
||||
| `std.result.is_ok<T: Copy, E: Copy>(value: Result<T, E>) -> bool` | true for ok; false for err; effects [] |
|
||||
|
||||
All are ordinary safe source/static specialization, with no allocation or authority. Generic helper calls use `is_some::<u64>(value)` / `is_ok::<u64, u8>(value)`. Constructors and patterns use `std.option.Option::<u64>::some(value)` or `std.result.Result::<u64, u8>::err(code)`; names and variant matches remain explicit even for none. Extract values by exhaustive match; an err variant is not intrinsic outcome syntax. Owners/resources/endpoints and borrows fail Copy constraints with E7005, until a separate linear-aggregate feature supplies their contracts. No must-use or implicit unwrap/default/conversion is introduced. [Checked example](../../examples/std/generics.aji) returns 42 without grants.
|
||||
Reference in new issue
Block a user