-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Param nullchecking binding #36247
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
Param nullchecking binding #36247
Conversation
|
Currently adding asserts for IsNullChecked. |
src/Compilers/CSharp/Test/Semantic/Semantics/NullCheckedParameterTests.cs
Show resolved
Hide resolved
src/Compilers/CSharp/Test/Semantic/Semantics/NullCheckedParameterTests.cs
Outdated
Show resolved
Hide resolved
| } | ||
| } | ||
| internal override bool IsNullChecked | ||
| => this.CSharpSyntaxNode.ExclamationToken.Kind() == SyntaxKind.ExclamationToken; |
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.
Can ExclamationToken be null? Also, I think the standard way of checking if a token is present is to call IsMissing instead of checking the Kind.
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 believe it's SyntaxKind.None if there's no token.
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'm also wondering about when IsMissing is preferred over Kind() == SyntaxKind.None. It seems like IsMissing is mainly for when the token's absence is a syntax error, not when the token is optional.
src/Compilers/CSharp/Portable/Symbols/Source/SourceSimpleParameterSymbol.cs
Outdated
Show resolved
Hide resolved
src/Compilers/CSharp/Test/Semantic/Semantics/NullCheckedParameterTests.cs
Outdated
Show resolved
Hide resolved
src/Compilers/CSharp/Test/Semantic/Semantics/NullCheckedParameterTests.cs
Show resolved
Hide resolved
src/Compilers/CSharp/Test/Semantic/Semantics/NullCheckedParameterTests.cs
Outdated
Show resolved
Hide resolved
src/Compilers/CSharp/Portable/Symbols/Source/SourceComplexParameterSymbol.cs
Outdated
Show resolved
Hide resolved
src/Compilers/CSharp/Test/Semantic/Semantics/NullCheckedParameterTests.cs
Outdated
Show resolved
Hide resolved
src/Compilers/CSharp/Test/Semantic/Semantics/NullCheckedParameterTests.cs
Outdated
Show resolved
Hide resolved
src/Compilers/CSharp/Portable/Symbols/Source/SourceSimpleParameterSymbol.cs
Outdated
Show resolved
Hide resolved
src/Compilers/CSharp/Test/Semantic/Semantics/NullCheckedParameterTests.cs
Outdated
Show resolved
Hide resolved
src/Compilers/CSharp/Test/Semantic/Semantics/NullCheckedParameterTests.cs
Outdated
Show resolved
Hide resolved
|
Looks like there some copy/paste errors around the asserts, should be simple to fix up |
agocke
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
Working cases for binding parameter nullchecking.