feat(lint): W016 — bare-predicate aliasing fence (completes #396)#452
Merged
Conversation
…#396) The #247/#262 invisible-alias family: a bare predicate (if stable:, ok is converged, return diverging) reads the last-observed binding, and which binding that is depends on whatever assignment ran most recently. W016 steers to the explicit '<predicate> of <var>' form. Scope is corpus-honest: loop conditions are exempt — single-assign 'loop while not converged' is the documented tutorial idiom, and the ambiguous multi-assign case is already W014 (no double-fire). Any explicit subject counts as named, including the 'stable of (x + 0.0)' #262 workaround. Deliberate bare reads carry '# lint: allow W016', which is why this waited for #399. Zero W016 firings across lib/ + examples/ and the 10 consumer corpora. Surfaces in --lint --json and eigenlsp via the shared lint_collect pipeline. With W015 (function-clobber core, #425) this completes #396; the variable-level outer-mutation lint remains #404's dataflow territory. Gates: release + ASan/UBSan detect_leaks=1 suites 2525/2525, leak tally 0; test_lint.sh 44/44; make lsp + test_lsp_asan.sh 64/64. Closes #396 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
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.
The last open half of #396, unblocked by #399's inline suppression.
The trap (#247/#262): a bare trajectory predicate reads the last-observed binding — an invisible alias that depends on whichever assignment ran most recently. W016 fires on bare predicates in if-conditions, assignment RHS, return position, and any other expression context, steering to the explicit
<predicate> of <var>form.Corpus-honest scope: loop conditions are exempt — the single-assign
loop while not convergedform is the documented tutorial idiom, and the ambiguous multi-assign case is already W014 (verified: no double-fire). Any explicit subject counts as named, including thestable of (x + 0.0)#262 aliasing workaround. Deliberate bare reads carry# lint: allow W016.False-positive gate: zero W016 firings across
lib/+examples/, and a scan of all 10 consumer repos found zero bare-predicate exposure — no--lintCI fallout at the next pin bump.Gates: release + ASan/UBSan
detect_leaks=1suites 2525/2525 (leak tally 0), test_lint.sh 44/44 (3 firing + 3 silent fixtures),make lsp+ test_lsp_asan.sh 64/64. LSP surfaces W016 via the sharedlint_collectpipeline. DIAGNOSTICS.md registry entry added; ROADMAP #396 checked off.Closes #396
🤖 Generated with Claude Code