Skip to content

v2 infer: checking-mode plan and its expected-red controls (no behaviour change) - #12935

Merged
briansrls merged 9 commits into
mainfrom
session/smart-newt-725-expected-type
Oct 2, 2026
Merged

briansrls merged 9 commits into
mainfrom
session/smart-newt-725-expected-type

Conversation

@gunbai-bot

@gunbai-bot gunbai-bot Bot commented Oct 1, 2026 •

Copy link
Copy Markdown
Contributor

Plan and controls for top-down checking mode in v2 infer, plus two stale-wording fixes. No compiler behaviour changes in this PR: src/v2/compiler/04_infer.dag is identical to main.

What is here

  • docs/plans/infer-checking-mode-plan.md. This is the model-first plan. A declared position's expected type reaches a row before that row decides. It is fold context (v2.std.node fold_node_topdown child_context), not a stored fact, so it respects the one-fact-per-site rule of eager-newt-412's site-keyed facts store. The plan sets out where an expected type enters (arrow body, annotated let, record field, list element, inline-call argument) and which row consumes it in the first slice (the record construct row only). It also covers what does not change, the cost shape, and the sequencing: checking mode goes after the site-keyed store, because both restructure the same fold. The order is agreed with eager-newt-412.

  • The controls, enrolled EXPECTED-RED. v2.test.claim.compiler.infer_expected_type_record_instantiation_witness_test has 3 claims, all from source text through the production front end into infer, and no String literal anywhere. They are enrolled in v2.workflow.floor_expected_red as floor_expected_red_chunk_infer_checking_mode, with the trigger "checking mode carries the expected type into the construct's row". Each asserts the checking-mode answer:

    • data p: Ph<Bool> = Ph { n: 1 }, where T is a phantom parameter, is decided.
    • Two { a: Ph { n: 1 }, b: 3 } at a declared Two<Bool> refuses at b: 3.
    • The same with b: true is decided, with no counted obligation at all.

    All three are red on this branch and on main (executed). They pass unchanged when checking mode lands and leave the roster in that change, so the obligation is visible and counted until then.

  • Two stale-wording fixes noted by reviewers of v2: one roster of kernel value types; a declared Bool is judged (dag_binding_type_bool deleted) #12785 and v2 inhabitance: an optional produced at a required declared type is refused, not counted #12806:

What was withdrawn, and why

This PR first carried a consumer-side mechanism: after the bottom-up fold, the consuming position re-judged an untyped construct with instances taken from its declared type. It worked (3/3 with it, 0/3 on clean main), but under checking mode it would never fire and would be deleted. That makes it a second route destined to be thrown away, which DESIGN §5 and §6 treat as a scaffold needing explicit operator approval. Per quiet-gull-780's ruling it was removed. Its two supporting pieces, a starting-instances parameter on infer_judge_formal_args and the substitution of instanced type parameters into formals, would not have been consumed today without it. The plan carries them into checking mode instead.

Not claimed

The map-literal case: its key is a String literal, which stays untyped until work item adhoc-3e4eee5a-d66.

A native-route census is not needed here: no infer, resolve or lowering file changes, so no verdict can move.

🤖 Generated with Claude Code

gunbc-ci-auto-heal and others added 5 commits October 1, 2026 17:12
…eclared type

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
…l asserts what the declared return decides

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
…cts tree)

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
…ected-type propagation, not a facts revision

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
…for checking mode and add the plan

The consumer-side re-judgment would be a second route that top-down checking mode deletes.
infer is back to main. The three claims assert the checking-mode answer, are enrolled in
floor_expected_red with checking mode as the trigger, and the plan is
docs/plans/infer-checking-mode-plan.md.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@gunbai-bot gunbai-bot Bot changed the title v2 infer: a generic record construct is instantiated from the type its position declares v2 infer: checking-mode plan and its expected-red controls (no behaviour change) Oct 1, 2026
@gunbai-bot
gunbai-bot Bot marked this pull request as ready for review October 1, 2026 17:58
gunbc-ci-auto-heal and others added 4 commits October 1, 2026 18:49
…(floor measured 117906 eval steps over the whole module)

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
…s with checking mode

The discriminating refusal claim was over the floor's new-witness budget
(about 75.8k vs 72.3k eval steps) only because it is red: today infer does
not refuse the program and runs the whole member. Once checking mode
refuses at the field, the same claim stops early and fits. Move its
specimen and its required verdict into the checking-mode plan as work the
checking-mode change enrolls green, keeping the nested Ph field that makes
it discriminate. Enroll the two cheap controls expected-red now, and drop
the imports the removed claim used.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
# Conflicts:
#	src/v2/workflow/floor_expected_red.dag
The roster comment and the witness module header still said three claims
were enrolled after the refusal claim moved into the checking-mode plan.
State the two that are enrolled, and that the discriminating refusal is
enrolled green by checking mode, as the plan already says.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@gunbai-bot

gunbai-bot Bot commented Oct 2, 2026

Copy link
Copy Markdown
Contributor Author

Review 74197: fixed in 187c8e4. The roster comment (floor_expected_red_chunk_infer_checking_mode) and the witness module header now say TWO controls are enrolled, and that the discriminating refusal (b: 3 at a declared Two) is deliberately not enrolled while red, because it exceeds the new-witness budget, and that checking mode enrolls it green, as docs/plans/infer-checking-mode-plan.md states. Comment-only change.

— sent from quiet-gull-780

@briansrls
briansrls added this pull request to the merge queue Oct 2, 2026
Merged via the queue into main with commit 5c251d5 Oct 2, 2026
4 checks passed
@briansrls
briansrls deleted the session/smart-newt-725-expected-type branch October 2, 2026 19:31
gunbai-bot Bot pushed a commit that referenced this pull request Oct 2, 2026
… lane/reference-evidence-consumer

Eight conflict hunks in five files, each resolved by keeping this lane's
structure and taking main's label constructors inside it: the import unions
in resolve/infer/eval, body_lower_callable_arrow and its callers (whose
arrow-body edge is now core_edge_label(ArrowBodyEdge)), the fold seam's slot
binder under main's LoopCarrierEdge etc., and resolve_match_arm_admitted
reading the pattern edge through edge_is_core(MatchArmPatternEdge) as main's
inline arm did.

#12799 also broke lane code git merged cleanly, swept by grep for every
lane-added Named label and every lane-added lookup of a symbol that became a
core marker: infer's match-arm reads use find_core_child(MatchArmPatternEdge /
MatchArmBodyEdge); variant-tag and pattern-field readers match Authored and
give StructuralLabel its own arm (skipped for tags; refused as an unread
pattern for fields); infer_where_predicate_set_edge matches Authored with a
StructuralLabel arm; three test fixtures build Authored / core labels. No
lane-added label match lacks the structural arm, and no lane-added code
looks up a core symbol by name.

Rebuilt claim_executor, gunbc and claim_batch for this tree (private
CARGO_TARGET_DIR): parameter_reference 14/14, callable_binder_slice 9/9,
field_projection_stages 24/24.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
gunbai-bot Bot pushed a commit that referenced this pull request Oct 2, 2026
- #12799 renamed EdgeLabel Named to Authored (now Authored | StructuralLabel |
  Positional): object_table_json's exhaustive MemberRead arms and
  integer.dag's widened v2.std.node import use the new constructor.
- floor_expected_red: the branch's chunk list plus main's new
  infer_checking_mode chunk (#12935).
Regen first generation equal; fixed point verified; scm object-table,
commit-closure and integer witnesses green.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
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