-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Fix null reference crash in CheckUnderspecifiedGenericExtension for namespace-level extensions #80929
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
Fix null reference crash in CheckUnderspecifiedGenericExtension for namespace-level extensions #80929
Conversation
…ce-level extensions Co-authored-by: jcouv <[email protected]>
|
|
||
| NamedTypeSymbol extension = extensionMember.ContainingType; | ||
| if (extension.ExtensionParameter is not { } extensionParameter || extension.ContainingType.Arity != 0) | ||
| if (extension.ExtensionParameter is not { } extensionParameter || extension.ContainingType?.Arity != 0) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I checked usages of ContainingType in context of usages of GetIsNewExtensionMember, ExtensionParameter and IsExtension.
I didn't find any problem, but added a couple of tests to ensure the null checks are covered.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I checked usages of
ContainingTypein context of usages ofGetIsNewExtensionMember,ExtensionParameterandIsExtension. I didn't find any problem, but added a couple of tests to ensure the null checks are covered.
I thought GetIsNewExtensionMember got renamed. Did you use new name for the check?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The PR was forked before the rename. I refreshed the PR and took another look (now for IsExtensionBlockMember()). Thanks
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FWIW, for other APIs, I don't think it's worthwhile to do another pass. We didn't change extension logic that much in the last 3 weeks.
|
Done with review pass (commit 3) #Closed |
|
Done with review pass (commit 4) |
…erspecified-generic-extension
AlekseyTs
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM (commit 5)
Fixes #80829