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