Skip to content

fix(no-unnecessary-condition): skip no-overlap checks for indeterminate generic intersections#806

Merged
graphite-app[bot] merged 1 commit intomainfrom
c/03-18-fix_no-unnecessary-condition_skip_no-overlap_checks_for_indeterminate_generic_intersections
Mar 18, 2026
Merged

fix(no-unnecessary-condition): skip no-overlap checks for indeterminate generic intersections#806
graphite-app[bot] merged 1 commit intomainfrom
c/03-18-fix_no-unnecessary-condition_skip_no-overlap_checks_for_indeterminate_generic_intersections

Conversation

@camc314
Copy link
Copy Markdown
Contributor

@camc314 camc314 commented Mar 18, 2026

@camc314 camc314 marked this pull request as ready for review March 18, 2026 11:33
Copilot AI review requested due to automatic review settings March 18, 2026 11:33
Copy link
Copy Markdown
Contributor Author

camc314 commented Mar 18, 2026


How to use the Graphite Merge Queue

Add the label 0-merge to this PR to add it to the merge queue.

You must have a Graphite account in order to use the merge queue. Sign up using this link.

An organization admin has enabled the Graphite Merge Queue in this repository.

Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue.

This stack of pull requests is managed by Graphite. Learn more about stacking.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Fixes a false-positive in no-unnecessary-condition by treating indeterminate generic intersection types as “unknown overlap”, preventing incorrect “no overlap” diagnostics (issue #20487).

Changes:

  • Extend indeterminate-type detection to also traverse intersection constituents (in addition to unions).
  • Add a regression test case covering a generic function check that previously triggered the incorrect overlap diagnostic.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
internal/rules/no_unnecessary_condition/no_unnecessary_condition.go Updates indeterminate constituent detection to consider intersections, avoiding incorrect no-overlap checks.
internal/rules/no_unnecessary_condition/no_unnecessary_condition_test.go Adds a valid test case reproducing the reported generic/intersection scenario.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review. Take the survey.

Comment thread internal/rules/no_unnecessary_condition/no_unnecessary_condition.go Outdated
@camc314 camc314 self-assigned this Mar 18, 2026
Copy link
Copy Markdown
Contributor Author

camc314 commented Mar 18, 2026

Merge activity

@graphite-app graphite-app Bot force-pushed the c/03-18-fix_no-unnecessary-condition_skip_no-overlap_checks_for_indeterminate_generic_intersections branch from 89b0387 to 3130dd5 Compare March 18, 2026 11:50
@graphite-app graphite-app Bot merged commit 3130dd5 into main Mar 18, 2026
8 checks passed
@graphite-app graphite-app Bot deleted the c/03-18-fix_no-unnecessary-condition_skip_no-overlap_checks_for_indeterminate_generic_intersections branch March 18, 2026 11:57
@graphite-app graphite-app Bot removed the 0-merge label Mar 18, 2026
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.

linter: no-unnecessary-condition false positive on string equality check with generic type

2 participants