Deduplicate constant-condition vs impossible-check reports via collectors instead of asking the type specifier inline - #6132
Merged
Conversation
…tors instead of asking the type specifier inline
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.
Extracted from the
resolve-type-rewrite-2branch (follows #6125, #6129, #6130, #6131).ConstantConditionRuleHelper::shouldSkip()asked the type specifier inline (viaImpossibleCheckTypeHelper::findSpecifiedType()) for every call-shaped condition, just to decide whether the impossible-check rule would own the report. The rework replaces that inline ask with collector-based reconciliation:FunctionCallConstantConditionCollectorinstead of asking the type specifier.ImpossibleCheckType*CallRules emit an "I reported here" marker intoImpossibleCheckTypeReportedCollectorwhen they actually report.FunctionCallConstantConditionRule(CollectedDataNode, level 4) reconciles: deferred constant-condition errors at call sites the impossible-check rules claimed are dropped; the rest are emitted with the same trait "in context of" handling asConstantConditionInTraitRule.Net user-visible behavior is intended to be identical; the dedup key becomes "did the impossible-check rule actually report" rather than "does the helper think it's always-X", which also removes an on-demand type-specifier ask from the rule path (one step toward the single-pass analyser). Rule unit tests change shape: the
CompositeRulesetups now include the impossible-check rules, so previously invisible impossible-check errors in shared fixtures become explicit expectations.Adapted from the branch commit to 2.2.x: the rules keep listening on raw
FuncCall/MethodCall/StaticCallnodes and the 3-argImpossibleCheckTypeHelper.Validation: full test suite green (17772 tests), self-analysis clean, code style clean.
🤖 Generated with Claude Code
https://claude.ai/code/session_019wqGgaD7iqL44t1KgpJS7b