P6A-11, P6A-12: malformed lowering is an internal compiler error; source type-check completeness
P6A-11: when a .aji module passed the frontend but its AIR does not parse (E0001-E0005) or has invalid SSA/CFG (E5001, E5002), the result is one E7900 source.internal_compiler_error at the source construct, with the AIR code in air_code; semantic codes (E0006 included) are unaffected. Unit test injects the checkpoint's `ret %` defect. P6A-12: source-decidable type errors are E7005 at the source: - `as` checks lossless widening with the verifier's own rule (shared function), and that both sides are integers - slice.copy element types; own.free / region.destroy operand types - element rules of channel.make<T> and mutex.make (no borrow, scope, task, shield or guard, at any depth) Probing every source position found no other E1001/E1002 leak. The old test encoding the previous rule (verifier_widen, E1002) is replaced by typecheck/lossy_widen (E7005); 9 typecheck tests. Spec 15 §10 states the frontend/verifier boundary.
This commit is contained in:
1 parent
154c39865f
commit
748eddf4e5
16 files changed
+249
-14
No files matched your search
@@ -33,8 +33,8 @@ Targets and the evaluation order are in `README.md`. Phase 6A is specified by RF
|
||||
| P6A-8 | done | Source Reference Bundle (directory, `QUICK.md` front door, AIR reference only under `air/`), harness profile `aji_source` with per-group documentation metrics, Quick Reference examples checked against conformance programs, raw and normalized size metrics | P6A-6 | `docs/agent/source-bundle.txt`, `tools/eval/languages/aji_source.json` | bundle measured; every Quick Reference example is an excerpt of a checked program |
|
||||
| P6A-9 | todo | Dev regression on tasks M and C: the frozen `Aji/AIR` runs vs new `Aji/source` runs, same agents (all three native agents) | P6A-8 | results note | criteria below reported |
|
||||
| P6A-10 | todo | Phase 6A exit review | all | plan status | targets reported |
|
||||
| P6A-12 | todo | Source type-check completeness: errors fully determined by the source type system are reported by the frontend as `E7xxx` at the source construct, never left to the verifier on the lowered AIR (checkpoint 2: `E1001` ×4 in a source run). Not a layer 7 blocker; to be closed before the Phase 6A freeze | P6A-4 | `src/frontend/lower.zig` | for each verifier type rule reachable from source, a source test expecting the `E7xxx` |
|
||||
| P6A-11 | todo | Malformed generated AIR is a compiler bug: when a `.aji` module passed the frontend but its AIR fails to parse or is structurally invalid, report an internal compiler diagnostic (with the source construct), not the AIR parse error mapped back (found by the M checkpoint: void fall-through lowered to `ret %`) | P6A-4 | `src/check.zig`, error registry | a test that injects malformed lowering gets the internal diagnostic |
|
||||
| P6A-12 | done | Source type-check completeness: errors fully determined by the source type system are reported by the frontend as `E7xxx` at the source construct, never left to the verifier on the lowered AIR (checkpoint 2: `E1001` ×4 in a source run). Not a layer 7 blocker; to be closed before the Phase 6A freeze | P6A-4 | `src/frontend/lower.zig` | for each verifier type rule reachable from source, a source test expecting the `E7xxx` |
|
||||
| P6A-11 | done | Malformed generated AIR is a compiler bug: when a `.aji` module passed the frontend but its AIR fails to parse or is structurally invalid, report an internal compiler diagnostic (with the source construct), not the AIR parse error mapped back (found by the M checkpoint: void fall-through lowered to `ret %`) | P6A-4 | `src/check.zig`, error registry | a test that injects malformed lowering gets the internal diagnostic |
|
||||
|
||||
### P6A-9 criteria (owner decision, fixed before the runs)
|
||||
|
||||
|
||||
@@ -91,6 +91,7 @@ Only problems that exist because of the frontend. Everything the verifier decide
|
||||
| E7005 | source.type_mismatch | Expression has the wrong type in a source position |
|
||||
| E7006 | source.invalid_construct | Construct not allowed here |
|
||||
| E7007 | source.ambiguous | Source meaning cannot be determined |
|
||||
| E7900 | source.internal_compiler_error | The frontend produced invalid AIR for this construct: a compiler bug, not a program error; fields `air_code`, `air_message` |
|
||||
|
||||
## T0xxx — Runtime traps
|
||||
|
||||
|
||||
@@ -360,8 +360,31 @@ A byte string or array used where a `slice<u8>` is expected is materialized in f
|
||||
| found by the verifier on the lowered AIR | the AIR code; the diagnostic's `file`, `line` and `col` are the source location of the construct the instruction came from, and `air_line`/`air_col` locate it in the lowered AIR (`aji lower`); the verifier's own fields (`function`, `block`, `inst`) are kept |
|
||||
| syntax, name resolution, lowering and invalid source constructs | `E7xxx`, below |
|
||||
| several AIR instructions of one construct reporting the same code | one diagnostic (the first) per code and source location |
|
||||
| the lowered AIR is malformed: a parse error (`E0001`–`E0005`) or invalid SSA or CFG (`E5001`, `E5002`) | `E7900` (`source.internal_compiler_error`) at the source construct, with the AIR code in `air_code`. It is a compiler bug, never an error in the program, and replaces every other diagnostic of the module. Semantic codes (ownership, borrows, resources, effects, capabilities, concurrency, `E0006`) are not affected |
|
||||
| trap at run time | the trap record also carries `source_location` (`file`, `line`, `col`) |
|
||||
|
||||
**Which errors the frontend reports.** An error that is fully decided by source types is `E7005` (or another `E7xxx`) at the source construct, and never reaches the verifier as `E1001`/`E1002`. The frontend checks:
|
||||
|
||||
- the types of expressions, operands and results;
|
||||
- arity and argument types of functions and built-in operations;
|
||||
- the existence of fields and variants;
|
||||
- `ref`/`mut` compatibility;
|
||||
- lossless widening by `as` (the verifier's own rule);
|
||||
- slice element types of `slice.copy`;
|
||||
- the element rules of channels and mutexes (no borrow, scope, task, shield or guard).
|
||||
|
||||
The verifier remains the authority for:
|
||||
|
||||
- ownership state, linearity and moves;
|
||||
- borrow conflicts and lifetimes;
|
||||
- resource state;
|
||||
- effects and capabilities;
|
||||
- concurrency (loans, `Send`/`Share`, the critical-section rule);
|
||||
- reserved features;
|
||||
- every other verifier invariant.
|
||||
|
||||
Its diagnostics keep their AIR codes, reported at the source location.
|
||||
|
||||
| Code | Kind | Meaning |
|
||||
|---|---|---|
|
||||
| E7001 | source.syntax | Malformed `.aji` source |
|
||||
@@ -371,6 +394,7 @@ A byte string or array used where a `slice<u8>` is expected is materialized in f
|
||||
| E7005 | source.type_mismatch | Expression has the wrong type in a source position |
|
||||
| E7006 | source.invalid_construct | Construct not allowed here (e.g. `break` outside a loop, `move` of a non-linear value, `zero` for a non-zeroable type) |
|
||||
| E7007 | source.ambiguous | Source meaning cannot be determined (e.g. an integer literal with no type from context) |
|
||||
| E7900 | source.internal_compiler_error | The frontend produced invalid AIR for this construct (a compiler bug, not a program error) |
|
||||
|
||||
## 11. Tooling
|
||||
|
||||
|
||||
Reference in new issue
Block a user