-
Notifications
You must be signed in to change notification settings - Fork 1.9k
C# 14: Null conditional assignments. #21158
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
Changes from 9 commits
9894993
b061c4d
0bf0cba
4ba8923
f0135e9
5942edf
ab432ec
812fdbe
3d988e8
bd1c6e6
86198e3
beb7750
33fc2ba
7ae2b76
7ff1c12
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| --- | ||
| category: minorAnalysis | ||
| --- | ||
| * C# 14: Support for null-conditional assignments (such as `c?.Prop = p`). Furthermore, the `MaybeNullExpr` class now takes null-conditional access (such as `?.`) into account when modeling potential null values. |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -43,6 +43,12 @@ private Expr maybeNullExpr(Expr reason) { | |
| ) | ||
| or | ||
| result.(NullCoalescingExpr).getRightOperand() = maybeNullExpr(reason) | ||
| or | ||
| result = | ||
| any(QualifiableExpr qe | | ||
| qe.isConditional() and | ||
| qe.getQualifier() = maybeNullExpr(reason) | ||
|
||
| ) | ||
| } | ||
|
|
||
| /** An expression that may be `null`. */ | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.