Skip to content

Update ReturnsNullCollection and ProvidesNull to use NullnessUtils.hasDefinitelyNullBranch() instead of looking only for null literals, allowing them to flag conditional null expressions (e.g., return foo ? bar : null). Also make NullnessUtils and hasDefinitelyNullBranch public to support these checks. - #5974

Merged
copybara-service[bot] merged 1 commit into
masterfrom
test_954810744
Aug 16, 2026

Conversation

@copybara-service

@copybara-service copybara-service Bot commented Jul 27, 2026

Copy link
Copy Markdown
Contributor

Update ReturnsNullCollection and ProvidesNull to use NullnessUtils.hasDefinitelyNullBranch() instead of looking only for null literals, allowing them to flag conditional null expressions (e.g., return foo ? bar : null). Also make NullnessUtils and hasDefinitelyNullBranch public to support these checks.

Update terrible tests to expect diagnostics now that conditional null returns are flagged.

@copybara-service copybara-service Bot changed the title Make ReturnsNullCollection and ProvidesNull use hasDefinitelyNullBranch. Update ReturnsNullCollection and ProvidesNull to use NullnessUtils.hasDefinitelyNullBranch() instead of looking only for null literals, allowing them to flag conditional null expressions (e.g., return foo ? bar : null). Also make NullnessUtils and hasDefinitelyNullBranch public to support these checks. Aug 16, 2026
…ls.hasDefinitelyNullBranch()` instead of looking only for `null` literals, allowing them to flag conditional null expressions (e.g., `return foo ? bar : null`). Also make `NullnessUtils` and `hasDefinitelyNullBranch` public to support these checks.

Update terrible tests to expect diagnostics now that conditional null returns are flagged.

PiperOrigin-RevId: 965584501
@copybara-service
copybara-service Bot merged commit 609e3e4 into master Aug 16, 2026
@copybara-service
copybara-service Bot deleted the test_954810744 branch August 16, 2026 18:15
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