Skip to content

gen-zig types a local by its name across the whole use closure, so two specs with the same local name and different types cannot be imported together #11216

Open

Description

@gHashTag

Part of the compiler defects of #5980, found by the M5c lane (PR #11215) of the night loop #11063. t27c test-report (the Zig backend) types a local variable by its NAME across the whole use closure: in specs/analog/sar_kick.t27 a local half : f64 made (half as u64) in specs/analog/mos_table.t27's blend1_w, where half is a u32, a float-to-int conversion, so no spec could import both files. The result was a compile error in t27c test-report; t27b test did not see it. The lane renamed the field and the local to hw in sar_kick.t27 to land its work; the compiler is unchanged.

Goal

Two functions in different modules of one closure that each declare a local of the same name with different types compile independently, in the Zig backend as in t27b.

Requirements

  • FR-001: The Zig backend MUST scope the type of a local to its own function; a local named half in one module MUST NOT change the type of a half in another module's function.
  • FR-002: A minimal repro MUST be committed as a conformance vector: two modules, one with var half : f64 and a function using it, one with const half : u32 cast to u64 in another function, both imported by a third spec whose test calls both.
  • FR-003: The fix MUST follow the FROZEN_HASH ceremony or live in .t27 where the emitter is ported; no hand-written Rust may grow.

Scenarios

  • Given the repro of FR-002, when t27c test-report runs, then it compiles and the test passes, and t27b test gives the same verdict.
  • Given the repo at the commit before the rename in sar_kick.t27, when t27c test-report runs on a spec that imports sar_kick.t27 and mos_table.t27, then it compiles.

Boundary

  • bootstrap/src/compiler.rs
  • specs/tri/t27b/conformance/same_local_name.t27

Success Criteria

  • t27c test-report specs/tri/t27b/conformance/same_local_name.t27 exits 0 with 0 vacuous passes.
  • t27c parse-conform exits 0 with the same vector counts as before plus the new vector.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions