Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
Feature: An alternative approach to handling "null conditional" ops #251
Feature: An alternative approach to handling "null conditional" ops #251
Changes from 22 commits
f4351c6
f881f34
91fe31b
a98d5d7
4ee7b60
64659e0
247e2be
d264cee
c238d13
d147b8b
08607f9
854f9d6
5ed92c2
e4affe1
181462d
4d995f7
1918dae
78f7fba
10c969b
59226a8
04a3841
e1133a3
4457d3e
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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've just been trying to figure out how this works in a couple of cases, and while I think it's the right approach, we may need a bit more explanation.
For example consider:
My understanding is that that is a null_conditional_member_access with a dependent_access of
()
- so we get the null value. It's not a null_conditional_invocation_expression, because that's only used in places where the result (if any) is discarded. Is that the case? If so, it's a bit confusing becausex.GetHashCode()
is an invocation expresson, isn't it?I'm not suggesting that we change any of the existing text - just consider adding an example/note.
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.
Nit: double space in "and it"
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.
Just to check,
primary_expression
will cover nested null-conditional member accesses, yes? So if we have:that ends up with a "top-level" null_conditional_member_access where the primary_expression is
x?.M1()?.M2()
, which is itself a null_conditional_member_access with a primary_expression ofx?.M1()
, which is itself a null_conditional_member_access with a primary expression ofx
... is that right?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 not sure about this one. To go back to my previous example, consider:
Does that satisfy the requirements of this paragraph? We'd still want to use an expression with a null_conditional_member_access rather than a null_conditional_invocation_expression in order to avoid "losing" the return value, wouldn't we? I may have missed something here.