|
1 | | -# A7 Compiler — Missing Features Snapshot |
| 1 | +# A7 Compiler — Language-Core Gap Snapshot |
2 | 2 |
|
3 | | -**Compiler Status**: Full pipeline runs (Tokenizer → Parser → Semantic → Preprocessor → Zig Codegen). |
4 | | -**Current Test Status** (`PYTHONPATH=. uv run pytest`, 2026-02-21): **1039 passed, 7 failed, 0 skipped**. |
| 3 | +**Compiler Status**: Full pipeline runs (Tokenizer -> Parser -> Semantic -> Preprocessor -> Codegen). |
| 4 | +**Current Test Status** (`PYTHONPATH=. uv run pytest -q`, 2026-02-24): **1067 passed, 0 failed, 0 skipped**. |
5 | 5 | **Examples**: 36/36 pass end-to-end compile + build + run + output verification. |
6 | 6 |
|
7 | 7 | --- |
8 | 8 |
|
9 | | -## Newly Unskipped Semantic Gaps |
10 | | - |
11 | | -The 9 previously skipped semantic tests were unskipped. Two now pass; seven fail and define the current missing work. Those failures collapse into six implementation areas below. |
12 | | - |
13 | | -1. **Match expressions are parsed but not type-checked** |
14 | | - - Failing test: `test/test_semantic_control_flow.py:434` |
15 | | - - Current error: `Unknown expression kind: NodeKind.MATCH_EXPR` |
16 | | - - Needed: |
17 | | - - Add `MATCH_EXPR` handling in `TypeCheckingPass._visit_expression_impl`. |
18 | | - - Type-check each case arm expression and `else` expression. |
19 | | - - Enforce arm type compatibility and return unified expression type. |
20 | | - |
21 | | -2. **`@type_set(...)` in value context does not parse correctly** |
22 | | - - Failing test: `test/test_semantic_generics.py:159` |
23 | | - - Current error: `Expected expression` at first type argument token (`i8`). |
24 | | - - Needed: |
25 | | - - Treat `@type_set` as a type-taking builtin when parsed as expression, or |
26 | | - - Parse `@type_set(...)` declarations through a dedicated type-set declaration path. |
27 | | - |
28 | | -3. **Generic arithmetic in function bodies is too strict without constraint flow** |
29 | | - - Failing test: `test/test_semantic_generics.py:176` |
30 | | - - Current error: `Requires numeric type` for `$T * 2`. |
31 | | - - Needed: |
32 | | - - Propagate generic constraints (or inferred concrete type bindings) into expression checking. |
33 | | - - Allow arithmetic when `$T` is known numeric by constraint or call-site inference. |
34 | | - |
35 | | -4. **Generic struct literal field checks do not substitute type arguments** |
36 | | - - Failing test: `test/test_semantic_generics.py:248` |
37 | | - - Current error: `Type mismatch: expected '$T', got 'i32'`. |
38 | | - - Needed: |
39 | | - - Instantiate/substitute struct field types for `Pair(i32, string){...}` before field validation. |
40 | | - |
41 | | -5. **Field access on generic struct instances is unresolved** |
42 | | - - Failing tests: |
43 | | - - `test/test_semantic_generics.py:263` |
44 | | - - `test/test_semantic_generics.py:434` |
45 | | - - Current error: `Cannot access field on non-struct type: got 'Box(i32)'` / `Node(i32)`. |
46 | | - - Needed: |
47 | | - - Resolve `GenericInstanceType` to concrete `StructType` during field access. |
48 | | - - Support recursive generic instantiation safely (cycle-aware resolution for recursive types). |
49 | | - |
50 | | -6. **Literal initialization for generic locals lacks inference/coercion** |
51 | | - - Failing test: `test/test_semantic_generics.py:311` |
52 | | - - Current error: `Type mismatch: expected '$T', got 'i32'` for `total: $T = 0`. |
53 | | - - Needed: |
54 | | - - Permit numeric literal initialization for generic numeric variables, or |
55 | | - - Specialize generic function body typing from call-site type mapping before local checks. |
| 9 | +## Recently Completed (Language Core) |
| 10 | + |
| 11 | +1. `match` expressions are type-checked and participate in expression typing. |
| 12 | +2. `@type_set(...)` parses in value context. |
| 13 | +3. Generic arithmetic and generic local literal initialization are relaxed where valid. |
| 14 | +4. Generic struct literal field checks substitute concrete type arguments. |
| 15 | +5. Field access resolves concrete struct layout for generic instances. |
| 16 | +6. Match semantics now enforce: |
| 17 | + - pattern type compatibility with the scrutinee, |
| 18 | + - bool/enum exhaustiveness (or explicit `else` / wildcard), |
| 19 | + - wildcard pattern parsing (`case _:`), |
| 20 | + - return-path correctness for exhaustive enum/bool `match` without `else`. |
| 21 | + |
| 22 | +--- |
| 23 | + |
| 24 | +## Remaining Language-First Gaps |
| 25 | + |
| 26 | +1. **`fall` statement semantics** |
| 27 | + - `fall` is parsed (`NodeKind.FALL`) but not yet validated or lowered in semantic/codegen passes. |
| 28 | + |
| 29 | +2. **Advanced match diagnostics** |
| 30 | + - No overlap/redundancy diagnostics for case patterns. |
| 31 | + - No unreachable-branch detection for wildcard-first or fully-covered prior patterns. |
| 32 | + |
| 33 | +3. **Memory/lifetime model** |
| 34 | + - Current validation covers basic `del` reference checks. |
| 35 | + - Ownership/borrow-style lifetime guarantees are not implemented. |
| 36 | + |
| 37 | +4. **Generic constraint internals** |
| 38 | + - Inline type-set constraint resolution in `src/generics.py` is still placeholder-level (`resolve_generic_constraint`). |
| 39 | + |
| 40 | +5. **Backend semantic parity hardening** |
| 41 | + - Core conformance is green, but differential/backend-equivalence checks should be expanded and kept mandatory for new language features. |
56 | 42 |
|
57 | 43 | --- |
58 | 44 |
|
59 | | -## Deferred (Still Planned) |
| 45 | +## Out of Scope for This Snapshot |
60 | 46 |
|
61 | | -1. Labeled loops (`outer: for ...`) with syntax disambiguation. |
62 | | -2. Array-programming stdlib (tensor/broadcast/linear algebra features). |
63 | | -3. Alternative backends (C/native) using `src/backends/base.py`. |
| 47 | +- Package ecosystem, registry/distribution workflows, and broader tooling are intentionally secondary to language-core correctness. |
0 commit comments