Commit c5c7272
STAGE-B effect-tracking spine. Until now ctx.current_eff was declared
but never read or mutated — effect inference did nothing, and #59's
explicit motivating case ('{Partial} — short-circuit failure, ? on
Result') produced no tracking.
Root-cause, single concrete effect source for tracking-only v1:
- ExprTry with no catch arm (incl. the 'e?' desugar, parser.mly
expr_postfix QUESTION) unions Partial into ctx.current_eff; a
handled try (catch arm present) discharges it and adds nothing.
- check_fn_decl now snapshots/resets current_eff around the body,
then — only when an effect row is *explicitly declared* — requires
the inferred row ⊆ declared (Effect.eff_subset), erroring with a
new EffectNotDeclared type_error. Undeclared rows stay permissive
(tracking-only v1), so blast radius is zero: no stdlib/test uses
'?' or an explicit row.
Other effect sources (IO calls, Async) remain unconstrained for now —
deliberately scoped; this stands up the accumulate→subsume path they
will plug into, it does not fake full inference.
Tests: test/test_effects.ml — declared /{Partial}+? ok; declared
/{IO}+? rejected (#59 mismatch naming Partial); undeclared permissive;
handled try adds no Partial. Full gate 257/257 (253 + 4, no regression).
Refs #59 (left open for user joint-close per requirements-target rule).
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 0925261 commit c5c7272
3 files changed
Lines changed: 125 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
106 | 106 | | |
107 | 107 | | |
108 | 108 | | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
109 | 115 | | |
110 | 116 | | |
111 | 117 | | |
| |||
143 | 149 | | |
144 | 150 | | |
145 | 151 | | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
146 | 159 | | |
147 | 160 | | |
148 | 161 | | |
| |||
1080 | 1093 | | |
1081 | 1094 | | |
1082 | 1095 | | |
| 1096 | + | |
| 1097 | + | |
| 1098 | + | |
| 1099 | + | |
| 1100 | + | |
| 1101 | + | |
| 1102 | + | |
| 1103 | + | |
| 1104 | + | |
| 1105 | + | |
| 1106 | + | |
1083 | 1107 | | |
1084 | 1108 | | |
1085 | 1109 | | |
| |||
1514 | 1538 | | |
1515 | 1539 | | |
1516 | 1540 | | |
| 1541 | + | |
| 1542 | + | |
| 1543 | + | |
| 1544 | + | |
| 1545 | + | |
| 1546 | + | |
1517 | 1547 | | |
1518 | 1548 | | |
1519 | 1549 | | |
| |||
1528 | 1558 | | |
1529 | 1559 | | |
1530 | 1560 | | |
| 1561 | + | |
| 1562 | + | |
| 1563 | + | |
| 1564 | + | |
| 1565 | + | |
| 1566 | + | |
| 1567 | + | |
| 1568 | + | |
| 1569 | + | |
| 1570 | + | |
| 1571 | + | |
1531 | 1572 | | |
1532 | 1573 | | |
1533 | 1574 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
| 13 | + | |
13 | 14 | | |
0 commit comments