Skip to content

Inference: widen keyword literals in lambda bodies; clearer descriptor diagnostics - #110

Merged
bjacobso merged 1 commit into
mainfrom
conductor/forma-inference-fixes
Nov 4, 2026
Merged

bjacobso merged 1 commit into
mainfrom
conductor/forma-inference-fixes

Conversation

@bjacobso

@bjacobso bjacobso commented Nov 4, 2026 •

Copy link
Copy Markdown
Owner

Confirmed all three reports on origin/main at fb1bb66; none was already fixed.

  1. Keyword literals in lambda bodies: literal inference retains singleton types, but checking an unresolved polymorphic parameter and joining an unknown record field with a literal prematurely bound the variable to :done. Widen literals to their primitive type in those two inference paths. This fixes filter, map, nested lambdas, explicit get, and polymorphic membership calls without special-casing equality. Direct keyword bindings and branches retain their exact types; explicit singleton and enum parameter checks remain restrictive.
  2. Shared :check functions: function record patterns use the language's strict matcher, which rejects missing keys with a generic pattern failure. Preserve that existing language-wide behavior and implement the requested diagnostic alternative: resolve the check's record parameter and report its function, form, and undeclared holes. Other check evaluation failures also name their check and form. Document that declared optional holes are present as nil, while checks shared across forms with different holes can accept the whole record and use get. Regressions cover named functions, closures, aliases, anonymous checks, multiple missing holes, optional holes, and strict patterns in fn, define, let, and match.
  3. Scoped record field typos: row unification discarded the owner and requested field in its diagnostic. Detect absent fields on known closed records before unification and report the owner path, missing field, nearby suggestion, and available fields at the authored access. Cover multilevel paths, get, empty records, and unrelated field names. Reuse the existing descriptor-slot spelling heuristic. Numeric argument errors now name the argument and operator and point at the offending argument.

Updated docs/writing-a-form.md and the language reference, and added an @formalang/ts patch changeset. Reviewed the stored type-error fixture change: only its expected span changes, from the entire numeric call to the invalid string argument. Existing editor and macro provenance assertions likewise expect the more precise argument span. No surface goldens were regenerated.

Validation: pnpm install --frozen-lockfile; pnpm check (including changeset status, all 1,190 package tests, 248 surface comparisons, and the docs/llms.txt build); pnpm test:site (runs pnpm website:build and passes all 9 Chromium tests against the assembled production Worker).


Open workspace in Conductor

@bjacobso
bjacobso merged commit 1739e4c into main Nov 4, 2026
2 checks passed

This branch was successfully deployed

1 active deployment
preview — cdd7f6ba Deployed Nov 4, 2026 by bjacobso via Forma PR preview #10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant