-
Notifications
You must be signed in to change notification settings - Fork 1.8k
C# 12: Support for collection expressions. #15426
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
C# 12: Support for collection expressions. #15426
Conversation
61e329f
to
724e688
Compare
e0b4a51
to
1bbe3cd
Compare
1bbe3cd
to
d34610f
Compare
d34610f
to
13b8d57
Compare
DCA |
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. The DB stats seem to be manually added. Should the stats be generated to have real numbers?
Yes, they are manually added. |
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. One suggestion.
@@ -250,6 +250,10 @@ module LocalFlow { | |||
scope = e2 and | |||
isSuccessor = true | |||
or | |||
e1 = e2.(CollectionExpression).getAnElement().(SpreadElementExpr).getExpr() and |
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 think it is better to break this up into two steps:
For [..x]
, add a local flow step from x
to ..x
, and another local flow step from ..x
to [..x]
. We can then implement expectsContent
on the ..x
node, so that flow will only be allowed when we are in fact tracking flow inside a collection.
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.
Wow, that is a really nice catch @hvitved !!!
I did some spot checking on the alerts changes on
|
…e line numbers in expected test output.
…ds to a false positive.
…propagate element flow for the spread operator.
DCA looks good. |
In this PR we introduce extractor, QL library and dataflow support for collection expressions.
Example of collection expressions are
[1, x, 3]
and[2, .. y]
inMicrosoft has documented collection expressions here. However, it is worth noting that even though the documentation states that collection expressions are also fully supported for inline arrays - but this appears not to be the case - which is indicated here.