Skip to content

fix(typecheck): print warning messages, and fix the unused-variable false positive - #2013

Merged
gHashTag merged 1 commit into
masterfrom
fix/typecheck-warning-visibility
Aug 9, 2026
Merged

fix(typecheck): print warning messages, and fix the unused-variable false positive#2013
gHashTag merged 1 commit into
masterfrom
fix/typecheck-warning-visibility

Conversation

@gHashTag

@gHashTag gHashTag commented Aug 9, 2026

Copy link
Copy Markdown
Owner

Two coupled changes: make warnings visible, then fix what visibility immediately exposed.

1. The messages were built and then dropped

typecheck constructed every warning message and threw it away — the OK branch printed only the total, so a warning was unactionable: you could watch the number grow and never learn what it was. The messages were already sitting in result.errors; now they print.

This matters because some of these are real correctness findings downgraded to warnings — a call to an undefined function, and an argument type mismatch. The silence actively hid defects.

2. What visibility exposed: 20 false positives

With the texts visible, tri-net's 788 warnings resolved into two dominant categories — and 20 of the 34 unused-variable warnings were false.

A bare bracket literal ([a0, 99], with no [N]Type{...} prefix) never becomes child nodes: the parser captures the whole bracket body as element TEXT in extra_size. The unused-variable pass walked children only, so every identifier used that way was reported unused. That is the idiomatic "bind the elements to locals, then rebuild the array" pattern:

let a0: u32 = arr[0];
let a1: u32 = arr[1];
if (idx == 0) { return [99, a1]; }
return [a0, 99];

— which reported both a0 and a1 unused. Real instances: health_monitoring::update_health_check, key_management::set_key_slot, cross_layer_optimizer/redundancy_management::set_slot4.

collect_reads now scans the element text as well. It can only add reads, so it removes false warnings and can never introduce one.

Validation

  • minimal repro: 2 warnings → 0
  • tri-net corpus: unused-variable 34 → 14 (20 were false), total 788 → 768
  • all 107 specs still typecheck clean
  • t27 suite 1537 passed; the single failure (bitnet_layer) is the known environmental iverilog failure, present on master before this change
  • FROZEN_HASH resealed

Refs #1948

🤖 Generated with Claude Code

@github-actions

github-actions Bot commented Aug 9, 2026

Copy link
Copy Markdown
Contributor

PR Dashboard

Generated at: 2026-08-09 07:19:26 UTC

Summary

Status Count
Total Open PRs 15
PRs with Failing Checks 1
PRs with All Checks Green 14
READY 6
FAILING 1
PENDING 0

Seal Status

  • ⚠️ STALE -- sha256(compiler.rs)=cd2822f290eb != manifest seal=87e5cbd3ad94.
    The committed NMSE numbers were certified against an older compiler.rs.
    Run scripts/reseal-check.sh locally for the two-step reseal command (advisory; not a merge gate).

@github-actions

github-actions Bot commented Aug 9, 2026

Copy link
Copy Markdown
Contributor

📓 NotebookLM Notebook linked to this PR

This notebook contains session context, decisions, and artifacts for this work.

…alse positive

Two coupled changes: make warnings visible, then fix what visibility
immediately exposed.

1. typecheck built every warning message and then dropped it on the
   floor. The OK branch printed only the total, so a warning was
   unactionable -- you could watch the number grow and never learn what
   it was. The messages were already sitting in result.errors; print
   them. This matters because some of these are real correctness
   findings downgraded to warnings: a call to an UNDEFINED function, and
   an argument type mismatch. The silence actively hid defects.

2. With the texts visible, 719 of tri-net's 788 warnings turned out to
   be one category and 34 another -- and 20 of those 34 were FALSE.

   A bare bracket literal ([a0, 99], with no [N]Type{...} prefix) never
   becomes child nodes: the parser captures the whole bracket body as
   element TEXT in extra_size. The unused-variable pass walked children
   only, so every identifier used that way was reported unused. That is
   the idiomatic "bind the elements to locals, then rebuild the array"
   pattern, e.g.

       let a0 = arr[0]; let a1 = arr[1];
       if (idx == 0) { return [99, a1]; }
       return [a0, 99];

   which reported both a0 and a1 unused. collect_reads now scans the
   element text as well. It can only ADD reads, so it removes false
   warnings and can never introduce one.

tri-net corpus: unused-variable warnings 34 -> 14 (20 were false),
total 788 -> 768, and all 107 specs still typecheck clean. t27 suite
1537 passed; the single failure (bitnet_layer) is the known
environmental iverilog failure, present on master before this change.

FROZEN_HASH resealed.

Refs #1948
@gHashTag
gHashTag force-pushed the fix/typecheck-warning-visibility branch from 27e6b90 to 7ef8a30 Compare August 9, 2026 07:24
@github-actions

github-actions Bot commented Aug 9, 2026

Copy link
Copy Markdown
Contributor

PR Dashboard

Generated at: 2026-08-09 07:24:54 UTC

Summary

Status Count
Total Open PRs 15
PRs with Failing Checks 1
PRs with All Checks Green 14
READY 6
FAILING 1
PENDING 0

Seal Status

  • ⚠️ STALE -- sha256(compiler.rs)=cd2822f290eb != manifest seal=87e5cbd3ad94.
    The committed NMSE numbers were certified against an older compiler.rs.
    Run scripts/reseal-check.sh locally for the two-step reseal command (advisory; not a merge gate).

@github-actions

github-actions Bot commented Aug 9, 2026

Copy link
Copy Markdown
Contributor

📓 NotebookLM Notebook linked to this PR

This notebook contains session context, decisions, and artifacts for this work.

@gHashTag
gHashTag merged commit 533b0ab into master Aug 9, 2026
30 of 32 checks passed
@gHashTag
gHashTag deleted the fix/typecheck-warning-visibility branch August 9, 2026 07:27
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.

1 participant