Skip to content

Correct containment algorithm#7658

Open
smillst wants to merge 1 commit intotypetools:masterfrom
smillst:issue6890
Open

Correct containment algorithm#7658
smillst wants to merge 1 commit intotypetools:masterfrom
smillst:issue6890

Conversation

@smillst
Copy link
Copy Markdown
Member

@smillst smillst commented Apr 23, 2026

Fixes #6890.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Apr 23, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: fefd25da-eb8b-4b05-8853-bcacf5578a62

📥 Commits

Reviewing files that changed from the base of the PR and between 8c4ec97 and 14e7f2a.

📒 Files selected for processing (2)
  • checker/tests/nullness/Issue6890.java
  • framework/src/main/java/org/checkerframework/framework/type/DefaultTypeHierarchy.java

📝 Walkthrough

Walkthrough

This pull request introduces a new nullness-checker test case (Issue6890) that exercises generic type invariance and nullness behavior when assigning a map with nullable-key types to a variable with non-nullable-key types. Concurrently, a modification to DefaultTypeHierarchy.java adjusts the isContainedWithinBounds method for non-covariant wildcard-bounds cases to use the current hierarchy top context for subtype comparisons, affecting how hierarchy-context is applied during containment logic evaluations.

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 25.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Linked Issues check ✅ Passed The PR adds a test case and fixes the containment algorithm in DefaultTypeHierarchy to correctly detect invalid assignments with wildcards and nullable keys.
Out of Scope Changes check ✅ Passed All changes are directly scoped to addressing issue #6890: a test case demonstrating the bug and the core fix to the containment algorithm.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

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.

failing to detect invalid assignment when using ? wildcard

2 participants