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