Skip to content

Improve printing of annotated type variables in error messages#1478

Merged
msridhar merged 1 commit intomasterfrom
improve-type-var-pretty-printing
Feb 21, 2026
Merged

Improve printing of annotated type variables in error messages#1478
msridhar merged 1 commit intomasterfrom
improve-type-var-pretty-printing

Conversation

@msridhar
Copy link
Copy Markdown
Collaborator

@msridhar msridhar commented Feb 21, 2026

Use the simple name for annotations rather than the fully-qualified name. Only changes printing of error messages.

Summary by CodeRabbit

Release Notes

  • Bug Fixes

    • Improved error message formatting for generic type variables and intersection types in diagnostic output.
  • Tests

    • Updated test expectations to reflect improved diagnostic message formatting.

@msridhar msridhar requested a review from yuxincs February 21, 2026 03:14
@msridhar msridhar enabled auto-merge (squash) February 21, 2026 03:14
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Feb 21, 2026

No actionable comments were generated in the recent review. 🎉


Walkthrough

This pull request introduces support for pretty-printing type variables in diagnostic messages within the NullAway generics type processing. It adds a new visitTypeVar method to GenericTypePrettyPrintingVisitor that renders type variables with their associated type-use annotations. Additionally, the intersection type printing is modified to use explicit string joining with " & " separator. Corresponding test expectations are updated to reflect the new output format using short-form annotation names instead of fully-qualified names.

Suggested reviewers

  • yuxincs
  • lazaroclapp
🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.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
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main change: adding support for printing type variables with annotations, which directly aligns with the code modifications that introduce visitTypeVar method and update diagnostic expectations.

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

✨ Finishing Touches
  • 📝 Generate docstrings (stacked PR)
  • 📝 Generate docstrings (commit on current branch)
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch improve-type-var-pretty-printing

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.

@codecov
Copy link
Copy Markdown

codecov bot commented Feb 21, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 88.47%. Comparing base (09b39c9) to head (fc26713).
⚠️ Report is 1 commits behind head on master.

Additional details and impacted files
@@             Coverage Diff              @@
##             master    #1478      +/-   ##
============================================
+ Coverage     88.46%   88.47%   +0.01%     
- Complexity     2757     2759       +2     
============================================
  Files            99       99              
  Lines          9196     9204       +8     
  Branches       1847     1848       +1     
============================================
+ Hits           8135     8143       +8     
  Misses          521      521              
  Partials        540      540              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@msridhar msridhar merged commit bc7bae8 into master Feb 21, 2026
12 checks passed
@msridhar msridhar deleted the improve-type-var-pretty-printing branch February 21, 2026 17:09
@627721565
Copy link
Copy Markdown

627721565 commented Feb 21, 2026 via email

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.

3 participants