mirror of
https://github.com/github/codeql.git
synced 2026-05-02 12:15:17 +02:00
Add extra test for collection initialization
This commit is contained in:
@@ -19,4 +19,9 @@ public class AnonObj
|
||||
void M2(int x) { }
|
||||
|
||||
D GetM() { return new(M2); }
|
||||
|
||||
void MethodAdd()
|
||||
{
|
||||
List<int> list = new();// { 1, 2, 3 }; todo: the initializer causes an extraction error
|
||||
}
|
||||
}
|
||||
@@ -2,5 +2,6 @@ implicitlyTypedObjectCreation
|
||||
| AnonymousObjectCreation.cs:7:31:7:35 | object creation of type List<AnonObj> |
|
||||
| AnonymousObjectCreation.cs:13:17:13:35 | object creation of type AnonObj |
|
||||
| AnonymousObjectCreation.cs:14:16:14:20 | object creation of type AnonObj |
|
||||
| AnonymousObjectCreation.cs:25:26:25:30 | object creation of type List<Int32> |
|
||||
implicitlyTypedDelegateCreation
|
||||
| AnonymousObjectCreation.cs:21:23:21:29 | delegate creation of type D |
|
||||
|
||||
@@ -45,6 +45,15 @@ AnonymousObjectCreation.cs:
|
||||
# 21| 0: [ExplicitDelegateCreation] delegate creation of type D
|
||||
# 21| 0: [ImplicitDelegateCreation] delegate creation of type D
|
||||
# 21| 0: [MethodAccess] access to method M2
|
||||
# 23| 11: [Method] MethodAdd
|
||||
# 23| -1: [TypeMention] Void
|
||||
# 24| 4: [BlockStmt] {...}
|
||||
# 25| 0: [LocalVariableDeclStmt] ... ...;
|
||||
# 25| 0: [LocalVariableDeclAndInitExpr] List<Int32> list = ...
|
||||
# 25| -1: [TypeMention] List<Int32>
|
||||
# 25| 1: [TypeMention] int
|
||||
# 25| 0: [LocalVariableAccess] access to local variable list
|
||||
# 25| 1: [ObjectCreation] object creation of type List<Int32>
|
||||
Discard.cs:
|
||||
# 3| [Class] Discard
|
||||
# 5| 5: [Method] M1
|
||||
|
||||
Reference in New Issue
Block a user