You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
t27b: @intCast assigned to a typed var takes the var's type as its result type #8702
t27b refuses specs/tri/t27b/type_text.t27, our own spec, as ExprCall(@intCast) at line 228, although the reference (t27c gen + zig test) passes it (docs/reports/t27b_expectations.json):
var hi : usize = ...;
const semi : i64 = last_of(s, lo, at, B_SEMI);
if (semi != NONE) { hi = @intCast(semi); }
Cause
Zig gives a plain assignment x = e the destination's type as the result location, so @intCast(semi) converts to usize there (checked: a negative value is a safety panic in Debug). t27b gives a typed binding, a parameter, a return, an index and a slice bound that result type (see #7412, #7627, #7905), and gives an assignment to a scalar var its type only for @floatFromInt, @intFromFloat, @floatCast and @bitCast: @intCast is missing from that list, so the call reaches the generic call path with no result type.
Plan
Move the list of builtins that take an assignment's destination type into specs/tri/t27b/int_cast_plan.t27 (t27c gen-rust, mounted with #[path]) and add @intCast to it. A trap case for the assignment form goes into cli/t27b/tests/int_cast_traps.t27.
Acceptance
type_text.t27 passes t27b test <spec> --check with runtime asserts; its ledger row becomes pass.
The t27b lab corpus moves only that file.
Net hand lines <= 0 (check_budget).
User Scenarios
Given a spec specs/tri/t27b/type_text.t27 containing @intCast assigned to a typed variable, When t27b test specs/tri/t27b/type_text.t27 --check runs, Then it passes with exit 0 and the ledger row becomes pass.
Requirements
FR-001: The list of builtins that take an assignment's destination type in specs/tri/t27b/int_cast_plan.t27 MUST include @intCast.
FR-002: A trap case for the assignment form of @intCast MUST be added to cli/t27b/tests/int_cast_traps.t27.
FR-003: specs/tri/t27b/type_text.t27 MUST pass t27b test <spec> --check with runtime asserts.
FR-004: The t27b lab corpus MUST move only specs/tri/t27b/type_text.t27 from fail to pass.
FR-005: Net hand lines MUST be <= 0 as verified by check_budget.
Success Criteria
t27b test specs/tri/t27b/type_text.t27 --check exits 0
specs/tri/t27b/type_text.t27 ledger row in docs/reports/t27b_expectations.json shows pass
cli/t27b/tests/int_cast_traps.t27 contains a trap case for @intCast assignment form
Activity
Merge master (#8706) into t27b-intcast-assign-8702; recount max_not_p…
t27b: @intcast assigned to a typed var takes the var's type as its re…