Repository navigation
#1856 (§4.2.1): soft numeric literals settle at the demanding use - #2396
Merged
Merged
Conversation
added 2 commits
October 13, 2026 11:53
From the next-sema-values worktree's uncommitted work: a generic
enum parameter only unsuffixed literals fix is soft — the use that
settles the binding decides it, range-checked at the literal; a
suffixed literal is hard. behav + soft-out-of-range fail on main
(suffixed-hard already passes); implementation follows, re-expressed
on the current pending design. Also tracks the {d:?} type-0 ICE
(#2395) the behavior fixture's first lines hit today.
…se (#1856) A variant call whose payload fixes a type parameter only through an unsuffixed numeric literal (Ok(1), Some(2)) now registers as a pending generic binding, like List.new() and a bare None. Settlement rechecks each soft literal at the settling type (out-of-range errors at the literal), requires hard payloads to agree, and retypes uses recorded before settlement; formatting uses defer D61 formatter registration to settlement, since the pre-settle type is a generic template. A binding no use settles completes at its literals' default types at scope exit; one with a parameter nothing fixes keeps the cannot-infer diagnostic. Suffixed literals stay hard. Fixes #2395: formatting an unsettled Ok(1) binding reached MIR with type 0; it is now the cannot-infer error. Ceremony: move-arg src 847 -> 851 granted in build/ceremony-allowances.tsv (the three pending-soft-use lists join the FnBodyEnv snapshot's existing move-out pattern).
Contributor
Author
|
Battery GREEN at 1b44864 (seed-driven, one battery for the stack):
Marking ready and merging. |
ehartford
marked this pull request as ready for review
October 13, 2026 20:21
This was referenced Oct 13, 2026
Closed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
§4.2.1 soft-literal settling for generic enum bindings (#1856), ported from the abandoned
next-sema-valuesworktree onto current main's pending-generic machinery.A variant call whose payload fixes a type parameter only through an unsuffixed numeric literal —
let d = Ok(1),let o = Some(2)— registers as a pending generic binding, likeList.new()and a bareNone(#2103). The demanding use settles it:wide(a)settlesa = Ok(1)atResult[i64, str];small(o)atOption[u8]; a typed binding at its annotation.Ok(300)settled atu8errors at the literal; suffixed literals stay hard.{d:?}formatting) are retyped at settlement; D61 formatter registration for those uses defers to settlement, since the pre-settle type is a generic template no formatter can be built for.isize/f64) at scope exit when every parameter is fixed by a payload; otherwise the existing cannot-infer diagnostic stands.Fixes
{d:?}on an unsettledOk(1)binding reached MIR with type 0 (BUG: ':?' reached MIR for type 0, proven with lldb atMirLower.lower_debug_write_placevia a synthesized formatter for the raw template type). It is now the cannot-infer diagnostic.Ceremony
move-argin src 847 -> 851, granted inbuild/ceremony-allowances.tsv: the three pending-soft-use lists join the FnBodyEnv scope snapshot beside the pending-generic maps, spelling the same env ownership transfer as every neighboring field.Evidence (iterate tier)
with-stage1 teston the three Unannotated Ok/Err join (if or match) types the binding 0; check passes, MIR aborts #1856 fixtures plusbehav_1856_unannotated_ok_err_join: 4/4 pass.behav_2103_*,err_2103_*,err_struct_generic_pending_constructor_mismatch,behav_vec_type_infer): pass.analyze audit:resolutionon the print-then-settle repro: violations=0.