Skip to content

t27b: @intCast assigned to a typed var takes the var's type as its result type #8702

Closed

Description

@gHashTag

Problem

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
  • check_budget reports net hand lines <= 0

Boundary

  • specs/tri/t27b/int_cast_plan.t27
  • cli/t27b/tests/int_cast_traps.t27
  • specs/tri/t27b/type_text.t27
  • docs/reports/t27b_expectations.json

Activity

  1. added 2 commits that reference this issue on Oct 10, 2026
    6cb5fd5
    d9e2e28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions