Add extra test for collection initialization

This commit is contained in:
Tamas Vajk
2020-12-17 12:14:51 +01:00
parent 8fd409898a
commit f12befdcd0
3 changed files with 15 additions and 0 deletions

View File

@@ -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
}
}

View File

@@ -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 |

View File

@@ -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