lower: separate compiler invariants from constructs a back end does not support #745
Labels
No labels
loop
queue/failed
queue/queued
ready
status/parked
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
torbscript/language#745
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Context
reportUnsupported(compiler/src/ir/lower/context.trb:540) is the one exit of the lowering for two different things: a state the checker should have made impossible ("an expression without a type", "anOptionwithout aSomecase", "an assignment the checker did not resolve"), and a program the checker accepts and no back end builds ("an assignment to a captured binding", "a closure that captures the slot of afor var"). The audit counts about 440 call sites incompiler/src/ir/lower/(call.trb 69, match.trb 58, derive.trb 46, expression.trb 39, closure.trb 35, collection.trb 32, quoted.trb 31, encoding.trb 27, statement.trb 19, place.trb 19) and 51 in the JavaScript and PHP back ends. A user cannot tell a compiler defect from a missing feature, and nobody can count the missing features.Source
docs/project/2026-11-cleanup-audit.md.Goal
Two exits with two messages: an internal error ("this is a defect of the compiler, please report it", with the site) for an invariant, and "not supported yet" only for a construct that a user can write. Every call site uses the one that fits, and the user-reachable ones are listed.
Design record point
docs/internals/(the architecture of the lowering); CONCEPT, "error messages" (a message says what the user can do).Acceptance criteria
compiler/src/ir/lower/andcompiler/src/backend/uses one of the two;reportUnsupportedkeeps no site that names a state the checker rules outdocs/internals/lists every user-reachable unsupported construct with its message and the back ends it applies to; a test fails when a newreportUnsupportedsite is not on the listDependencies
None. #746 moves the user-reachable list to check time and builds on the list of this one.
Seed
None (no syntax, no change the seed has to read).
Size
One PR, two commits (the split with its tests, then the page with its test). Mechanical, about 490 sites.