fix(typecheck): print warning messages, and fix the unused-variable false positive - #2013
Merged
Merged
Conversation
Contributor
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
force-pushed
the
fix/typecheck-warning-visibility
branch
from
August 9, 2026 07:24
27e6b90 to
7ef8a30
Compare
Contributor
PR DashboardGenerated at: 2026-08-09 07:24:54 UTC
Summary
Seal Status
|
Contributor
|
📓 NotebookLM Notebook linked to this PR
This notebook contains session context, decisions, and artifacts for this work. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Two coupled changes: make warnings visible, then fix what visibility immediately exposed.
1. The messages were built and then dropped
typecheckconstructed 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 inresult.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 inextra_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:— which reported both
a0anda1unused. Real instances:health_monitoring::update_health_check,key_management::set_key_slot,cross_layer_optimizer/redundancy_management::set_slot4.collect_readsnow scans the element text as well. It can only add reads, so it removes false warnings and can never introduce one.Validation
bitnet_layer) is the known environmental iverilog failure, present on master before this changeRefs #1948
🤖 Generated with Claude Code