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

Query :: during nav-rewrite we sometimes add null protection logic in places where it's not needed #6453

Closed
maumar opened this issue Sep 2, 2016 · 1 comment
Assignees
Labels
closed-fixed The issue has been fixed and is/will be included in the release indicated by the issue milestone. type-bug
Milestone

Comments

@maumar
Copy link
Contributor

maumar commented Sep 2, 2016

Every time we encounter optional navigation we add null protection logic to the member access, however this is not necessary. We only need to add null protection AFTER the first optional navigation.
Example can be found in #6301

maumar added a commit that referenced this issue Sep 2, 2016
…ection logic in places where it's not needed

Problem was that when we rewrite optional navigation, we add null protection logic to it's property access right away. This is not needed - we only need to add null-ref protection after the first optional navigation, e.g.:

query:
customers.Select(c => c.Optional.Id)

should be translated to:
customers.Select(c => c.Optional?.Id)

and not:
customers.Select(c => c?.Optional?.Id)
@maumar maumar added this to the 1.1.0 milestone Sep 2, 2016
@maumar maumar self-assigned this Sep 2, 2016
@maumar maumar added the type-bug label Sep 2, 2016
maumar added a commit that referenced this issue Sep 2, 2016
…ection logic in places where it's not needed

Problem was that when we rewrite optional navigation, we add null protection logic to it's property access right away. This is not needed - we only need to add null-ref protection after the first optional navigation, e.g.:

query:
customers.Select(c => c.Optional.Id)

should be translated to:
customers.Select(c => c.Optional?.Id)

and not:
customers.Select(c => c?.Optional?.Id)

CR: Smit
@maumar
Copy link
Contributor Author

maumar commented Sep 2, 2016

fixed in

@maumar maumar closed this as completed Sep 2, 2016
@maumar maumar added the closed-fixed The issue has been fixed and is/will be included in the release indicated by the issue milestone. label Sep 2, 2016
@ajcvickers ajcvickers modified the milestones: 1.1.0-preview1, 1.1.0 Oct 15, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
closed-fixed The issue has been fixed and is/will be included in the release indicated by the issue milestone. type-bug
Projects
None yet
Development

No branches or pull requests

2 participants