Commit 660519e
## Summary
Unbreaks main's `dune runtest` gate — root cause of the 2-test failure
baseline that's been red since #334 merged.
## Root cause
`eval_decl`'s `TopFn fd` arm matched `fd.fd_body` against only `FnBlock`
and `FnExpr`, leaving `FnExtern` unmatched. Every prior interp test
imported externs via `use effects::{…}` so this case never fired — the
bug was latent.
The STDLIB-04a (#328) hermetic tests are the **first** to include an
inline `extern fn make_ref<T>(x: T) -> Ref<T> / Mut;` declaration in the
source they hand to `Interp.eval_program`. That triggers the missing arm
and raises:
```
File "lib/interp.ml", line 1010, characters 16-21: Pattern matching failed
Raised at Affinescript__Interp.eval_decl
```
Reproduces the `2 failures! in 0.088s. 298 tests run.` line from every
PR's `build` log since #334.
## Fix
Wrap the body lowering in an outer `match fd.fd_body with`:
- `FnExtern` → `Ok env` (externs are runtime-bound via
`create_initial_env`'s `VBuiltin` table — `panic` / `error` / `make_ref`
/ `get` / `set` / etc., not via the AST).
- `FnBlock _ | FnExpr _` → existing closure construction.
The inner inner-match's `FnExtern` arm is `assert false` with a comment
— it's unreachable per the outer guard and the assert makes that
explicit for the next reader.
## Verification
The two failing tests (`#328 make_ref/set/get round-trip (Int)` and
`(String)`) now have a defined evaluation path. The third 04a test (Deno
codegen `__cell` shape) already passed — it bypasses interp.
## Test plan
- [ ] CI `build` job: `2 failures!` → `298 tests run` clean
- [ ] CI `lint`: should also clear (was likely propagating from the same
root)
- [ ] Hypatia DOC-FORMAT: no `.md` introduced
Refs #328.
---
_Generated by [Claude
Code](https://claude.ai/code/session_01NUHL3MH3yKKQAEhSZn4Thu)_
Co-authored-by: Claude <noreply@anthropic.com>
1 parent d4522e4 commit 660519e
1 file changed
Lines changed: 19 additions & 8 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1027 | 1027 | | |
1028 | 1028 | | |
1029 | 1029 | | |
1030 | | - | |
1031 | | - | |
1032 | | - | |
1033 | | - | |
1034 | | - | |
1035 | | - | |
1036 | | - | |
1037 | | - | |
| 1030 | + | |
| 1031 | + | |
| 1032 | + | |
| 1033 | + | |
| 1034 | + | |
| 1035 | + | |
| 1036 | + | |
| 1037 | + | |
| 1038 | + | |
| 1039 | + | |
| 1040 | + | |
| 1041 | + | |
| 1042 | + | |
| 1043 | + | |
| 1044 | + | |
| 1045 | + | |
| 1046 | + | |
| 1047 | + | |
| 1048 | + | |
1038 | 1049 | | |
1039 | 1050 | | |
1040 | 1051 | | |
| |||
0 commit comments