157 references to UsingStatement
Microsoft.CodeAnalysis.CSharp.Syntax.UnitTests (157)
Parsing\AnonymousFunctionParsingTests.cs (8)
904
UsingStatement
(test, options: TestOptions.Regular8);
972
UsingStatement
(test, options: TestOptions.Regular8);
1035
UsingStatement
(test, options: TestOptions.Regular8);
1105
UsingStatement
(test, options: TestOptions.Regular8);
1177
UsingStatement
(test, options: TestOptions.Regular8);
1810
UsingStatement
(test, options: TestOptions.Regular8);
2129
UsingStatement
(test, options: TestOptions.Regular8);
2215
UsingStatement
(test, options: TestOptions.Regular8);
Parsing\DeclarationScopeParsingTests.cs (35)
8358
UsingStatement
(source, TestOptions.Regular.WithLanguageVersion(langVersion));
8395
UsingStatement
(source, TestOptions.Regular.WithLanguageVersion(langVersion));
8529
UsingStatement
(source, TestOptions.Regular.WithLanguageVersion(langVersion));
8668
UsingStatement
(source, TestOptions.Regular.WithLanguageVersion(langVersion));
8759
UsingStatement
(source, TestOptions.Regular.WithLanguageVersion(langVersion));
8861
UsingStatement
(source, TestOptions.Regular.WithLanguageVersion(langVersion));
8978
UsingStatement
(source, TestOptions.Regular.WithLanguageVersion(langVersion));
9019
UsingStatement
(source, TestOptions.Regular.WithLanguageVersion(langVersion));
9064
UsingStatement
(source, TestOptions.Regular.WithLanguageVersion(langVersion));
9110
UsingStatement
(source, TestOptions.Regular.WithLanguageVersion(langVersion));
9155
UsingStatement
(source, TestOptions.Regular.WithLanguageVersion(langVersion));
9196
UsingStatement
(source, TestOptions.Regular.WithLanguageVersion(langVersion));
9245
UsingStatement
(source, TestOptions.Regular.WithLanguageVersion(langVersion));
9286
UsingStatement
(source, TestOptions.Regular.WithLanguageVersion(langVersion));
9332
UsingStatement
(source, TestOptions.Regular.WithLanguageVersion(langVersion));
9378
UsingStatement
(source, TestOptions.Regular.WithLanguageVersion(langVersion));
9415
UsingStatement
(source, TestOptions.Regular.WithLanguageVersion(langVersion));
9539
UsingStatement
(source, TestOptions.Regular.WithLanguageVersion(langVersion));
9661
UsingStatement
(source, TestOptions.Regular.WithLanguageVersion(langVersion));
9695
UsingStatement
(source, TestOptions.Regular.WithLanguageVersion(langVersion));
9796
UsingStatement
(source, TestOptions.Regular.WithLanguageVersion(langVersion));
9982
UsingStatement
(source, TestOptions.Regular.WithLanguageVersion(langVersion));
10076
UsingStatement
(source, TestOptions.Regular.WithLanguageVersion(langVersion));
10181
UsingStatement
(source, TestOptions.Regular.WithLanguageVersion(langVersion));
10294
UsingStatement
(source, TestOptions.Regular.WithLanguageVersion(langVersion));
10332
UsingStatement
(source, TestOptions.Regular.WithLanguageVersion(langVersion));
10374
UsingStatement
(source, TestOptions.Regular.WithLanguageVersion(langVersion));
10417
UsingStatement
(source, TestOptions.Regular.WithLanguageVersion(langVersion));
10459
UsingStatement
(source, TestOptions.Regular.WithLanguageVersion(langVersion));
10497
UsingStatement
(source, TestOptions.Regular.WithLanguageVersion(langVersion));
10535
UsingStatement
(source, TestOptions.Regular.WithLanguageVersion(langVersion));
10577
UsingStatement
(source, TestOptions.Regular.WithLanguageVersion(langVersion));
10620
UsingStatement
(source, TestOptions.Regular.WithLanguageVersion(langVersion));
10654
UsingStatement
(source, TestOptions.Regular.WithLanguageVersion(langVersion));
10962
UsingStatement
(source, TestOptions.Regular.WithLanguageVersion(langVersion));
Parsing\FunctionPointerTests.cs (18)
20
UsingStatement
("delegate*<string, Goo, int> ptr;", options: TestOptions.Regular9);
76
UsingStatement
($"delegate* unmanaged[{conventionString}]<string, Goo, int> ptr;", options: TestOptions.Regular9);
198
UsingStatement
($"delegate* {convention}<void> ptr;", options: TestOptions.RegularPreview);
435
UsingStatement
("delegate* unmanaged[Cdecl, Thiscall, Stdcall, Fastcall, Vectorcall, SuppressGCTransition]<void> ptr;", options: TestOptions.RegularPreview);
533
UsingStatement
(text, options: TestOptions.Regular8);
598
UsingStatement
("delegate*<void, void, void> ptr;", options: TestOptions.Regular9);
649
UsingStatement
("delegate*<delegate* unmanaged[cdecl]<int*, void*>, delegate* managed<string*>> ptr;", options: TestOptions.Regular9);
755
UsingStatement
("delegate*<Goo, void>* ptr;", options: TestOptions.Regular9);
802
UsingStatement
("delegate*<ref Goo, in Bar, out Baz, ref readonly void*> ptr;", options: TestOptions.Regular9);
2158
UsingStatement
("delegate*<ref C>[] ptr;", options: TestOptions.Regular9);
2544
UsingStatement
(@"
2781
UsingStatement
("using (delegate*<void> ptr = MyMethod()) {}", options: TestOptions.Regular9);
2839
UsingStatement
("using delegate*<void> ptr = MyMethod();", options: TestOptions.Regular9);
2891
UsingStatement
("fixed (delegate*<void> ptr = &MyMethod) {}", options: TestOptions.Regular9);
2945
UsingStatement
("foreach (delegate*<void> ptr in ptrs) {}", options: TestOptions.Regular9);
2986
UsingStatement
("for (delegate*<void> ptr = null;;) {}", options: TestOptions.Regular9);
3310
UsingStatement
("delegate*<this params readonly ref ref this int> ptr;", options: TestOptions.Regular9);
4073
UsingStatement
("I<delegate*<void>[]> i;", options: TestOptions.Regular9);
Parsing\MemberDeclarationParsingTests.cs (1)
18382
UsingStatement
(source, options);
Parsing\NullableParsingTests.cs (1)
753
UsingStatement
(test, options: TestOptions.Regular8);
Parsing\ParsingTests.cs (1)
91
UsingStatement
(text, options: null, expectedErrors);
Parsing\PatternParsingTests.cs (78)
22
UsingStatement
(text, options: CSharpParseOptions.Default.WithLanguageVersion(LanguageVersion.CSharp8), expectedErrors);
1864
UsingStatement
(test, TestOptions.RegularWithoutRecursivePatterns);
1867
UsingStatement
(test, TestOptions.Regular8);
1959
UsingStatement
(test, TestOptions.RegularWithoutRecursivePatterns);
2044
UsingStatement
(test, TestOptions.RegularWithoutRecursivePatterns);
2293
UsingStatement
(test, TestOptions.RegularWithoutRecursivePatterns);
5524
UsingStatement
("switch(e) { case _: break; }", TestOptions.Regular7_3);
6580
UsingStatement
(text, options: CSharpParseOptions.Default.WithLanguageVersion(langVersion));
8268
UsingStatement
(test, TestOptions.RegularWithoutPatternCombinators);
8330
UsingStatement
(test, TestOptions.RegularWithoutPatternCombinators);
8389
UsingStatement
(test, TestOptions.RegularWithoutPatternCombinators);
8438
UsingStatement
(test, TestOptions.RegularWithoutPatternCombinators);
8516
UsingStatement
(test, TestOptions.RegularWithoutPatternCombinators);
8686
UsingStatement
(test, TestOptions.RegularWithoutPatternCombinators);
9012
UsingStatement
(
9123
UsingStatement
(
9161
UsingStatement
(
9207
UsingStatement
(
9253
UsingStatement
(@"_ = e is T when;",
9293
UsingStatement
(@"_ = e switch { T(X when) => 1, };",
9359
UsingStatement
(@"_ = e is int or long;",
9406
UsingStatement
(@"_ = e is int or System.Int64;",
9461
UsingStatement
(@"_ = e switch { int or long => 1, };",
9519
UsingStatement
(@"_ = e switch { int or System.Int64 => 1, };",
9585
UsingStatement
(@"_ = e switch { T(int) => 1, };",
9647
UsingStatement
(@"_ = e switch { int => 1, long => 2, };",
9710
UsingStatement
(@"_ = e is (int) or string;",
9763
UsingStatement
($"_ = e is (a) or b;",
9816
UsingStatement
(@"bool isLetter(char c) => c is >= 'a' and <= 'z' or >= 'A' and <= 'Z';",
9903
UsingStatement
(@"_ = e is int and;",
9943
UsingStatement
(@"_ = e is int and < Z;",
9991
UsingStatement
(@"_ = e is int and && b;",
10039
UsingStatement
(@"_ = e is int and int.MaxValue;",
10094
UsingStatement
(@"_ = e is int and MaxValue;",
10141
UsingStatement
(@"_ = e is int and ?? Z;",
10189
UsingStatement
(@"_ = e is int and ? a : b;",
10337
UsingStatement
(@"_ = e is (3);",
10378
UsingStatement
(@"_ = e is (A);",
10419
UsingStatement
(@"_ = e is (int);",
10460
UsingStatement
(@"_ = e is (Item1: int);",
10515
UsingStatement
(@"_ = e is (A) x;",
10560
UsingStatement
(@"_ = e is ((A, A)) x;",
10633
UsingStatement
(@"_ = e is ();",
10670
UsingStatement
(@"_ = e is () x;",
10711
UsingStatement
(@"_ = e is () {};",
10753
UsingStatement
(@"_ = e is (int)+1;",
10805
UsingStatement
($"_ = e is (int){identifier};",
10855
UsingStatement
($"_ = e is (int){left} {SyntaxFacts.GetText(opKind)} {right};",
10911
UsingStatement
($"_ = e is (a)42 or b;",
10972
UsingStatement
($"_ = e is {left} {SyntaxFacts.GetText(opKind)} {right};",
11023
UsingStatement
($"_ = e is (int) {SyntaxFacts.GetText(opKind)} {right};",
11076
UsingStatement
($"_ = e is (int) or >= 0;",
11129
UsingStatement
($"_ = e is (int)or or >= 0;",
11186
UsingStatement
($"_ = e is (int) or or or >= 0;",
11250
UsingStatement
(@"switch (e) { case {} and {}: break; }",
11304
UsingStatement
(@"switch (e) { case {} and (): break; }",
11359
UsingStatement
(@"_ = e is (>= 1);",
11402
UsingStatement
(@"_ = e switch { (>= 1) => 1 };",
11455
UsingStatement
(@"bool isAsciiLetter(char c) => c is (>= 'A' and <= 'Z') or (>= 'a' and <= 'z');",
11553
UsingStatement
(@"_ = e is (<= 1, >= 2);",
11613
UsingStatement
(@"_ = e is A and B and C;",
11671
UsingStatement
(@"_ = e is A or B or C;",
11730
UsingStatement
(source,
11734
UsingStatement
(source,
11794
UsingStatement
(source,
11798
UsingStatement
(source,
12042
UsingStatement
(@"_ = e switch { List<X> => 1, List<Y> => 2, };",
12123
UsingStatement
(@"_ = e switch { int? => 1 };",
12173
UsingStatement
(@"switch(a) { case int?: break; }",
12218
UsingStatement
(@"_ = e switch { (int?) => 1 };",
12273
UsingStatement
(@"switch(a) { case (int?): break; }",
12323
UsingStatement
(@"_ = e switch { a? => 1 };",
12374
UsingStatement
(@"switch(a) { case a?: break; }",
12419
UsingStatement
(@"_ = e switch { (a?) => 1 };",
12474
UsingStatement
(@"switch(a) { case (a?): break; }",
12524
UsingStatement
(@"_ = e switch { (a?x:y) => 1 };",
12588
UsingStatement
(@"switch(a) { case a?x:y: break; }",
12639
UsingStatement
(@"switch(a) { case (a?x:y): break; }",
Parsing\RecordParsing.cs (3)
25
=>
UsingStatement
(text, TestOptions.Regular9, expectedErrors);
1717
UsingStatement
("int x = await with { };", options: TestOptions.Regular9);
1756
UsingStatement
("await with;", options: TestOptions.Regular9);
Parsing\StatementParsingTests.cs (12)
2421
UsingStatement
(@"using T a = b;", options: TestOptions.Regular8);
2558
UsingStatement
(@"using var a = b;", options: TestOptions.Regular8);
2588
UsingStatement
(@"await using T a = b;", TestOptions.Regular8);
2651
UsingStatement
(@"await using var a = b;", TestOptions.Regular8);
2873
UsingStatement
(@"using T a = b, c = d;", options: TestOptions.Regular8);
2956
UsingStatement
(@"using var x = f ? a : b;", options: TestOptions.Regular8);
3039
UsingStatement
(@"using f ? x = a;", options: TestOptions.Regular8);
3111
UsingStatement
("using f? x, y;", options: TestOptions.Regular8);
3142
UsingStatement
("using ref int x = ref y;", TestOptions.Regular8);
3180
UsingStatement
("using ref readonly int x = ref y;", TestOptions.Regular8);
3219
UsingStatement
("using ref var x = ref y;", TestOptions.Regular8);
3257
UsingStatement
("using ref var x = y;", TestOptions.Regular8);