352 references to UsingExpression
Microsoft.CodeAnalysis.CSharp.Syntax.UnitTests (352)
Parsing\AsyncParsingTests.cs (4)
2654
UsingExpression
("x is A ? async b => 0 : null");
2696
UsingExpression
("x is A a ? async b => 0 : null");
2745
UsingExpression
("x is A ? async (b) => 0 : null");
2792
UsingExpression
("x is A a ? async (b) => 0 : null");
Parsing\AwaitParsingTests.cs (4)
1154
UsingExpression
("x is int ? await y : z");
1191
UsingExpression
("x is int ? await this.SomeMethodAsync() : z");
1244
UsingExpression
("x is int ? await base.SomeMethodAsync() : z");
1297
UsingExpression
("x is int ? await (myTask) : z");
Parsing\CollectionExpressionParsingTests.cs (99)
2333
UsingExpression
("[a ? [b] : c]");
2374
UsingExpression
("[A] ? [B] : C");
2415
UsingExpression
("[A] ? [B] . C");
2520
UsingExpression
("a ? [b] : c");
2553
UsingExpression
("a ? [b].M() : c");
2602
UsingExpression
("a ? b?[c] : d");
2646
UsingExpression
("a ? b?[c].M() : d");
2706
UsingExpression
("a ? b ? [c] : d : e");
2752
UsingExpression
("a ? b ? [c].M() : d : e");
2814
UsingExpression
("a?[c] ? b : d");
2858
UsingExpression
("a?[c].M() ? b : d");
2918
UsingExpression
("a?[c] ? b : d : e");
2964
UsingExpression
("a?[c].M() ? b : d : e");
3026
UsingExpression
("a ? b?[() => { var v = x ? [y] : z; }] : d");
3124
UsingExpression
("a ? b?[delegate { var v = x ? [y] : z; }] : d");
3217
UsingExpression
("a ? b?[() => x ? [y] : z] : d");
3291
UsingExpression
("a ? b?[c] : d ? e?[f] : g");
3462
UsingExpression
("a ? b?[c] : d ? e ? f?[g] : h : i");
3551
UsingExpression
("a ? b?[c] : d ? e ? f?[g] : h : i : j");
3642
UsingExpression
("a ? b?[c] : d ? e ? f?[g] : h : i : j : k");
3832
UsingExpression
("(type)[1, 2, 3]");
3880
UsingExpression
("(ImmutableArray<int>)[1, 2, 3]");
3934
UsingExpression
("(Dotted.ImmutableArray<int>)[1, 2, 3]");
3996
UsingExpression
("(ColonColon::ImmutableArray<int>)[1, 2, 3]");
4058
UsingExpression
("(NotCast())[1, 2, 3]");
4114
UsingExpression
("(Not + Cast)[1, 2, 3]");
4170
UsingExpression
("(List<int>?)[1, 2, 3]");
4228
UsingExpression
("(int[])[1, 2, 3]");
4285
UsingExpression
("((int,int)[])[(1,2), (2,3), (3,4)]");
4406
UsingExpression
("((A, B))[1, 2, 3]");
4467
UsingExpression
("((A))[1, 2, 3]");
4520
UsingExpression
("(int[]?)[1, 2, 3]");
4581
UsingExpression
("(int?[])[1, 2, 3]");
4643
UsingExpression
("(type)([1, 2, 3])");
4693
UsingExpression
("(alias::type)[1, 2, 3]");
4747
UsingExpression
("(a[b])[1, 2, 3]");
4811
UsingExpression
("(a ? b : c)[1, 2, 3]");
4873
UsingExpression
("(a * b)[1, 2, 3]");
4930
UsingExpression
("(a < b > c)[1, 2, 3]");
4994
UsingExpression
("(alias::type.member)[1, 2, 3]");
5058
UsingExpression
("(alias::type<int>)[1, 2, 3]");
5120
UsingExpression
("(alias::type.type2<int>)[1, 2, 3]");
5190
UsingExpression
("(A[])[0]");
5231
UsingExpression
("(A)[]");
5255
UsingExpression
("(A)[1]");
5343
UsingExpression
("(A)[..B]");
5379
UsingExpression
("(A[])[]");
5413
UsingExpression
("((int, int))[]");
5451
UsingExpression
("(a < b > . c)[1, 2, 3]");
5516
UsingExpression
("(A<>)[]");
5547
UsingExpression
("(A<,>)[]");
5583
UsingExpression
("(ImmutableArray<List<Int32>>)[[1]]");
5759
UsingExpression
("[.. from x in y select x]");
5800
UsingExpression
("[A, B]()");
5836
UsingExpression
("++[A, B]()");
5876
UsingExpression
("[A,]");
5897
UsingExpression
("[A,B,]");
6017
UsingExpression
("-[A]");
6041
UsingExpression
("[A] ?? [B]");
6077
UsingExpression
("[..x ?? y]");
6106
UsingExpression
("[A]!");
6130
UsingExpression
("++[A]");
6154
UsingExpression
("[A]++");
6178
UsingExpression
("await [A]");
6372
UsingExpression
("[..e]");
6393
UsingExpression
("[.. ..]");
6414
UsingExpression
("[.. ..e]");
6439
UsingExpression
("[.. e..]");
6464
UsingExpression
("[.. e1..e2]");
6493
UsingExpression
("[..throw e]");
6518
UsingExpression
("[..x.y]");
6547
UsingExpression
("[..x = y]");
6576
UsingExpression
("[..x => y]");
6605
UsingExpression
("[..x ? y : z]");
6639
UsingExpression
("[..e..]");
6664
UsingExpression
("new T?[1]");
6696
UsingExpression
("new T?[1] { }");
6733
UsingExpression
("new T[]?[1]");
6777
UsingExpression
("new T[]?[1] { }");
6826
UsingExpression
("new T[]?[1].Length");
7292
UsingExpression
("A < B?[] : D");
7396
UsingExpression
("&[A]");
7420
UsingExpression
("&[A, B]");
7452
UsingExpression
("&[A, B][C]");
7537
UsingExpression
("*[]");
7554
UsingExpression
("*[A]");
7578
UsingExpression
("*[A, B]");
7610
UsingExpression
("*[A, B][C]");
7799
UsingExpression
("_ = [Main, () => { }]");
7845
UsingExpression
("_ = [() => { }, () => { }]");
7901
UsingExpression
("_ = [() => { }, Main]");
12999
UsingExpression
("[A][B](C, D) ? e : f");
13070
UsingExpression
("[A][B] (C, D)? (e) => f");
13143
UsingExpression
("[A][B](C, D) ? (e) : f");
13219
UsingExpression
("[A][B] (C, D)? (e, f) => g");
13297
UsingExpression
("[A][B](C, D) ? (e, f) : g");
13384
UsingExpression
("[A][B] (C, D)? ([e] f) => g");
13562
UsingExpression
("[A][B] (C, D)? ((e,f) g) => h");
13756
UsingExpression
("[A][B] (C, D)? ((e,f)[] g) => h");
Parsing\ExpressionParsingTests.cs (44)
47
UsingExpression
(@"$@""hello""");
63
UsingExpression
(@"$""""""{1 + 1}""""""");
92
UsingExpression
(@"$$""""""{{{1 + 1}}}""""""");
129
UsingExpression
(@"$""""""
164
UsingExpression
(@"$$""""""
4778
UsingExpression
(source);
4895
UsingExpression
("new C { [0] = op1 < op2, [1] = true }");
4970
UsingExpression
("$\"{{{12}}}\"");
4998
UsingExpression
("$\"{{{12:X}}}\"");
5074
UsingExpression
("a ??= b");
5093
UsingExpression
("(a) ??= b");
5117
UsingExpression
("M(a) ??= b");
5151
UsingExpression
("a ?? b ??= c");
5178
UsingExpression
("a ??= b ??= c");
5205
UsingExpression
("(a ??= b) ??= c");
5271
UsingExpression
("^1");
5309
UsingExpression
("1..1");
5328
UsingExpression
("^5..^3");
5355
UsingExpression
("1<<2..3>>4");
5390
UsingExpression
("1<<2..3>>>4");
5425
UsingExpression
("1+2..3-4");
5460
UsingExpression
("a*..b");
5483
UsingExpression
("a + b..c");
5510
UsingExpression
("a + b..");
5533
UsingExpression
("a.. && b");
5556
UsingExpression
("..a && b");
5579
UsingExpression
(".. ..");
5594
UsingExpression
(".. .. e");
5613
UsingExpression
(".. e ..");
5632
UsingExpression
("a .. .. b");
5655
UsingExpression
("a .. b ..");
5678
UsingExpression
("a .. b .. c");
5701
UsingExpression
("(Offset)..(Offset + Count)");
5738
UsingExpression
("..1");
5753
UsingExpression
("..^3");
5772
UsingExpression
("1..");
5787
UsingExpression
("^5..");
5806
UsingExpression
("..");
5817
UsingExpression
("1+..<<2");
5904
UsingExpression
("..2 .ToString()");
5935
UsingExpression
("1..2 .ToString()");
6005
UsingExpression
("base");
6831
UsingExpression
(text);
6885
UsingExpression
(text);
Parsing\LambdaAttributeParsingTests.cs (16)
2052
UsingExpression
(source);
2111
UsingExpression
(source);
2165
UsingExpression
(source);
2319
UsingExpression
(source);
2381
UsingExpression
(source);
2448
UsingExpression
(source);
2520
UsingExpression
(source);
2557
UsingExpression
(source);
2639
UsingExpression
(source);
2889
UsingExpression
(source);
3017
UsingExpression
(source);
3088
UsingExpression
(source);
3159
UsingExpression
(source);
3232
UsingExpression
(source);
3275
UsingExpression
(source);
3323
UsingExpression
(source);
Parsing\LambdaParameterParsingTests.cs (20)
2641
UsingExpression
(source);
3274
UsingExpression
(source);
3347
UsingExpression
(source);
3395
UsingExpression
(source);
3476
UsingExpression
("delegate ([MyAttribute(3, arg1=true)] int x = -1) { return x; }");
3568
UsingExpression
(source);
3650
UsingExpression
(source);
3747
UsingExpression
(source);
3848
UsingExpression
(source);
4043
UsingExpression
(source);
4178
UsingExpression
(source);
4255
UsingExpression
(source);
5346
UsingExpression
(source);
5368
UsingExpression
(source);
5549
UsingExpression
(source);
5571
UsingExpression
(source);
5598
UsingExpression
(source);
5630
UsingExpression
(source);
5661
UsingExpression
(source);
5693
UsingExpression
(source);
Parsing\LambdaReturnTypeParsingTests.cs (73)
346
UsingExpression
(source);
381
UsingExpression
(source);
413
UsingExpression
(source);
456
UsingExpression
(source);
490
UsingExpression
(source);
520
UsingExpression
(source);
551
UsingExpression
(source);
594
UsingExpression
(source);
668
UsingExpression
(source);
731
UsingExpression
(source);
867
UsingExpression
(source);
910
UsingExpression
(source);
940
UsingExpression
(source);
975
UsingExpression
(source);
1021
UsingExpression
(source);
1072
UsingExpression
(source);
1223
UsingExpression
(source);
1273
UsingExpression
(source);
1312
UsingExpression
(source);
1410
UsingExpression
("int?* () => default");
1442
UsingExpression
("int[]* () => default");
1533
UsingExpression
(source);
1623
UsingExpression
(source);
1688
UsingExpression
(source);
1718
UsingExpression
(source);
1753
UsingExpression
(source);
1800
UsingExpression
(source);
1941
UsingExpression
(source);
1989
UsingExpression
(source);
2037
UsingExpression
(source);
2072
UsingExpression
(source);
2110
UsingExpression
(source);
2144
UsingExpression
(source);
2180
UsingExpression
(source);
2228
UsingExpression
(source);
2299
UsingExpression
(source);
2343
UsingExpression
(source);
2379
UsingExpression
(source);
2418
UsingExpression
(source);
2459
UsingExpression
(source);
2507
UsingExpression
(source);
2546
UsingExpression
(source);
2597
UsingExpression
(source);
2632
UsingExpression
(source);
2963
UsingExpression
(source);
3013
UsingExpression
(source);
3133
UsingExpression
(source);
3181
UsingExpression
(source);
3224
UsingExpression
(source);
3272
UsingExpression
(source);
3315
UsingExpression
(source);
3385
UsingExpression
(source);
3445
UsingExpression
(source);
3501
UsingExpression
(source);
3552
UsingExpression
(source);
3594
UsingExpression
(source);
3636
UsingExpression
(source);
3714
UsingExpression
(source);
4069
UsingExpression
(source);
4170
UsingExpression
(source);
4214
UsingExpression
(source);
4474
UsingExpression
(source);
4572
UsingExpression
(source);
4761
UsingExpression
(source);
4810
UsingExpression
(source);
4849
UsingExpression
(source);
4880
UsingExpression
(source);
4915
UsingExpression
(source);
4951
UsingExpression
(source);
4977
UsingExpression
(source);
5473
UsingExpression
(source);
5516
UsingExpression
(source);
5567
UsingExpression
(source);
Parsing\MemberDeclarationParsingTests.cs (3)
10273
UsingExpression
(@"
10305
UsingExpression
(@"
10338
UsingExpression
(@"
Parsing\NameParsingTests.cs (1)
1440
UsingExpression
("x is X ? global::X.Y.Z : default");
Parsing\NullableParsingTests.cs (28)
98
UsingExpression
("(object[]?)null");
221
UsingExpression
("(object?[]?[])null");
274
UsingExpression
("(object[][]?[]?)null");
335
UsingExpression
("x is T ? y : z");
367
UsingExpression
("x is T ? ? y : z");
403
UsingExpression
("x is T[] ? y : z");
447
UsingExpression
("x is T[] ? ? y : z");
495
UsingExpression
("x as T?? y");
522
UsingExpression
("x as T? ?? y");
602
UsingExpression
("x as T[] ?? y");
641
UsingExpression
("x as T[] ? ?? y");
1026
UsingExpression
("F<A[]?, object[]?>()");
1214
UsingExpression
("from A[]? a in b select a");
1265
UsingExpression
("F((object[]? a) => a)");
1441
UsingExpression
("new object[,][]? { 1, 2 }");
1500
UsingExpression
("new object[1,2]?[3]?[4]");
1564
UsingExpression
("new object[,]?[]?[]");
1628
UsingExpression
("new object[1,2]?[3]?[]");
1692
UsingExpression
("new object[]");
1719
UsingExpression
("new object[1]?[2,3]?[]");
1862
UsingExpression
("x is int? or string?");
1904
UsingExpression
("x is int? i or string? s");
1954
UsingExpression
("x is Type? and { }");
1993
UsingExpression
("x is Type? t and { }");
2098
UsingExpression
("x is Type ? f(1, 2) : 0");
2154
UsingExpression
("x is Type? t and (1, 2)");
2275
UsingExpression
("x is Type ? dict[key] : default");
2323
UsingExpression
("x is Type? t and []");
Parsing\PatternParsingTests.cs (40)
560
UsingExpression
("A is B << C");
590
UsingExpression
("A is 1 << 2");
620
UsingExpression
("A is null < B");
650
UsingExpression
("A is B < C");
677
UsingExpression
("A is null == B");
707
UsingExpression
("A is null & B");
737
UsingExpression
("A is null && B");
767
UsingExpression
("A is null || B");
1092
UsingExpression
("A is B*** C");
1130
UsingExpression
("A is B***[]");
1173
UsingExpression
("A is B***[] C");
1223
UsingExpression
("(B*** C, D)");
1266
UsingExpression
("(B*** C)");
1298
UsingExpression
("(B***[] C, D)");
1356
UsingExpression
("(D, B*** C)");
1399
UsingExpression
("(D, B***[] C)");
5459
UsingExpression
("e switch { _ => 1 }");
5607
UsingExpression
("e is (_, _)");
5645
UsingExpression
("e is { P: _ }");
5683
UsingExpression
("e is _");
5702
UsingExpression
(
5946
UsingExpression
(
6343
UsingExpression
("o is A[] ? b : c");
6448
UsingExpression
("o is A[][] ? b : c");
6501
UsingExpression
("o is A ? b : c");
6533
UsingExpression
("o is A? ? b : c");
6700
UsingExpression
("1 switch { 1 => 2, }");
6776
UsingExpression
("e is { X: 3, }");
7445
UsingExpression
("1 switch { 1 => 2 } switch { 2 => 3 }");
7498
UsingExpression
("a < b switch { 1 => 2 } < c switch { 2 => 3 }");
7567
UsingExpression
("a < b switch { true => 1 }");
7609
UsingExpression
("a == b switch { true => 1 }");
7649
UsingExpression
("a * b switch {}");
7674
UsingExpression
("a + b switch {}");
7699
UsingExpression
("-a switch {}");
7720
UsingExpression
("(Type)a switch {}");
7746
UsingExpression
("(Type)a++ switch {}");
7776
UsingExpression
("+a switch {}");
8000
UsingExpression
("e switch { (X) => 1 }");
8142
UsingExpression
("e is A<B> {}");
Parsing\SwitchExpressionParsingTests.cs (6)
2735
UsingExpression
("""
4238
UsingExpression
("""
4453
UsingExpression
("""
4572
UsingExpression
("""
4699
UsingExpression
("""
4836
UsingExpression
("""
Parsing\Utf8StringLiteralsParsingTests.cs (14)
22
UsingExpression
(@"""hello""");
34
UsingExpression
(@"@""hello""");
46
UsingExpression
(@"""""""hello""""""");
58
UsingExpression
(@"""""""
74
UsingExpression
(@"@""""""hello""""""");
86
UsingExpression
(@"@""""""
102
UsingExpression
(@"""hello""u8");
138
UsingExpression
(@"@""hello""u8");
174
UsingExpression
(@"""hello""U8");
210
UsingExpression
(@"@""hello""U8");
942
UsingExpression
(@"await ""hello""u8");
958
UsingExpression
(@"await @""hello""u8");
974
UsingExpression
(@"await """"""hello""""""u8");
990
UsingExpression
(@"await """"""