Skip to content

fix(hy-check): preserve numeric widths through type aliases - #4934

Open
BP202302 wants to merge 1 commit into
limitlessprojects:mainfrom
BP202302:codex/microbounties-dde57773420b4648e3645160
Open

BP202302 wants to merge 1 commit into
limitlessprojects:mainfrom
BP202302:codex/microbounties-dde57773420b4648e3645160

Conversation

@BP202302

Copy link
Copy Markdown

Numeric aliases lose their scalar width on upstream 506609af540029bd68c796cb05f269ac839333e4. This program passes hyb check with zero diagnostics, but the equivalent Go assignment fails to build:

type narrow = int8
fn main() {
    var a narrow = 1
    var b int64 = a
    _ = b
}

Resolve alias chains in the shared scalar-name lookup, bound cycles by the alias count, and reuse the lookup for conversions and append destinations. Resolve numeric conversions before builtin min/max inference so aliases can shadow those names. Preserve local-callee and non-numeric type shadowing. Add a T25 clarification and six regression tests, including valid controls and long/cyclic chains.

Validation on ARM64, Rust 1.99.0 / Go 1.26.9:

  • Baseline: 17/18 negative matrix cases accepted without diagnostics; three initial valid-control tests passed. After the fix, all 18 negative cases reject.
  • Final CLI: original repro rejects; a valid chained-alias/min-alias program checks, builds with Go, and runs.
  • Workspace: 3299 passed, 0 failed/ignored. All unit/binary/doc tests and 500 integration targets, run in batches to fit available disk (equivalent coverage to cargo test --workspace).
  • Corpus: 139/139. Differential: 47/47 build-and-run, 92/92 reject, full agreement.
  • Registration, conflict-marker, guarantees, new-test formatting, and git diff --check pass.

The differential bridge builds initially hit this sandbox's placeholder /tmp/.git. The successful full run used TMPDIR inside the real checkout; compiler, runtime, corpus expectations, and harness were unchanged. Hosted GitHub Actions and maintainer review remain pending.

Issue: #3125
Closes #3125

AI assistance: implemented and locally verified with Codex.

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.

[soundness] hy-check: typed widths from numeric type aliases escape the #2712 width check (Row 13 BUILDABLE)

1 participant