Skip to content

Don't use erased type for diagnostic output#1604

Merged
wmdietl merged 13 commits intoeisop:masterfrom
aosen-xiong:better-error-message
Mar 25, 2026
Merged

Don't use erased type for diagnostic output#1604
wmdietl merged 13 commits intoeisop:masterfrom
aosen-xiong:better-error-message

Conversation

@aosen-xiong
Copy link
Copy Markdown
Collaborator

@aosen-xiong aosen-xiong commented Mar 23, 2026

This PR improves diagnostic output for method invocation mismatches by using exact type arguments instead of RAW types. It also added a test case for error reporting in method invocation mismatches.

Seperate from #793

Copy link
Copy Markdown
Member

@wmdietl wmdietl left a comment

Choose a reason for hiding this comment

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

Thanks!
A changelog entry/closed issue note would be good.

@wmdietl wmdietl assigned aosen-xiong and unassigned wmdietl Mar 24, 2026
@aosen-xiong aosen-xiong requested a review from wmdietl March 24, 2026 16:32
@aosen-xiong aosen-xiong assigned wmdietl and unassigned aosen-xiong Mar 24, 2026
Copy link
Copy Markdown
Member

@wmdietl wmdietl left a comment

Choose a reason for hiding this comment

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

Thanks for the updates. Please think a bit more about what this code should do.

@wmdietl wmdietl assigned aosen-xiong and unassigned wmdietl Mar 24, 2026
aosen-xiong and others added 2 commits March 24, 2026 19:40
Co-authored-by: Werner Dietl <wdietl@gmail.com>
@aosen-xiong
Copy link
Copy Markdown
Collaborator Author

@wmdietl I agree the logic does not make sense. We had #793 to make the logic consistent, and it checks for type argument annotations on the method receiver.

So, there are two things that need to be changed in this logic.

  1. the diagnostic output
  2. the subtype checking logic

Do we still want two separate PRs? Or we can use #793 to do both.

@aosen-xiong aosen-xiong changed the title Report exact type arguments in method invocation mismatch Don't use erased type for diagnostic output Mar 25, 2026
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
AnnotatedTypeMirror methodReceiver = method.getReceiverType();
AnnotatedTypeMirror erasedMethodReceiver = methodReceiver.getErased();

How about introducing this extra variable instead of calling the same method four times?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Thanks for the suggestion. I directly committed locally and made this suggestion outdated. Sorry about that.

@aosen-xiong aosen-xiong requested a review from wmdietl March 25, 2026 02:23
@aosen-xiong aosen-xiong assigned wmdietl and unassigned aosen-xiong Mar 25, 2026
Copy link
Copy Markdown
Member

@wmdietl wmdietl left a comment

Choose a reason for hiding this comment

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

Thanks, looks good.

@wmdietl wmdietl merged commit f89dd6d into eisop:master Mar 25, 2026
42 checks passed
@aosen-xiong aosen-xiong deleted the better-error-message branch March 25, 2026 19:38
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.

2 participants