Commit cb9704a
Closes #415. Stdlib roadmap item #5 (`docs/stdlib-roadmap.adoc`).
## TL;DR
The original framing of stdlib #5 was *"cross-file \`use\` resolvability
from standalone check"*. Reproducing the bug turned up something
different: cross-module \`use\` **already works** (both \`use
Deno::{Json}\` and \`use prelude::*\` resolve fine from a standalone
single-file check).
What actually trips users is **discoverability** — prelude is NOT
auto-opened (deliberate, per issue #138), and the error when an
unimported \`Some\` is referenced was a raw OCaml record dump with no
hint about the fix.
## Before / after
**Before:**
\`\`\`
Resolution error: (Resolve.UndefinedVariable
{ Ast.name = "Some";
span = { Span.start_pos = { Span.line = 1; col = 37; ... }; ... }
})
\`\`\`
**After:**
\`\`\`
Resolution error: undefined value: \`Some\`
hint: \`Some\` is defined in \`stdlib/prelude.affine\` — add
\`use prelude::{Some};\` (or \`use prelude::*;\`) at the top of the
file.
\`\`\`
## Files
| File | Change |
|---|---|
| \`lib/face.ml\` | Canonical face: replace \`show_resolve_error\` dump
with full per-error-class formatter; add \`prelude_hint\` for
UndefinedVariable + UndefinedType |
| \`lib/typecheck.ml\` | Add same \`prelude_hint\` on
\`UnboundVariable\` (typecheck-time path; fires for match arms whose
constructor reference the resolver missed) |
## What this does NOT do
- Does NOT auto-import prelude (that would revert issue #138 which
intentionally removed the band-aid)
- Does NOT change resolve behaviour at all — only the error message
- Does NOT touch the other faces (Python / Js / Pseudocode / Lucid /
Cafe) — they already had their own formatted hints; just Canonical was
raw-dumping
## Test plan
- [x] codegen-deno suite: 7/7 harnesses green (no behaviour change)
- [x] Manual: idaptik PR #107's case (missing \`Some\`) now shows the
hint
- [x] Manual: non-prelude names (e.g. \`nonexistentFn\`) still get a
clean error with NO inappropriate prelude hint
- [x] \`dune build bin/main.exe\` clean
- [x] \`dune build @runtest\` — 340/342 pass; the 2 failures are
pre-existing E2E Node-CJS Codegen baseline flakes (CLAUDE.md
"Known-failing baseline checks"), unchanged by this PR
## Follow-ups
Once this lands, a follow-up PR updates \`docs/stdlib-roadmap.adoc\` row
#5 status \`◑\` partial → \`●\` usable (kept out of this PR so the diff
stays focused on the diagnostic itself).
🤖 Generated with [Claude Code](https://claude.com/claude-code)
---------
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 263be56 commit cb9704a
2 files changed
Lines changed: 61 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
549 | 549 | | |
550 | 550 | | |
551 | 551 | | |
| 552 | + | |
| 553 | + | |
| 554 | + | |
| 555 | + | |
| 556 | + | |
| 557 | + | |
| 558 | + | |
| 559 | + | |
| 560 | + | |
| 561 | + | |
| 562 | + | |
| 563 | + | |
| 564 | + | |
| 565 | + | |
| 566 | + | |
| 567 | + | |
| 568 | + | |
| 569 | + | |
| 570 | + | |
| 571 | + | |
| 572 | + | |
| 573 | + | |
| 574 | + | |
552 | 575 | | |
553 | 576 | | |
554 | 577 | | |
555 | | - | |
| 578 | + | |
| 579 | + | |
| 580 | + | |
| 581 | + | |
| 582 | + | |
| 583 | + | |
| 584 | + | |
| 585 | + | |
| 586 | + | |
| 587 | + | |
| 588 | + | |
| 589 | + | |
| 590 | + | |
| 591 | + | |
| 592 | + | |
| 593 | + | |
| 594 | + | |
556 | 595 | | |
557 | 596 | | |
558 | 597 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
113 | 113 | | |
114 | 114 | | |
115 | 115 | | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
116 | 136 | | |
117 | 137 | | |
118 | | - | |
| 138 | + | |
119 | 139 | | |
120 | 140 | | |
121 | 141 | | |
| |||
0 commit comments