JSpecify: Improve handling of method references - #1430
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #1430 +/- ##
============================================
- Coverage 88.38% 88.37% -0.01%
- Complexity 2674 2680 +6
============================================
Files 97 97
Lines 8866 8878 +12
Branches 1773 1777 +4
============================================
+ Hits 7836 7846 +10
Misses 511 511
- Partials 519 521 +2 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
WalkthroughThis change generalizes generics inference for poly-expressions by replacing lambda-only inference with a unified approach for LambdaExpressionTree and MemberReferenceTree. GenericsChecks renames getInferredLambdaType(...) to getInferredPolyExpressionType(...) and replaces the inferredLambdaTypes map with inferredPolyExpressionTypes. Call sites in NullAway and CoreNullnessStoreInitializer now prefer GenericsChecks.getInferredPolyExpressionType(...) (with ASTHelpers.getType fallback) when resolving generic nullness for lambda and method-reference parameter and return checks. Tests were added/updated for method references and annotated lambdas. Possibly related PRs
Suggested reviewers
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
📜 Recent review detailsConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro 📒 Files selected for processing (1)
🧰 Additional context used🧠 Learnings (7)📓 Common learnings📚 Learning: 2025-08-28T04:54:20.953ZApplied to files:
📚 Learning: 2025-08-14T18:50:06.159ZApplied to files:
📚 Learning: 2025-08-29T18:41:43.584ZApplied to files:
📚 Learning: 2025-10-29T23:56:18.236ZApplied to files:
📚 Learning: 2025-11-25T22:43:06.446ZApplied to files:
📚 Learning: 2025-12-31T23:59:20.009ZApplied to files:
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (5)
🔇 Additional comments (3)
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. Comment |
|
Main Branch: With This PR: |
We now infer the type of a method reference passed to a generic method based on the results of our generic method inference, similar to lambda expressions, and use this inferred type in appropriate places. Rewrite some of the code that previously referenced lambdas to now more generically reference poly expressions instead.
This is not full support, as we don't use method reference expressions in the inference process yet; see #1431. But that will be handled in a follow up.
Fixes #1128
Fixes #1307
Summary by CodeRabbit
New Features
Tests
✏️ Tip: You can customize this high-level summary in your review settings.