Skip to content

#3099: a literal binding its uses type is decided in its own body, not by a second Sema over the module - #3105

Merged
ehartford merged 1 commit into
mainfrom
i3099
Nov 9, 2026
Merged

ehartford merged 1 commit into
mainfrom
i3099

Conversation

@ehartford

Copy link
Copy Markdown
Contributor

Fixes #3099.

D93 types let xs = [] from its first use. The decision was applied by checking the whole module again with a fresh Sema: for the compiler's own source (one module, 20,886 declarations) that second pass was 53 s of a 107 s Sema, to apply seventeen body-local decisions.

A body's settle loop, which already re-checks the body for D126's int locals, now takes the literal demands recorded during its pass: each binding's demanded type becomes a body decision, the pass's diagnostics go (the call on the untyped binding is one of them), and the body is checked again at the decided types. A binding two typed uses disagree about is left to the module round, which reports the disagreement at the second use as before (err_d93_two_demands). The frontend's profile line now says how many passes a module took (checks=K probe-ms=P literal-rounds=L rounds-ms=R) and lists the bindings that still force a round.

check src/main.w: checks=2, 107 s of Sema → checks=1, 54 s. The 134 literal-typing fixtures pass; behav_3099_literal_binding_settles_in_body.w added. Gate running; battery next.

…t by a second Sema over the module

D93 types `let xs = []` from its first use. The decision was applied by
checking the whole module again with a fresh Sema: for the compiler's own
source (one module, 20,886 declarations) that second pass was 53 s of a
107 s Sema, to apply seventeen body-local decisions.

A body's settle loop, which already re-checks the body for D126's int
locals, now takes the literal demands recorded during its pass: each
binding's demanded type becomes a body decision (literal_body_decisions),
the pass's diagnostics go (the call on the untyped binding is one of them),
and the body is checked again at the decided types. A binding two typed
uses disagree about is left to the module round, which reports the
disagreement at the second use as before (err_d93_two_demands). The
frontend's profile line says how many passes a module took
(`checks=K probe-ms=P literal-rounds=L rounds-ms=R`) and lists the
bindings that still force a round (`[profile] literal-demand`).

check src/main.w: checks=2, 107 s of Sema → checks=1, 54 s.
@ehartford
ehartford marked this pull request as ready for review November 9, 2026 00:15
@ehartford

Copy link
Copy Markdown
Contributor Author

Battery GREEN on c160226: with run tools/battery.w rc=0, wall 461 s, status green. Gate green (the two earlier gate reds were a census hit and a [] with no typing use in my own profile code, both fixed before this run).

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.

The D89/D93 re-check rounds re-derive a whole module to hear one decision: 28% of the compiler's map lookups on check src/main.w

1 participant