Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Address false positive cases for return value codefix #38410

Closed
wants to merge 2 commits into from

Conversation

rbuckton
Copy link
Member

@rbuckton rbuckton commented May 8, 2020

In #26434 we added a code fix that can insert a return statement in places where it is missing, however the code fix has a step that is intended to verify that the resulting return expression will be correctly assignable. Unfortunately, this code fix attempts to type check a purely synthetic AST with no original pointer set, which results in the call to checker.getTypeAtLocation essentially returning any. This results in false-positives for code fixes that should not be valid.

This changes the code fix to instead leverage the checker.createSignature and checker.createAnonymousType functions to synthesize the expected type for comparison.

@rbuckton rbuckton force-pushed the fixCheckInReturnValueCodefix branch from 0c78eff to bd53776 Compare May 8, 2020 00:11
Copy link
Contributor

@Kingwl Kingwl left a comment

Choose a reason for hiding this comment

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

Thanks!

@weswigham
Copy link
Member

@rbuckton you planning on merging this? 😄

@rbuckton
Copy link
Member Author

rbuckton commented Jan 4, 2021

It looks like this was updated and merged as part of #35282.

@rbuckton rbuckton closed this Jan 4, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

5 participants