check: refuse at check time what no back end lowers #746

Open
opened 2026-11-13 12:39:36 +00:00 by orion · 0 comments
Collaborator

Context

torb check accepts programs that torb build and torb run then refuse in the lowering. From the audit, each of these is a message of compiler/src/ir/lower/: an assignment to a top-level var from a function; a read through a top-level var from a function; an assignment to a captured binding; the negation of an unsigned number; an operator with a var receiver; a var parameter that takes its default (call.trb:1430); a lazy parameter that takes its default (call.trb:1435); a call of a function value that leaves a defaulted parameter out (closure.trb:989); a closure that captures the slot of a for var (closure.trb:1128); a spawn closure that shares a variable (closure.trb:1290); while var over alternatives whose names are paths into different cases; the export of a function with a var parameter. The editor shows no problem for them, and CONCEPT promises that a program which type checks builds.

Source

  • Cleanup audit 2026-11 (#742), finding F6; the report is docs/project/2026-11-cleanup-audit.md.

Goal

Each construct on the user-reachable list either builds on tier A and tier B, or the checker refuses it with a message that names the rule and the way out. After this issue the list of user-reachable unsupported constructs holds only back-end-specific entries (JavaScript, PHP), which their allow lists track.

Design record point

CONCEPT (the sections on var parameters, closures and captures, spawn); docs/TYPECHECKER.md section 9 gets one spec gap entry per construct that is refused for good.

Acceptance criteria

  • For every construct in the context above: a conformance program that builds and runs, or a checker test that pins the refusal and its message
  • No construct of the list reaches reportUnsupported on tier A or tier B any more
  • Each refusal that is a rule of the language and not a gap is written into CONCEPT or the language page it belongs to
  • The four gates and the fixpoint are green

Dependencies

After #745 (its list is the input). May be cut into one PR per group (top-level var, defaults, captures) when it starts.

Seed

None expected. A refusal that the compiler's own source violates would need the two-commit rule; report it in the PR instead of working around it.

Size

Two or three PRs of one or two commits each; split by group when the issue is refined.

## Context `torb check` accepts programs that `torb build` and `torb run` then refuse in the lowering. From the audit, each of these is a message of `compiler/src/ir/lower/`: an assignment to a top-level `var` from a function; a read through a top-level `var` from a function; an assignment to a captured binding; the negation of an unsigned number; an operator with a `var` receiver; a `var` parameter that takes its default (`call.trb:1430`); a `lazy` parameter that takes its default (`call.trb:1435`); a call of a function value that leaves a defaulted parameter out (`closure.trb:989`); a closure that captures the slot of a `for var` (`closure.trb:1128`); a `spawn` closure that shares a variable (`closure.trb:1290`); `while var` over alternatives whose names are paths into different cases; the export of a function with a `var` parameter. The editor shows no problem for them, and CONCEPT promises that a program which type checks builds. ## Source - Cleanup audit 2026-11 (#742), finding F6; the report is `docs/project/2026-11-cleanup-audit.md`. ## Goal Each construct on the user-reachable list either builds on tier A and tier B, or the checker refuses it with a message that names the rule and the way out. After this issue the list of user-reachable unsupported constructs holds only back-end-specific entries (JavaScript, PHP), which their allow lists track. ## Design record point CONCEPT (the sections on `var` parameters, closures and captures, `spawn`); `docs/TYPECHECKER.md` section 9 gets one spec gap entry per construct that is refused for good. ## Acceptance criteria - [ ] For every construct in the context above: a conformance program that builds and runs, or a checker test that pins the refusal and its message - [ ] No construct of the list reaches `reportUnsupported` on tier A or tier B any more - [ ] Each refusal that is a rule of the language and not a gap is written into CONCEPT or the language page it belongs to - [ ] The four gates and the fixpoint are green ## Dependencies After #745 (its list is the input). May be cut into one PR per group (top-level `var`, defaults, captures) when it starts. ## Seed None expected. A refusal that the compiler's own source violates would need the two-commit rule; report it in the PR instead of working around it. ## Size Two or three PRs of one or two commits each; split by group when the issue is refined.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
torbscript/language#746
No description provided.