From 8f658a20b974c36d70fb6e9a3facd78313508b49 Mon Sep 17 00:00:00 2001 From: Andrew Stakhov Date: Thu, 10 Oct 2024 23:50:15 -0400 Subject: [PATCH 1/5] Add roslyn tests --- .github/workflows/ci.yml | 2 +- .../Rewrite.CSharp.Tests/ModuleInitializer.cs | 3 + .../Rewrite.CSharp.Tests.csproj | 1 + .../RoslynTestCases/CSharpSyntaxFragment.cs | 6 + .../RoslynTestCases/ParseTests.cs | 26 + .../RoslynTestCases/RoslynTestData.g.cs | 5816 +++++++++++++++++ .../Solutions/SolutionParser.cs | 69 - .../Solutions/SolutionTests.cs | 1 + 8 files changed, 5854 insertions(+), 70 deletions(-) create mode 100644 Rewrite/tests/Rewrite.CSharp.Tests/RoslynTestCases/CSharpSyntaxFragment.cs create mode 100644 Rewrite/tests/Rewrite.CSharp.Tests/RoslynTestCases/ParseTests.cs create mode 100644 Rewrite/tests/Rewrite.CSharp.Tests/RoslynTestCases/RoslynTestData.g.cs delete mode 100644 Rewrite/tests/Rewrite.CSharp.Tests/Solutions/SolutionParser.cs diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 5df5b596..38eebc6e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -54,7 +54,7 @@ jobs: (cd Rewrite && dotnet build Rewrite.sln --no-restore) - name: test-cs if: "!startsWith(github.event.head_commit.message, '[lst-change]')" - run: (cd Rewrite && dotnet test Rewrite.sln --filter "Category!=KnownBug & Category!=Exploratory") + run: (cd Rewrite && dotnet test Rewrite.sln --filter "Category!=KnownBug & Category!=Exploratory & Category!=Roslyn") - name: publish-java-snapshots if: github.event_name != 'pull_request' diff --git a/Rewrite/tests/Rewrite.CSharp.Tests/ModuleInitializer.cs b/Rewrite/tests/Rewrite.CSharp.Tests/ModuleInitializer.cs index cc762f57..ee9de5e5 100644 --- a/Rewrite/tests/Rewrite.CSharp.Tests/ModuleInitializer.cs +++ b/Rewrite/tests/Rewrite.CSharp.Tests/ModuleInitializer.cs @@ -1,4 +1,6 @@ using System.Runtime.CompilerServices; +using Microsoft.Build.Locator; +using Rewrite.MSBuild; using Rewrite.Remote; using Rewrite.Remote.Codec.CSharp; using Rewrite.Remote.Codec.Java; @@ -19,6 +21,7 @@ public class ModuleInitializer [ModuleInitializer] internal static void OnAssemblyLoad() { + ProjectParser.Init(); if (ITestExecutionContext.Current() == null) { ITestExecutionContext.SetCurrent(new LocalTestExecutionContext()); diff --git a/Rewrite/tests/Rewrite.CSharp.Tests/Rewrite.CSharp.Tests.csproj b/Rewrite/tests/Rewrite.CSharp.Tests/Rewrite.CSharp.Tests.csproj index 68c0c04e..5b81dfd4 100644 --- a/Rewrite/tests/Rewrite.CSharp.Tests/Rewrite.CSharp.Tests.csproj +++ b/Rewrite/tests/Rewrite.CSharp.Tests/Rewrite.CSharp.Tests.csproj @@ -19,6 +19,7 @@ + diff --git a/Rewrite/tests/Rewrite.CSharp.Tests/RoslynTestCases/CSharpSyntaxFragment.cs b/Rewrite/tests/Rewrite.CSharp.Tests/RoslynTestCases/CSharpSyntaxFragment.cs new file mode 100644 index 00000000..182fd7c6 --- /dev/null +++ b/Rewrite/tests/Rewrite.CSharp.Tests/RoslynTestCases/CSharpSyntaxFragment.cs @@ -0,0 +1,6 @@ +namespace Rewrite.CSharp.Tests.RoslynTestCases; + +public record CSharpSyntaxFragment(string Name, string Content) +{ + public override string ToString() => Name; +} diff --git a/Rewrite/tests/Rewrite.CSharp.Tests/RoslynTestCases/ParseTests.cs b/Rewrite/tests/Rewrite.CSharp.Tests/RoslynTestCases/ParseTests.cs new file mode 100644 index 00000000..3417224a --- /dev/null +++ b/Rewrite/tests/Rewrite.CSharp.Tests/RoslynTestCases/ParseTests.cs @@ -0,0 +1,26 @@ +using System.Collections; +using System.Diagnostics; +using Rewrite.Test.CSharp; +using Rewrite.Test; + +namespace Rewrite.CSharp.Tests.RoslynTestCases; + +using static Assertions; + +public class ParseTests : RewriteTest +{ + private readonly ITestOutputHelper _output; + + public ParseTests(ITestOutputHelper output) + { + _output = output; + } + + [Theory] + [ClassData(typeof(CSharpSyntaxFragments))] + [Category("Roslyn")] + public void ParseAndPrint(CSharpSyntaxFragment syntax) + { + RewriteRun(CSharp(syntax.Content)); + } +} diff --git a/Rewrite/tests/Rewrite.CSharp.Tests/RoslynTestCases/RoslynTestData.g.cs b/Rewrite/tests/Rewrite.CSharp.Tests/RoslynTestCases/RoslynTestData.g.cs new file mode 100644 index 00000000..4dcb5336 --- /dev/null +++ b/Rewrite/tests/Rewrite.CSharp.Tests/RoslynTestCases/RoslynTestData.g.cs @@ -0,0 +1,5816 @@ +using System.Collections; +namespace Rewrite.CSharp.Tests.RoslynTestCases; +public class CSharpSyntaxFragments : IEnumerable +{ + public IEnumerator GetEnumerator() + { + yield return new object[] + { + new CSharpSyntaxFragment("AllowsConstraintParsing.RefStruct_Single",@" +class C where T : allows ref struct +{}") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("AllowsConstraintParsing.RefStruct_Single_MissingRef",@" +class C where T : allows struct +{}") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("AllowsConstraintParsing.RefStruct_Single_MissingStruct",@" +class C where T : allows ref +{}") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("AllowsConstraintParsing.RefStruct_Single_MissingRefAndStruct",@" +class C where T : allows +{}") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("AllowsConstraintParsing.RefStruct_Single_EscapedAllows",@" +class C where T : @allows ref struct +{}") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("AllowsConstraintParsing.RefStruct_Single_EscapedRef",@" +class C where T : allows @ref struct +{}") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("AllowsConstraintParsing.RefStruct_Single_EscapedStruct",@" +class C where T : allows ref @struct +{}") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("AllowsConstraintParsing.RefStruct_TwoInARow",@" +class C where T : allows ref struct, ref struct +{}") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("AllowsConstraintParsing.RefStruct_TwoInARow_MissingRef",@" +class C where T : allows ref struct, struct +{}") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("AllowsConstraintParsing.RefStruct_TwoInARow_MissingStruct",@" +class C where T : allows ref struct, ref +{}") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("AllowsConstraintParsing.RefStruct_TwoAllowsInARow",@" +class C where T : allows ref struct, allows ref struct +{}") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("AllowsConstraintParsing.RefStruct_FollowedByAComma_01",@" +class C where T : allows ref struct, +{}") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("AllowsConstraintParsing.RefStruct_FollowedByAComma_02",@" +class C where T : struct, allows ref struct, +{}") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("AllowsConstraintParsing.RefStruct_FollowedByACommaAndWhere_01",@" +class C where T : allows ref struct, where S : class +{}") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("AllowsConstraintParsing.RefStruct_FollowedByACommaAndWhere_02",@" +class C where T : struct, allows ref struct, where S : class +{}") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("AllowsConstraintParsing.RefStruct_FollowedByWhere_01",@" +class C where T : allows ref struct where S : class +{}") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("AllowsConstraintParsing.RefStruct_FollowedByWhere_02",@" +class C where T : struct, allows ref struct where S : class +{}") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("AllowsConstraintParsing.RefStruct_AfterStruct",@" +class C where T : struct, allows ref struct +{}") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("AllowsConstraintParsing.RefStruct_AfterStructAndMissingComma",@" +class C where T : struct allows ref struct +{}") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("AllowsConstraintParsing.RefStruct_AfterClass",@" +class C where T : class, allows ref struct +{}") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("AllowsConstraintParsing.RefStruct_AfterDefault",@" +class C where T : default, allows ref struct +{}") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("AllowsConstraintParsing.RefStruct_AfterUnmanaged",@" +class C where T : unmanaged, allows ref struct +{}") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("AllowsConstraintParsing.RefStruct_AfterNotNull",@" +class C where T : notnull, allows ref struct +{}") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("AllowsConstraintParsing.RefStruct_AfterTypeConstraint",@" +class C where T : SomeType, allows ref struct +{}") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("AllowsConstraintParsing.RefStruct_AfterNew",@" +class C where T : new(), allows ref struct +{}") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("AllowsConstraintParsing.RefStruct_AfterMultiple",@" +class C where T : struct, SomeType, new(), allows ref struct +{}") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("AllowsConstraintParsing.RefStruct_BeforeClass",@" +class C where T : allows ref struct, class +{}") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("AllowsConstraintParsing.RefStruct_BeforeDefault",@" +class C where T : allows ref struct, default +{}") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("AllowsConstraintParsing.RefStruct_BeforeUnmanaged",@" +class C where T : allows ref struct, unmanaged +{}") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("AllowsConstraintParsing.RefStruct_BeforeNotNull",@" +class C where T : allows ref struct, notnull +{}") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("AllowsConstraintParsing.RefStruct_BeforeTypeConstraint",@" +class C where T : allows ref struct, SomeType +{}") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("AllowsConstraintParsing.RefStruct_BeforeNew",@" +class C where T : allows ref struct, new() +{}") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("AsyncParsingTests.AsyncAsType_Indexer_ExpressionBody_ErrorCase","interface async { async this[async i] => null; }") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("DeclarationParsingTests.TestExternAlias","extern alias a;") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("DeclarationParsingTests.TestUsing","using a;") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("DeclarationParsingTests.TestUsingStatic","using static a;") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("DeclarationParsingTests.TestUsingStaticInWrongOrder","static using a;") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("DeclarationParsingTests.TestDuplicateStatic","using static static a;") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("DeclarationParsingTests.TestUsingNamespace","using namespace a;") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("DeclarationParsingTests.TestUsingDottedName","using a.b;") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("DeclarationParsingTests.TestUsingStaticDottedName","using static a.b;") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("DeclarationParsingTests.TestUsingStaticGenericName","using static a;") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("DeclarationParsingTests.TestUsingAliasName","using a = b;") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("DeclarationParsingTests.TestUsingAliasGenericName","using a = b;") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("DeclarationParsingTests.TestGlobalAttribute","[assembly:a]") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("DeclarationParsingTests.TestGlobalAttribute_Verbatim","[@assembly:a]") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("DeclarationParsingTests.TestGlobalAttribute_Escape",@"[as\u0073embly:a]") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("DeclarationParsingTests.TestGlobalModuleAttribute","[module:a]") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("DeclarationParsingTests.TestGlobalModuleAttribute_Verbatim","[@module:a]") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("DeclarationParsingTests.TestGlobalAttributeWithParentheses","[assembly:a()]") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("DeclarationParsingTests.TestGlobalAttributeWithMultipleArguments","[assembly:a(b, c)]") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("DeclarationParsingTests.TestGlobalAttributeWithNamedArguments","[assembly:a(b = c)]") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("DeclarationParsingTests.TestGlobalAttributeWithMultipleAttributes","[assembly:a, b]") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("DeclarationParsingTests.TestMultipleGlobalAttributeDeclarations","[assembly:a] [assembly:b]") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("DeclarationParsingTests.TestNamespace","namespace a { }") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("DeclarationParsingTests.TestFileScopedNamespace","namespace a;") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("DeclarationParsingTests.TestNamespaceWithDottedName","namespace a.b.c { }") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("DeclarationParsingTests.TestNamespaceWithUsing","namespace a { using b.c; }") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("DeclarationParsingTests.TestFileScopedNamespaceWithUsing","namespace a; using b.c;") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("DeclarationParsingTests.TestNamespaceWithExternAlias","namespace a { extern alias b; }") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("DeclarationParsingTests.TestFileScopedNamespaceWithExternAlias","namespace a; extern alias b;") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("DeclarationParsingTests.TestNamespaceWithExternAliasFollowingUsingBad","namespace a { using b; extern alias c; }") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("DeclarationParsingTests.TestNamespaceWithNestedNamespace","namespace a { namespace b { } }") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("DeclarationParsingTests.TestClass","class a { }") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("DeclarationParsingTests.TestClassWithPublic","public class a { }") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("DeclarationParsingTests.TestClassWithInternal","internal class a { }") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("DeclarationParsingTests.TestClassWithStatic","static class a { }") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("DeclarationParsingTests.TestClassWithSealed","sealed class a { }") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("DeclarationParsingTests.TestClassWithAbstract","abstract class a { }") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("DeclarationParsingTests.TestClassWithPartial","partial class a { }") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("DeclarationParsingTests.TestClassWithAttribute","[attr] class a { }") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("DeclarationParsingTests.TestClassWithMultipleAttributes","[attr1] [attr2] class a { }") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("DeclarationParsingTests.TestClassWithMultipleAttributesInAList","[attr1, attr2] class a { }") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("DeclarationParsingTests.TestClassWithBaseType","class a : b { }") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("DeclarationParsingTests.TestClassWithMultipleBases","class a : b, c { }") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("DeclarationParsingTests.TestClassWithTypeConstraintBound","class a where b : c { }") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("DeclarationParsingTests.TestNonGenericClassWithTypeConstraintBound","class a where b : c { }") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("DeclarationParsingTests.TestNonGenericMethodWithTypeConstraintBound","class a { void M() where b : c { } }") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("DeclarationParsingTests.TestClassWithNewConstraintBound","class a where b : new() { }") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("DeclarationParsingTests.TestClassWithClassConstraintBound","class a where b : class { }") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("DeclarationParsingTests.TestClassWithStructConstraintBound","class a where b : struct { }") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("DeclarationParsingTests.TestClassWithMultipleConstraintBounds","class a where b : class, c, new() { }") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("DeclarationParsingTests.TestClassWithMultipleConstraints","class a where b : c where b : new() { }") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("DeclarationParsingTests.TestClassWithMultipleConstraints001","class a where b : c where b { }") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("DeclarationParsingTests.TestClassWithMultipleConstraints002","class a where b : c where { }") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("DeclarationParsingTests.TestClassWithMultipleBasesAndConstraints","class a : c, d where b : class, e, new() { }") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("DeclarationParsingTests.TestInterface","interface a { }") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("DeclarationParsingTests.TestGenericInterface","interface A { }") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("DeclarationParsingTests.TestGenericInterfaceWithAttributesAndVariance","interface A<[B] out C> { }") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("DeclarationParsingTests.TestStruct","struct a { }") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("DeclarationParsingTests.TestNestedClass","class a { class b { } }") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("DeclarationParsingTests.TestNestedPrivateClass","class a { private class b { } }") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("DeclarationParsingTests.TestNestedProtectedClass","class a { protected class b { } }") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("DeclarationParsingTests.TestNestedProtectedInternalClass","class a { protected internal class b { } }") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("DeclarationParsingTests.TestNestedInternalProtectedClass","class a { internal protected class b { } }") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("DeclarationParsingTests.TestNestedPublicClass","class a { public class b { } }") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("DeclarationParsingTests.TestNestedInternalClass","class a { internal class b { } }") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("DeclarationParsingTests.TestDelegate","delegate a b();") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("DeclarationParsingTests.TestDelegateWithRefReturnType","delegate ref a b();") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("DeclarationParsingTests.TestDelegateWithRefReadonlyReturnType","delegate ref readonly a b();") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("DeclarationParsingTests.TestDelegateWithParameter","delegate a b(c d);") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("DeclarationParsingTests.TestDelegateWithMultipleParameters","delegate a b(c d, e f);") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("DeclarationParsingTests.TestDelegateWithRefParameter","delegate a b(ref c d);") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("DeclarationParsingTests.TestDelegateWithOutParameter","delegate a b(out c d);") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("DeclarationParsingTests.TestDelegateWithParamsParameter","delegate a b(params c d);") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("DeclarationParsingTests.TestDelegateWithArgListParameter","delegate a b(__arglist);") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("DeclarationParsingTests.TestDelegateWithParameterAttribute","delegate a b([attr] c d);") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("DeclarationParsingTests.TestNestedDelegate","class a { delegate b c(); }") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("DeclarationParsingTests.TestClassMethod","class a { b X() { } }") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("DeclarationParsingTests.TestClassMethodWithRefReturn","class a { ref b X() { } }") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("DeclarationParsingTests.TestClassMethodWithRefReadonlyReturn","class a { ref readonly b X() { } }") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("DeclarationParsingTests.TestClassMethodWithRef","class a { ref }") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("DeclarationParsingTests.TestClassMethodWithRefReadonly","class a { ref readonly }") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("DeclarationParsingTests.TestClassMethodWithPartial","class a { partial void M() { } }") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("DeclarationParsingTests.TestStructMethodWithReadonly","struct a { readonly void M() { } }") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("DeclarationParsingTests.TestReadOnlyRefReturning","struct a { readonly ref readonly int M() { } }") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("DeclarationParsingTests.TestStructExpressionPropertyWithReadonly","struct a { readonly int M => 42; }") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("DeclarationParsingTests.TestStructGetterPropertyWithReadonly","struct a { int P { readonly get { return 42; } } }") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("DeclarationParsingTests.TestStructBadExpressionProperty",@"public struct S +{ + public int P readonly => 0; +} +") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("DeclarationParsingTests.TestClassMethodWithParameter","class a { b X(c d) { } }") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("DeclarationParsingTests.TestClassMethodWithMultipleParameters","class a { b X(c d, e f) { } }") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("DeclarationParsingTests.TestClassMethodWithArgListParameter","class a { b X(__arglist) { } }") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("DeclarationParsingTests.TestGenericClassMethod","class a { b M() { } }") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("DeclarationParsingTests.TestGenericClassMethodWithTypeConstraintBound","class a { b X() where b : d { } }") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("DeclarationParsingTests.TestGenericClassConstructor",@" +class Class1{ + public Class1() { } +} +") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("DeclarationParsingTests.TestClassConstructor","class a { a() { } }") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("DeclarationParsingTests.TestClassDestructor","class a { ~a() { } }") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("DeclarationParsingTests.TestClassField","class a { b c; }") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("DeclarationParsingTests.TestClassConstField","class a { const b c = d; }") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("DeclarationParsingTests.TestClassFieldWithInitializer","class a { b c = e; }") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("DeclarationParsingTests.TestClassFieldWithArrayInitializer","class a { b c = { }; }") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("DeclarationParsingTests.TestClassFieldWithMultipleVariables","class a { b c, d, e; }") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("DeclarationParsingTests.TestClassFieldWithMultipleVariablesAndInitializers","class a { b c = x, d = y, e = z; }") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("DeclarationParsingTests.TestClassFixedField","class a { fixed b c[10]; }") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("DeclarationParsingTests.TestClassProperty","class a { b c { get; set; } }") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("DeclarationParsingTests.TestClassPropertyWithRefReturn","class a { ref b c { get; set; } }") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("DeclarationParsingTests.TestClassPropertyWithRefReadonlyReturn","class a { ref readonly b c { get; set; } }") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("DeclarationParsingTests.TestClassPropertyWithBodies","class a { b c { get { } set { } } }") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("DeclarationParsingTests.TestClassAutoPropertyWithInitializer","class a { b c { get; set; } = d; }") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("DeclarationParsingTests.InitializerOnNonAutoProp","class C { int P { set {} } = 0; }") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("DeclarationParsingTests.TestClassPropertyExplicit","class a { b I.c { get; set; } }") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("DeclarationParsingTests.TestClassEventProperty","class a { event b c { add { } remove { } } }") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("DeclarationParsingTests.TestClassEventPropertyExplicit","class a { event b I.c { add { } remove { } } }") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("DeclarationParsingTests.TestClassIndexer","class a { b this[c d] { get; set; } }") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("DeclarationParsingTests.TestClassIndexerWithRefReturn","class a { ref b this[c d] { get; set; } }") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("DeclarationParsingTests.TestClassIndexerWithRefReadonlyReturn","class a { ref readonly b this[c d] { get; set; } }") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("DeclarationParsingTests.TestClassIndexerWithMultipleParameters","class a { b this[c d, e f] { get; set; } }") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("DeclarationParsingTests.TestClassIndexerExplicit","class a { b I.this[c d] { get; set; } }") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("DeclarationParsingTests.TestClassRightShiftOperatorMethod","class a { b operator >> (c d, e f) { } }") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("DeclarationParsingTests.TestClassUnsignedRightShiftOperatorMethod","class a { b operator >>> (c d, e f) { } }") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("DeclarationParsingTests.TestClassImplicitConversionOperatorMethod","class a { implicit operator b (c d) { } }") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("DeclarationParsingTests.TestClassExplicitConversionOperatorMethod","class a { explicit operator b (c d) { } }") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("DeclarationParsingTests.TestNamespaceDeclarationsBadNames","namespace A::B { }") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("DeclarationParsingTests.TestNamespaceDeclarationsBadNames1",@"namespace A::B { }") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("DeclarationParsingTests.TestNamespaceDeclarationsBadNames2",@"namespace A { }") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("DeclarationParsingTests.TestNamespaceDeclarationsBadNames3",@"namespace A<,> { }") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("DeclarationParsingTests.TestMissingSemicolonAfterListInitializer",@"using System; +using System.Linq; +class Program { + static void Main() { + var r = new List() { 3, 3 } + var s = 2; + } +} +") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("DeclarationParsingTests.TestPartialPartial",@" +partial class PartialPartial +{ + int i = 1; + partial partial void PM(); + partial partial void PM() + { + i = 0; + } + static int Main() + { + PartialPartial t = new PartialPartial(); + t.PM(); + return t.i; + } +} +") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("DeclarationParsingTests.TestPartialEnum",@"partial enum E{}") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("DeclarationParsingTests.TestEscapedConstructor",@" +class @class +{ + public @class() + { + } +} +") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("DeclarationParsingTests.TestAnonymousMethodWithDefaultParameter",@" +delegate void F(int x); +class C { + void M() { + F f = delegate (int x = 0) { }; + } +} +") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("DeclarationParsingTests.RegressIfDevTrueUnicode",@" +class P +{ +static void Main() +{ +#if tru\u0065 +System.Console.WriteLine(""Good, backwards compatible""); +#else +System.Console.WriteLine(""Bad, breaking change""); +#endif +} +} +") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("DeclarationParsingTests.RegressLongDirectiveIdentifierDefn",@" +//130 chars (max is 128) +#define A234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890 +class P +{ +static void Main() +{ +//first 128 chars of defined value +#if A2345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678 +System.Console.WriteLine(""Good, backwards compatible""); +#else +System.Console.WriteLine(""Bad, breaking change""); +#endif +} +} +") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("DeclarationParsingTests.RegressLongDirectiveIdentifierUse",@" +//128 chars (max) +#define A2345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678 +class P +{ +static void Main() +{ +//defined value + two chars (larger than max) +#if A234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890 +System.Console.WriteLine(""Good, backwards compatible""); +#else +System.Console.WriteLine(""Bad, breaking change""); +#endif +} +} +") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("DeclarationParsingTests.ValidFixedBufferTypes",@" +unsafe struct s +{ + public fixed bool _Type1[10]; + internal fixed int _Type3[10]; + private fixed short _Type4[10]; + unsafe fixed long _Type5[10]; + new fixed char _Type6[10]; +} +") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("DeclarationParsingTests.ValidFixedBufferTypesMultipleDeclarationsOnSameLine",@" +unsafe struct s +{ + public fixed bool _Type1[10], _Type2[10], _Type3[20]; +} +") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("DeclarationParsingTests.ValidFixedBufferTypesWithCountFromConstantOrLiteral",@" +unsafe struct s +{ + public const int abc = 10; + public fixed bool _Type1[abc]; + public fixed bool _Type2[20]; + } +") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("DeclarationParsingTests.ValidFixedBufferTypesAllValidTypes",@" +unsafe struct s +{ + public fixed bool _Type1[10]; + public fixed byte _Type12[10]; + public fixed int _Type2[10]; + public fixed short _Type3[10]; + public fixed long _Type4[10]; + public fixed char _Type5[10]; + public fixed sbyte _Type6[10]; + public fixed ushort _Type7[10]; + public fixed uint _Type8[10]; + public fixed ulong _Type9[10]; + public fixed float _Type10[10]; + public fixed double _Type11[10]; + } + + +") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("DeclarationParsingTests.TupleArgument01",@" +class C1 +{ + static (T, T) Test1(int a, (byte, byte) arg0) + { + return default((T, T)); + } + + static (T, T) Test2(ref (byte, byte) arg0) + { + return default((T, T)); + } +} +") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("DeclarationParsingTests.TupleArgument02",@" +class C1 +{ + static (T, T) Test3((byte, byte) arg0) + { + return default((T, T)); + } + + (T, T) Test3((byte a, byte b)[] arg0) + { + return default((T, T)); + } +} +") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("DeclarationParsingTests.TestNamespaceWithDotDot1",@"namespace a..b { }") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("DeclarationParsingTests.TestExtraneousColonInBaseList",@" +class A : B : C +{ +} +") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("DeclarationParsingTests.TestNamespaceWithDotDot2",@"namespace a + ..b { }") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("DeclarationParsingTests.TestNamespaceWithDotDot3",@"namespace a.. +b { }") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("DeclarationParsingTests.TestNamespaceWithDotDot4",@"namespace a + .. +b { }") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("DeclarationParsingTests.Interface_NoBody",@" +interface C") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("DeclarationParsingTests.Interface_SemicolonBody",@" +interface C +;") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("DeclarationParsingTests.Interface_SemicolonBodyAfterBase_01",@" +interface C : I1 +;") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("DeclarationParsingTests.Interface_SemicolonBodyAfterBase_02",@" +interface C : I1, I2 +;") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("DeclarationParsingTests.Interface_SemicolonBodyAfterConstraint_01",@" +interface C where T1 : U1 +;") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("DeclarationParsingTests.Interface_SemicolonBodyAfterConstraint_02",@" +interface C where T1 : U1 where T2 : U2 +;") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("DeconstructionTests.TupleArray","(T, T)[] id;") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("DeconstructionTests.ParenthesizedExpression","(x).ToString();") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("DeconstructionTests.TupleLiteralStatement","(x, x).ToString();") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("DeconstructionTests.Statement4","((x)).ToString();") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("DeconstructionTests.Statement5","((x, y) = M()).ToString();") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("DeconstructionTests.CastWithTupleType","(((x, y))z).Goo();") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("DeconstructionTests.NotACast","((Int32.MaxValue, Int32.MaxValue)).ToString();") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("DeconstructionTests.AlsoNotACast","((x, y)).ToString();") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("DeconstructionTests.StillNotACast","((((x, y)))).ToString();") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("DeconstructionTests.LambdaInExpressionStatement","(a) => a;") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("DeconstructionTests.LambdaWithBodyInExpressionStatement","(a, b) => { };") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("DeconstructionTests.InvalidStatement","(x, y)? = M();") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("DeconstructionTests.NullableTuple","(x, y)? z = M();") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("ExpressionParsingTests.TestAltInterpolatedVerbatimString_CSharp73",@"@$""hello""") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("ExpressionParsingTests.TestParenthesizedExpression","(goo)") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("ExpressionParsingTests.TestStringLiteralExpression","\"stuff\"") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("ExpressionParsingTests.TestVerbatimLiteralExpression","@\"\"\"stuff\"\"\"") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("ExpressionParsingTests.TestCharacterLiteralExpression","'c'") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("ExpressionParsingTests.TestNumericLiteralExpression","0") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("ExpressionParsingTests.TestRefValue","(a, b)") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("ExpressionParsingTests.TestConditional","a ? b : c") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("ExpressionParsingTests.TestConditional02","a ? b=c : d=e") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("ExpressionParsingTests.TestCast","(a) b") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("ExpressionParsingTests.TestCall","a(b)") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("ExpressionParsingTests.TestCallWithRef","a(ref b)") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("ExpressionParsingTests.TestCallWithOut","a(out b)") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("ExpressionParsingTests.TestCallWithNamedArgument","a(B: b)") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("ExpressionParsingTests.TestIndex","a[b]") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("ExpressionParsingTests.TestIndexWithRef","a[ref b]") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("ExpressionParsingTests.TestIndexWithOut","a[out b]") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("ExpressionParsingTests.TestIndexWithNamedArgument","a[B: b]") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("ExpressionParsingTests.TestNew","new a()") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("ExpressionParsingTests.TestNewWithArgument","new a(b)") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("ExpressionParsingTests.TestNewWithNamedArgument","new a(B: b)") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("ExpressionParsingTests.TestNewWithEmptyInitializer","new a() { }") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("ExpressionParsingTests.TestNewWithNoArgumentsAndEmptyInitializer","new a { }") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("ExpressionParsingTests.TestNewWithNoArgumentsAndInitializer","new a { b }") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("ExpressionParsingTests.TestNewWithNoArgumentsAndInitializers","new a { b, c, d }") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("ExpressionParsingTests.TestNewWithNoArgumentsAndAssignmentInitializer","new a { B = b }") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("ExpressionParsingTests.TestNewWithNoArgumentsAndNestedAssignmentInitializer","new a { B = { X = x } }") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("ExpressionParsingTests.TestNewArray","new a[1]") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("ExpressionParsingTests.TestNewArrayWithInitializer","new a[] {b}") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("ExpressionParsingTests.TestNewArrayWithInitializers","new a[] {b, c, d}") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("ExpressionParsingTests.TestNewMultiDimensionalArrayWithInitializer","new a[][,][,,] {b}") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("ExpressionParsingTests.TestImplicitArrayCreation","new [] {b}") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("ExpressionParsingTests.TestAnonymousObjectCreation","new {a, b}") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("ExpressionParsingTests.TestAnonymousMethod","delegate (int a) { }") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("ExpressionParsingTests.TestAnonymousMethodWithNoArguments","delegate () { }") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("ExpressionParsingTests.TestAnonymousMethodWithNoArgumentList","delegate { }") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("ExpressionParsingTests.TestSimpleLambda","a => b") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("ExpressionParsingTests.TestSimpleLambdaWithRefReturn","a => ref b") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("ExpressionParsingTests.TestSimpleLambdaWithBlock","a => { }") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("ExpressionParsingTests.TestLambdaWithNoParameters","() => b") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("ExpressionParsingTests.TestLambdaWithNoParametersAndRefReturn","() => ref b") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("ExpressionParsingTests.TestLambdaWithNoParametersAndBlock","() => { }") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("ExpressionParsingTests.TestLambdaWithOneParameter","(a) => b") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("ExpressionParsingTests.TestLambdaWithTwoParameters","(a, a2) => b") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("ExpressionParsingTests.TestLambdaWithOneTypedParameter","(T a) => b") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("ExpressionParsingTests.TestLambdaWithOneRefParameter","(ref T a) => b") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("ExpressionParsingTests.TestTupleWithTwoArguments","(a, a2)") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("ExpressionParsingTests.TestTupleWithTwoNamedArguments","(arg1: (a, a2), arg2: a2)") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("ExpressionParsingTests.TestFromSelect","from a in A select b") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("ExpressionParsingTests.TestFromWithType","from T a in A select b") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("ExpressionParsingTests.TestFromSelectIntoSelect","from a in A select b into c select d") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("ExpressionParsingTests.TestFromWhereSelect","from a in A where b select c") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("ExpressionParsingTests.TestFromFromSelect","from a in A from b in B select c") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("ExpressionParsingTests.TestFromLetSelect","from a in A let b = B select c") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("ExpressionParsingTests.TestFromOrderBySelect","from a in A orderby b select c") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("ExpressionParsingTests.TestFromOrderBy2Select","from a in A orderby b, b2 select c") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("ExpressionParsingTests.TestFromOrderByAscendingSelect","from a in A orderby b ascending select c") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("ExpressionParsingTests.TestFromOrderByDescendingSelect","from a in A orderby b descending select c") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("ExpressionParsingTests.TestFromGroupBy","from a in A group b by c") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("ExpressionParsingTests.TestFromGroupByIntoSelect","from a in A group b by c into d select e") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("ExpressionParsingTests.TestFromJoinSelect","from a in A join b in B on a equals b select c") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("ExpressionParsingTests.TestFromJoinWithTypesSelect","from Ta a in A join Tb b in B on a equals b select c") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("ExpressionParsingTests.TestFromJoinIntoSelect","from a in A join b in B on a equals b into c select d") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("ExpressionParsingTests.TestFromGroupBy1","from it in goo group x by y") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("ExpressionParsingTests.UnterminatedRankSpecifier","new int[") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("ExpressionParsingTests.UnterminatedTypeArgumentList","new C<") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("ExpressionParsingTests.QueryKeywordInObjectInitializer","from elem in aRay select new Result { A = on = true }") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("ExpressionParsingTests.IndexingExpressionInParens","(aRay[i,j])") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("ExpressionParsingTests.ParseBigExpression",@" + +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text.RegularExpressions; + +namespace WB.Core.SharedKernels.DataCollection.Generated +{ + internal partial class QuestionnaireTopLevel + { + private bool IsValid_a() + { + return (stackDepth == 100) || ((stackDepth == 200) || ((stackDepth == 300) || ((stackDepth == 400) || ((stackDepth == 501) || ((stackDepth == 502) || ((stackDepth == 600) || ((stackDepth == 701) || ((stackDepth == 702) || ((stackDepth == 801) || ((stackDepth == 802) || ((stackDepth == 901) || ((stackDepth == 902) || ((stackDepth == 903) || ((stackDepth == 1001) || ((stackDepth == 1002) || ((stackDepth == 1101) || ((stackDepth == 1102) || ((stackDepth == 1201) || ((stackDepth == 1202) || ((stackDepth == 1301) || ((stackDepth == 1302) || ((stackDepth == 1401) || ((stackDepth == 1402) || ((stackDepth == 1403) || ((stackDepth == 1404) || ((stackDepth == 1405) || ((stackDepth == 1406) || ((stackDepth == 1407) || ((stackDepth == 1408) || ((stackDepth == 1409) || ((stackDepth == 1410) || ((stackDepth == 1411) || ((stackDepth == 1412) || ((stackDepth == 1413) || ((stackDepth == 1500) || ((stackDepth == 1601) || ((stackDepth == 1602) || ((stackDepth == 1701) || ((stackDepth == 1702) || ((stackDepth == 1703) || ((stackDepth == 1800) || ((stackDepth == 1901) || ((stackDepth == 1902) || ((stackDepth == 1903) || ((stackDepth == 1904) || ((stackDepth == 2000) || ((stackDepth == 2101) || ((stackDepth == 2102) || ((stackDepth == 2103) || ((stackDepth == 2104) || ((stackDepth == 2105) || ((stackDepth == 2106) || ((stackDepth == 2107) || ((stackDepth == 2201) || ((stackDepth == 2202) || ((stackDepth == 2203) || ((stackDepth == 2301) || ((stackDepth == 2302) || ((stackDepth == 2303) || ((stackDepth == 2304) || ((stackDepth == 2305) || ((stackDepth == 2401) || ((stackDepth == 2402) || ((stackDepth == 2403) || ((stackDepth == 2404) || ((stackDepth == 2501) || ((stackDepth == 2502) || ((stackDepth == 2503) || ((stackDepth == 2504) || ((stackDepth == 2505) || ((stackDepth == 2601) || ((stackDepth == 2602) || ((stackDepth == 2603) || ((stackDepth == 2604) || ((stackDepth == 2605) || ((stackDepth == 2606) || ((stackDepth == 2607) || ((stackDepth == 2608) || ((stackDepth == 2701) || ((stackDepth == 2702) || ((stackDepth == 2703) || ((stackDepth == 2704) || ((stackDepth == 2705) || ((stackDepth == 2706) || ((stackDepth == 2801) || ((stackDepth == 2802) || ((stackDepth == 2803) || ((stackDepth == 2804) || ((stackDepth == 2805) || ((stackDepth == 2806) || ((stackDepth == 2807) || ((stackDepth == 2808) || ((stackDepth == 2809) || ((stackDepth == 2810) || ((stackDepth == 2901) || ((stackDepth == 2902) || ((stackDepth == 3001) || ((stackDepth == 3002) || ((stackDepth == 3101) || ((stackDepth == 3102) || ((stackDepth == 3103) || ((stackDepth == 3104) || ((stackDepth == 3105) || ((stackDepth == 3201) || ((stackDepth == 3202) || ((stackDepth == 3203) || ((stackDepth == 3301) || ((stackDepth == 3302) || ((stackDepth == 3401) || ((stackDepth == 3402) || ((stackDepth == 3403) || ((stackDepth == 3404) || ((stackDepth == 3405) || ((stackDepth == 3406) || ((stackDepth == 3407) || ((stackDepth == 3408) || ((stackDepth == 3409) || ((stackDepth == 3410) || ((stackDepth == 3501) || ((stackDepth == 3502) || ((stackDepth == 3503) || ((stackDepth == 3504) || ((stackDepth == 3505) || ((stackDepth == 3506) || ((stackDepth == 3507) || ((stackDepth == 3508) || ((stackDepth == 3509) || ((stackDepth == 3601) || ((stackDepth == 3602) || ((stackDepth == 3701) || ((stackDepth == 3702) || ((stackDepth == 3703) || ((stackDepth == 3704) || ((stackDepth == 3705) || ((stackDepth == 3706) || ((stackDepth == 3801) || ((stackDepth == 3802) || ((stackDepth == 3803) || ((stackDepth == 3804) || ((stackDepth == 3805) || ((stackDepth == 3901) || ((stackDepth == 3902) || ((stackDepth == 3903) || ((stackDepth == 3904) || ((stackDepth == 3905) || ((stackDepth == 4001) || ((stackDepth == 4002) || ((stackDepth == 4003) || ((stackDepth == 4004) || ((stackDepth == 4005) || ((stackDepth == 4006) || ((stackDepth == 4007) || ((stackDepth == 4100) || ((stackDepth == 4201) || ((stackDepth == 4202) || ((stackDepth == 4203) || ((stackDepth == 4204) || ((stackDepth == 4301) || ((stackDepth == 4302) || ((stackDepth == 4304) || ((stackDepth == 4401) || ((stackDepth == 4402) || ((stackDepth == 4403) || ((stackDepth == 4404) || ((stackDepth == 4501) || ((stackDepth == 4502) || ((stackDepth == 4503) || ((stackDepth == 4504) || ((stackDepth == 4600) || ((stackDepth == 4701) || ((stackDepth == 4702) || ((stackDepth == 4801) || ((stackDepth == 4802) || ((stackDepth == 4803) || ((stackDepth == 4804) || ((stackDepth == 4805) || ((stackDepth == 4806) || ((stackDepth == 4807) || ((stackDepth == 4808) || ((stackDepth == 4809) || ((stackDepth == 4811) || ((stackDepth == 4901) || ((stackDepth == 4902) || ((stackDepth == 4903) || ((stackDepth == 4904) || ((stackDepth == 4905) || ((stackDepth == 4906) || ((stackDepth == 4907) || ((stackDepth == 4908) || ((stackDepth == 4909) || ((stackDepth == 4910) || ((stackDepth == 4911) || ((stackDepth == 4912) || ((stackDepth == 4913) || ((stackDepth == 4914) || ((stackDepth == 4915) || ((stackDepth == 4916) || ((stackDepth == 4917) || ((stackDepth == 4918) || ((stackDepth == 4919) || ((stackDepth == 4920) || ((stackDepth == 4921) || ((stackDepth == 4922) || ((stackDepth == 4923) || ((stackDepth == 5001) || ((stackDepth == 5002) || ((stackDepth == 5003) || ((stackDepth == 5004) || ((stackDepth == 5005) || ((stackDepth == 5006) || ((stackDepth == 5100) || ((stackDepth == 5200) || ((stackDepth == 5301) || ((stackDepth == 5302) || ((stackDepth == 5400) || ((stackDepth == 5500) || ((stackDepth == 5600) || ((stackDepth == 5700) || ((stackDepth == 5801) || ((stackDepth == 5802) || ((stackDepth == 5901) || ((stackDepth == 5902) || ((stackDepth == 6001) || ((stackDepth == 6002) || ((stackDepth == 6101) || ((stackDepth == 6102) || ((stackDepth == 6201) || ((stackDepth == 6202) || ((stackDepth == 6203) || ((stackDepth == 6204) || ((stackDepth == 6205) || ((stackDepth == 6301) || ((stackDepth == 6302) || ((stackDepth == 6401) || ((stackDepth == 6402) || ((stackDepth == 6501) || ((stackDepth == 6502) || ((stackDepth == 6503) || ((stackDepth == 6504) || ((stackDepth == 6601) || ((stackDepth == 6602) || ((stackDepth == 6701) || ((stackDepth == 6702) || ((stackDepth == 6703) || ((stackDepth == 6704) || ((stackDepth == 6801) || ((stackDepth == 6802) || ((stackDepth == 6901) || ((stackDepth == 6902) || ((stackDepth == 6903) || ((stackDepth == 6904) || ((stackDepth == 7001) || ((stackDepth == 7002) || ((stackDepth == 7101) || ((stackDepth == 7102) || ((stackDepth == 7103) || ((stackDepth == 7200) || ((stackDepth == 7301) || ((stackDepth == 7302) || ((stackDepth == 7400) || ((stackDepth == 7501) || ((stackDepth == 7502) || ((stackDepth == 7503) || ((stackDepth == 7600) || ((stackDepth == 7700) || ((stackDepth == 7800) || ((stackDepth == 7900) || ((stackDepth == 8001) || ((stackDepth == 8002) || ((stackDepth == 8101) || ((stackDepth == 8102) || ((stackDepth == 8103) || ((stackDepth == 8200) || ((stackDepth == 8300) || ((stackDepth == 8400) || ((stackDepth == 8501) || ((stackDepth == 8502) || ((stackDepth == 8601) || ((stackDepth == 8602) || ((stackDepth == 8700) || ((stackDepth == 8801) || ((stackDepth == 8802) || ((stackDepth == 8901) || ((stackDepth == 8902) || ((stackDepth == 8903) || ((stackDepth == 9001) || ((stackDepth == 9002) || ((stackDepth == 9003) || ((stackDepth == 9004) || ((stackDepth == 9005) || ((stackDepth == 9101) || ((stackDepth == 9102) || ((stackDepth == 9200) || ((stackDepth == 9300) || ((stackDepth == 9401) || ((stackDepth == 9402) || ((stackDepth == 9403) || ((stackDepth == 9500) || ((stackDepth == 9601) || ((stackDepth == 9602) || ((stackDepth == 9701) || ((stackDepth == 9702) || ((stackDepth == 9801) || ((stackDepth == 9802) || ((stackDepth == 9900) || ((stackDepth == 10000) || ((stackDepth == 10100) || ((stackDepth == 10201) || ((stackDepth == 10202) || ((stackDepth == 10301) || ((stackDepth == 10302) || ((stackDepth == 10401) || ((stackDepth == 10402) || ((stackDepth == 10403) || ((stackDepth == 10501) || ((stackDepth == 10502) || ((stackDepth == 10601) || ((stackDepth == 10602) || ((stackDepth == 10701) || ((stackDepth == 10702) || ((stackDepth == 10703) || ((stackDepth == 10704) || ((stackDepth == 10705) || ((stackDepth == 10706) || ((stackDepth == 10801) || ((stackDepth == 10802) || ((stackDepth == 10803) || ((stackDepth == 10804) || ((stackDepth == 10805) || ((stackDepth == 10806) || ((stackDepth == 10807) || ((stackDepth == 10808) || ((stackDepth == 10809) || ((stackDepth == 10900) || ((stackDepth == 11000) || ((stackDepth == 11100) || ((stackDepth == 11201) || ((stackDepth == 11202) || ((stackDepth == 11203) || ((stackDepth == 11204) || ((stackDepth == 11205) || ((stackDepth == 11206) || ((stackDepth == 11207) || ((stackDepth == 11208) || ((stackDepth == 11209) || ((stackDepth == 11210) || ((stackDepth == 11211) || ((stackDepth == 11212) || ((stackDepth == 11213) || ((stackDepth == 11214) || ((stackDepth == 11301) || ((stackDepth == 11302) || ((stackDepth == 11303) || ((stackDepth == 11304) || ((stackDepth == 11305) || ((stackDepth == 11306) || ((stackDepth == 11307) || ((stackDepth == 11308) || ((stackDepth == 11309) || ((stackDepth == 11401) || ((stackDepth == 11402) || ((stackDepth == 11403) || ((stackDepth == 11404) || ((stackDepth == 11501) || ((stackDepth == 11502) || ((stackDepth == 11503) || ((stackDepth == 11504) || ((stackDepth == 11505) || ((stackDepth == 11601) || ((stackDepth == 11602) || ((stackDepth == 11603) || ((stackDepth == 11604) || ((stackDepth == 11605) || ((stackDepth == 11606) || ((stackDepth == 11701) || ((stackDepth == 11702) || ((stackDepth == 11800) || ((stackDepth == 11901) || ((stackDepth == 11902) || ((stackDepth == 11903) || ((stackDepth == 11904) || ((stackDepth == 11905) || ((stackDepth == 12001) || ((stackDepth == 12002) || ((stackDepth == 12003) || ((stackDepth == 12004) || ((stackDepth == 12101) || ((stackDepth == 12102) || ((stackDepth == 12103) || ((stackDepth == 12104) || ((stackDepth == 12105) || ((stackDepth == 12106) || ((stackDepth == 12107) || ((stackDepth == 12108) || ((stackDepth == 12109) || ((stackDepth == 12110) || ((stackDepth == 12111) || ((stackDepth == 12112) || ((stackDepth == 12113) || ((stackDepth == 12114) || ((stackDepth == 12115) || ((stackDepth == 12116) || ((stackDepth == 12201) || ((stackDepth == 12202) || ((stackDepth == 12203) || ((stackDepth == 12204) || ((stackDepth == 12205) || ((stackDepth == 12301) || ((stackDepth == 12302) || ((stackDepth == 12401) || ((stackDepth == 12402) || ((stackDepth == 12403) || ((stackDepth == 12404) || ((stackDepth == 12405) || ((stackDepth == 12406) || ((stackDepth == 12501) || ((stackDepth == 12502) || ((stackDepth == 12601) || ((stackDepth == 12602) || ((stackDepth == 12603) || ((stackDepth == 12700) || ((stackDepth == 12800) || ((stackDepth == 12900) || ((stackDepth == 13001) || ((stackDepth == 13002) || ((stackDepth == 13003) || ((stackDepth == 13004) || ((stackDepth == 13005) || ((stackDepth == 13101) || ((stackDepth == 13102) || ((stackDepth == 13103) || ((stackDepth == 13201) || ((stackDepth == 13202) || ((stackDepth == 13203) || ((stackDepth == 13301) || ((stackDepth == 13302) || ((stackDepth == 13303) || ((stackDepth == 13304) || ((stackDepth == 13401) || ((stackDepth == 13402) || ((stackDepth == 13403) || ((stackDepth == 13404) || ((stackDepth == 13405) || ((stackDepth == 13501) || ((stackDepth == 13502) || ((stackDepth == 13600) || ((stackDepth == 13701) || ((stackDepth == 13702) || ((stackDepth == 13703) || ((stackDepth == 13800) || ((stackDepth == 13901) || ((stackDepth == 13902) || ((stackDepth == 13903) || ((stackDepth == 14001) || ((stackDepth == 14002) || ((stackDepth == 14100) || ((stackDepth == 14200) || ((stackDepth == 14301) || ((stackDepth == 14302) || ((stackDepth == 14400) || ((stackDepth == 14501) || ((stackDepth == 14502) || ((stackDepth == 14601) || ((stackDepth == 14602) || ((stackDepth == 14603) || ((stackDepth == 14604) || ((stackDepth == 14605) || ((stackDepth == 14606) || ((stackDepth == 14607) || ((stackDepth == 14701) || ((stackDepth == 14702) || ((stackDepth == 14703) || ((stackDepth == 14704) || ((stackDepth == 14705) || ((stackDepth == 14706) || ((stackDepth == 14707) || ((stackDepth == 14708) || ((stackDepth == 14709) || ((stackDepth == 14710) || ((stackDepth == 14711) || ((stackDepth == 14712) || ((stackDepth == 14713) || ((stackDepth == 14714) || ((stackDepth == 14715) || ((stackDepth == 14716) || ((stackDepth == 14717) || ((stackDepth == 14718) || ((stackDepth == 14719) || ((stackDepth == 14720 || ((stackDepth == 14717 || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717 || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717 || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717)))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))); + } + } +} +") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("ExpressionParsingTests.InProgressLocalDeclaration1",@" +class C +{ + async void M() + { + Task. + await Task.Delay(); + } +} +") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("ExpressionParsingTests.InProgressLocalDeclaration2",@" +class C +{ + async void M() + { + Task.await Task.Delay(); + } +} +") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("ExpressionParsingTests.InProgressLocalDeclaration3",@" +class C +{ + async void M() + { + Task. + await Task; + } +} +") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("ExpressionParsingTests.InProgressLocalDeclaration4",@" +class C +{ + async void M() + { + Task. + await Task = 1; + } +} +") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("ExpressionParsingTests.InProgressLocalDeclaration5",@" +class C +{ + async void M() + { + Task. + await Task, Task2; + } +} +") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("ExpressionParsingTests.InProgressLocalDeclaration6",@" +class C +{ + async void M() + { + Task. + await Task(); + } +} +") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("ExpressionParsingTests.InProgressLocalDeclaration7",@" +class C +{ + async void M() + { + Task. + await Task(); + } +} +") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("ExpressionParsingTests.InProgressLocalDeclaration8",@" +class C +{ + async void M() + { + Task. + await Task[1]; + } +} +") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("ExpressionParsingTests.TypeArgumentShiftAmbiguity_01",@" +class C +{ + void M() + { + //int a = 1; + //int i = 1; + var j = a < i >> 2; + } +} +") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("ExpressionParsingTests.TypeArgumentShiftAmbiguity_02",@" +class C +{ + void M() + { + //const int a = 1; + //const int i = 2; + switch (false) + { + case a < i >> 2: break; + } + } +} +") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("ExpressionParsingTests.TypeArgumentShiftAmbiguity_03",@" +class C +{ + void M() + { + M(out a < i >> 2); + } +} +") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("ExpressionParsingTests.TypeArgumentShiftAmbiguity_04",@" +class C +{ + void M() + { + // (e is a) > 2 + var j = e is a < i >> 2; + } +} +") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("ExpressionParsingTests.TypeArgumentShiftAmbiguity_05",@" +class C +{ + void M() + { + var j = e is a < i >>> 2; + } +} +") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("ExpressionParsingTests.TypeArgumentShiftAmbiguity_06",@" +class C +{ + void M() + { + // syntax error + var j = e is a < i > << 2; + } +} +") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("ExpressionParsingTests.TypeArgumentShiftAmbiguity_07",@" +class C +{ + void M() + { + // syntax error + var j = e is a < i >>>> 2; + } +} +") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("ExpressionParsingTests.TypeArgumentShiftAmbiguity_08",@" +class C +{ + void M() + { + M(out a < i >>> 2); + } +} +") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("ExpressionParsingTests.TypeArgumentShiftAmbiguity_09",@" +class C +{ + void M() + { + //const int a = 1; + //const int i = 2; + switch (false) + { + case a < i >>> 2: break; + } + } +} +") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("ExpressionParsingTests.TypeArgumentShiftAmbiguity_10",@" +class C +{ + void M() + { + //int a = 1; + //int i = 1; + var j = a < i >>> 2; + } +} +") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("ExpressionParsingTests.TestTargetTypedDefaultWithCSharp7_1","default") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("ExpressionParsingTests.MismatchedInterpolatedStringContents_01",@"class A +{ + void M() + { + if (b) + { + A B = new C($@""{D(.E}""); + N.O("""", P.Q); + R.S(T); + U.V(W.X, Y.Z); + } + } + + string M() => """"; +}") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("ExpressionParsingTests.MismatchedInterpolatedStringContents_02",@"class A +{ + void M() + { + if (b) + { + A B = new C($@""{D(.E}\F\G{H}_{I.J.K(""L"")}.M""); + N.O("""", P.Q); + R.S(T); + U.V(W.X, Y.Z); + } + } + + string M() => """"; +}") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("ExpressionParsingTests.LinqQueryInConditionalExpression1","x is X ? from item in collection select item : null") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("ExpressionParsingTests.LinqQueryInConditionalExpression2","x is X.Y ? from item in collection select item : null") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("ExpressionParsingTests.LinqQueryInConditionalExpression_Incomplete","x is X.Y ? from item") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("FunctionPointerTests.LangVersion8","delegate* unmanaged[cdecl] ptr;") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("LocalFunctionParsingTests.DiagnosticsWithoutExperimental",@" +class c +{ + void m() + { + int local() => 0; + } + void m2() + { + int local() { return 0; } + } +}") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("LocalFunctionParsingTests.StaticFunctions",@"class Program +{ + void M() + { + static void F() { } + } +}") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("LocalFunctionParsingTests.AsyncStaticFunctions",@"class Program +{ + void M() + { + static async void F1() { } + async static void F2() { } + } +}") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("LocalFunctionParsingTests.DuplicateStatic",@"class Program +{ + void M() + { + static static void F1() { } + static async static void F2() { } + } +}") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("LocalFunctionParsingTests.DuplicateAsyncs1",""" + class Program + { + void M() + { + #pragma warning disable 1998, 8321 + async async void F() { } + } + } + """) + }; + + yield return new object[] + { + new CSharpSyntaxFragment("LocalFunctionParsingTests.DuplicateAsyncs2",""" + class Program + { + void M() + { + #pragma warning disable 1998, 8321 + async async async void F() { } + } + } + """) + }; + + yield return new object[] + { + new CSharpSyntaxFragment("LocalFunctionParsingTests.DuplicateAsyncs3",""" + class Program + { + void M() + { + #pragma warning disable 1998, 8321 + async async async async void F() { } + } + } + """) + }; + + yield return new object[] + { + new CSharpSyntaxFragment("LocalFunctionParsingTests.DuplicateAsyncs4",""" + class Program + { + void M() + { + #pragma warning disable 1998, 8321 + async async async async async void F() { } + } + } + """) + }; + + yield return new object[] + { + new CSharpSyntaxFragment("LocalFunctionParsingTests.ReturnTypeBeforeStatic",@"class Program +{ + void M() + { + void static F() { } + } +}") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("LocalFunctionParsingTests.ExtraInvocationClosingParentheses",""" + public class C + { + public void M() + { + int sum0 = Sum(1, 2)); + + void Local() + { + AnotherLocal()); + + int sum1 = Sum(1, 2)); + int sum2 = Sum(1, 3)); + + void AnotherLocal() + { + int x = sum2 + 2; + } + } + } + + public static int Sum(int a, int b) => a + b; + } + """) + }; + + yield return new object[] + { + new CSharpSyntaxFragment("MemberDeclarationParsingTests.OperatorDeclaration_ExplicitImplementation_01","public int N.I.operator +(int x, int y) => x + y;") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("MemberDeclarationParsingTests.OperatorDeclaration_ExplicitImplementation_02","public int N.I.implicit (int x) => x;") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("MemberDeclarationParsingTests.OperatorDeclaration_ExplicitImplementation_03","public int N.I.explicit (int x) => x;") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("MemberDeclarationParsingTests.OperatorDeclaration_ExplicitImplementation_04","public int N.I operator +(int x) => x;") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("MemberDeclarationParsingTests.OperatorDeclaration_ExplicitImplementation_05","public int I operator +(int x) => x;") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("MemberDeclarationParsingTests.OperatorDeclaration_ExplicitImplementation_11","public int N.I.operator +(int x, int y) => x + y;") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("MemberDeclarationParsingTests.OperatorDeclaration_ExplicitImplementation_12","public int N.I.implicit (int x) => x;") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("MemberDeclarationParsingTests.OperatorDeclaration_ExplicitImplementation_13","public int N.I.explicit (int x) => x;") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("MemberDeclarationParsingTests.OperatorDeclaration_ExplicitImplementation_14","public int N.I operator +(int x) => x;") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("MemberDeclarationParsingTests.OperatorDeclaration_ExplicitImplementation_15","public int I operator +(int x) => x;") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("MemberDeclarationParsingTests.OperatorDeclaration_ExplicitImplementation_23","int N.I.operator +(int x, int y) => x + y;") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("MemberDeclarationParsingTests.OperatorDeclaration_ExplicitImplementation_24","int N.I.implicit (int x) => x;") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("MemberDeclarationParsingTests.OperatorDeclaration_ExplicitImplementation_25","int N.I.explicit (int x) => x;") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("MemberDeclarationParsingTests.OperatorDeclaration_ExplicitImplementation_26","int N.I operator +(int x) => x;") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("MemberDeclarationParsingTests.OperatorDeclaration_ExplicitImplementation_27","int I operator +(int x) => x;") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("MemberDeclarationParsingTests.OperatorDeclaration_ExplicitImplementation_33","int N.I.operator +(int x, int y) => x + y;") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("MemberDeclarationParsingTests.OperatorDeclaration_ExplicitImplementation_34","int N.I.implicit (int x) => x;") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("MemberDeclarationParsingTests.OperatorDeclaration_ExplicitImplementation_35","int N.I.explicit (int x) => x;") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("MemberDeclarationParsingTests.OperatorDeclaration_ExplicitImplementation_36","int N.I operator +(int x) => x;") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("MemberDeclarationParsingTests.OperatorDeclaration_ExplicitImplementation_37","int I operator +(int x) => x;") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("MemberDeclarationParsingTests.ConversionDeclaration_ExplicitImplementation_01","implicit N.I.operator int(int x) => x;") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("MemberDeclarationParsingTests.ConversionDeclaration_ExplicitImplementation_02","N.I.operator int(int x) => x;") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("MemberDeclarationParsingTests.ConversionDeclaration_ExplicitImplementation_04","implicit N.I operator int(int x) => x;") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("MemberDeclarationParsingTests.ConversionDeclaration_ExplicitImplementation_05","explicit I operator int(int x) => x;") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("MemberDeclarationParsingTests.ConversionDeclaration_ExplicitImplementation_11","explicit N.I.operator int(int x) => x;") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("MemberDeclarationParsingTests.ConversionDeclaration_ExplicitImplementation_12","implicit N.I int(int x) => x;") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("MemberDeclarationParsingTests.ConversionDeclaration_ExplicitImplementation_13","explicit N.I. int(int x) => x;") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("MemberDeclarationParsingTests.ConversionDeclaration_ExplicitImplementation_14","implicit N.I operator int(int x) => x;") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("MemberDeclarationParsingTests.ConversionDeclaration_ExplicitImplementation_15","explicit I operator int(int x) => x;") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("MemberDeclarationParsingTests.PropertyWithErrantSemicolon1",@" +public class Class +{ + public int MyProperty; { get; set; } + + // Pretty much anything here causes an error +} +") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("MemberDeclarationParsingTests.PropertyWithErrantSemicolon2",@" +public class Class +{ + public int MyProperty; => 0; + + // Pretty much anything here causes an error +} +") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("NameParsingTests.TestBasicName","goo") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("NameParsingTests.TestBasicNameWithTrash","/*comment*/goo/*comment2*/ bar") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("NameParsingTests.TestMissingNameDueToKeyword","class") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("NameParsingTests.TestMissingNameDueToPartialClassStart","partial class") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("NameParsingTests.TestMissingNameDueToPartialMethodStart","partial void Method()") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("NameParsingTests.TestAliasedName","goo::bar") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("NameParsingTests.TestGlobalAliasedName","global::bar") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("NameParsingTests.TestDottedName","goo.bar") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("NameParsingTests.TestAliasedDottedName","goo::bar.Zed") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("NameParsingTests.TestDoubleAliasName","goo::bar::baz") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("NameParsingTests.TestGenericName","goo") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("NameParsingTests.TestGenericNameWithTwoArguments","goo") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("NameParsingTests.TestNestedGenericName_01","goo>") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("NameParsingTests.TestNestedGenericName_02","goo>>") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("NameParsingTests.TestOpenNameWithNoCommas","goo<>") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("NameParsingTests.TestOpenNameWithAComma","goo<,>") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("NameParsingTests.TestBasicTypeName","goo") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("NameParsingTests.TestDottedTypeName","goo.bar") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("NameParsingTests.TestGenericTypeName","goo") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("NameParsingTests.TestNestedGenericTypeName_01","goo>") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("NameParsingTests.TestNestedGenericTypeName_02","goo>>") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("NameParsingTests.TestOpenTypeNameWithNoCommas","goo<>") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("NameParsingTests.TestNullableTypeName","goo?") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("NameParsingTests.TestPointerTypeName","goo*") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("NameParsingTests.TestPointerTypeNameWithMultipleAsterisks","goo***") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("NameParsingTests.TestArrayTypeName","goo[]") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("NameParsingTests.TestMultiDimensionalArrayTypeName","goo[,,]") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("NameParsingTests.TestMultiRankedArrayTypeName","goo[][,][,,]") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("NameParsingTests.TestVarianceInNameBad","goo") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("NameParsingTests.TestAttributeInNameBad","goo<[My]bar>") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("NameParsingTests.TestConstantInGenericNameBad","goo<0>") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("NameParsingTests.TestConstantInGenericNamePartiallyBad","goo<0,bool>") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("NameParsingTests.TestKeywordInGenericNameBad","goo") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("NameParsingTests.TestAttributeAndVarianceInNameBad","goo<[My]in bar>") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("NameParsingTests.TestFormattingCharacter","\u0915\u094d\u200d\u0937") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("NameParsingTests.TestSoftHyphen","x\u00ady") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("ParserErrorMessageTests.CS1009ERR_IllegalEscape_Strings",@" +class Program +{ + static void Main() + { + string s; + s = ""\u""; + s = ""\u0""; + s = ""\u00""; + s = ""\u000""; + + s = ""a\uz""; + s = ""a\u0z""; + s = ""a\u00z""; + s = ""a\u000z""; + } +} +") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("ParserErrorMessageTests.CS1009ERR_IllegalEscape_Identifiers",@"using System; +class Program +{ + static void Main() + { + int \u; + int \u0; + int \u00; + int \u000; + + int a\uz; + int a\u0z; + int a\u00z; + int a\u000z; + } +} +") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("ParserErrorMessageTests.CS1031ERR_TypeExpected02",@"namespace x +{ + public class a + { + public static void Main() + { + e = new base; // CS1031, not a type + e = new this; // CS1031, not a type + } + } +} +") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("ParserErrorMessageTests.CS1031ERR_TypeExpected02_Tuple",@"namespace x +{ + public class @a + { + public static void Main() + { + var e = new (); + } + } +} +") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("ParserErrorMessageTests.CS1031ERR_TypeExpected02WithCSharp6",@"namespace x +{ + public class a + { + public static void Main() + { + e = new base; // CS1031, not a type + e = new this; // CS1031, not a type + } + } +} +") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("ParserErrorMessageTests.CS1031ERR_TypeExpected02WithCSharp6_Tuple",@"namespace x +{ + public class @a + { + public static void Main() + { + var e = new (); + } + } +} +") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("ParserErrorMessageTests.CS1031ERR_TypeExpected02WithCSharp7_Tuple",@"namespace x +{ + public class @a + { + public static void Main() + { + var e = new (); + } + } +} +") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("ParserErrorMessageTests.InvalidQueryExpression",@" +using System; +using System.Linq; + +public class QueryExpressionTest +{ + public static void Main() + { + var expr1 = new[] { 1, 2, 3 }; + var expr2 = new[] { 1, 2, 3 }; + + var query13 = from const in expr1 join i in expr2 on const equals i select new { const, i }; + } +} +") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("ParserErrorMessageTests.PartialTypesBeforeVersionTwo",@" +partial class C +{ +} +") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("ParserErrorMessageTests.PartialMethodsVersionThree",@" +class C +{ + partial int Goo() { } +} +") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("ParserErrorMessageTests.QueryBeforeVersionThree",@" +class C +{ + void Goo() + { + var q = from a in b + select c; + } +} +") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("ParserErrorMessageTests.AnonymousTypeBeforeVersionThree",@" +class C +{ + void Goo() + { + var q = new { }; + } +} +") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("ParserErrorMessageTests.ImplicitArrayBeforeVersionThree",@" +class C +{ + void Goo() + { + var q = new [] { }; + } +} +") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("ParserErrorMessageTests.ObjectInitializerBeforeVersionThree",@" +class C +{ + void Goo() + { + var q = new Goo { }; + } +} +") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("ParserErrorMessageTests.LambdaBeforeVersionThree",@" +class C +{ + void Goo() + { + var q = a => b; + } +} +") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("ParserErrorMessageTests.ExceptionFilterBeforeVersionSix",@" +public class C +{ + public static int Main() + { + try { } catch when (true) {} + } +} +") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("ParserErrorMessageTests.MissingCommaInAttribute",@"[One Two] // error: missing comma +class TestClass { }") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("ParserErrorMessageTests.InterpolatedStringBeforeCSharp6",@" +class C +{ + string M() + { + return $""hello""; + } +}") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("ParserErrorMessageTests.InterpolatedStringWithReplacementBeforeCSharp6",@" +class C +{ + string M() + { + string other = ""world""; + return $""hello + {other}""; + } +}") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("ParserErrorMessageTests.AsyncBeforeCSharp5",@" +class C +{ + async void M() { } +} +") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("ParserErrorMessageTests.AsyncWithOtherModifiersBeforeCSharp5",@" +class C +{ + async static void M() { } +} +") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("ParserErrorMessageTests.AsyncLambdaBeforeCSharp5",@" +class C +{ + static void Main() + { + Func> f = async x => x; + } +} +") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("ParserErrorMessageTests.AsyncDelegateBeforeCSharp5",@" +class C +{ + static void Main() + { + Func> f = async delegate (int x) { return x; }; + } +} +") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("ParserErrorMessageTests.NamedArgumentBeforeCSharp4",@" +[Attr(x:1)] +class C +{ + C() + { + M(y:2); + } +} +") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("ParserErrorMessageTests.GlobalKeywordBeforeCSharp2",@" +class C : global::B +{ +} +") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("ParserErrorMessageTests.AliasQualifiedNameBeforeCSharp2",@" +class C : A::B +{ +} +") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("ParserErrorMessageTests.OptionalParameterBeforeCSharp4",@" +class C +{ + void M(int x = 1) { } +} +") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("ParserErrorMessageTests.ObjectInitializerBeforeCSharp3",@" +class C +{ + void M() + { + return new C { Goo = 1 }; + } +} +") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("ParserErrorMessageTests.CollectionInitializerBeforeCSharp3",@" +class C +{ + void M() + { + return new C { 1, 2, 3 }; + } +} +") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("ParserErrorMessageTests.CrefGenericBeforeCSharp2",@" +/// +class C +{ +} +") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("ParserErrorMessageTests.CrefAliasQualifiedNameBeforeCSharp2",@" +/// +/// +class C { } +") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("ParserErrorMessageTests.PragmaBeforeCSharp2",@" +#pragma warning disable 1584 +#pragma checksum ""file.txt"" ""{00000000-0000-0000-0000-000000000000}"" ""2453"" +class C { } +") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("ParserErrorMessageTests.PragmaBeforeCSharp2_InDisabledCode",@" +#if UNDEF +#pragma warning disable 1584 +#pragma checksum ""file.txt"" ""{00000000-0000-0000-0000-000000000000}"" ""2453"" +#endif +class C { } +") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("ParserErrorMessageTests.AwaitAsIdentifierInAsyncContext",@" +class C +{ + async void f() + { + int await; + } +} +") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("PatternParsingTests.ParenthesizedSwitchCase",@" +switch (e) +{ + case (0): break; + case (-1): break; + case (+2): break; + case (~3): break; +} +") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("RawInterpolatedStringLiteralParsingTests.SingleLine1",@" +class C +{ + void M() + { + var v = $"""""" """"""; + } +}") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("RawInterpolatedStringLiteralParsingTests.SingleLineTooManyCloseQuotes1",@" +class C +{ + void M() + { + var v = $"""""" """"""""; + } +}") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("RawInterpolatedStringLiteralParsingTests.SingleLineTooManyCloseQuotes2",@" +class C +{ + void M() + { + var v = $"""""" """"""""""; + } +}") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("RawInterpolatedStringLiteralParsingTests.SingleLineSingleQuoteInside",@" +class C +{ + void M() + { + var v = $"""""" "" """"""; + } +}") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("RawInterpolatedStringLiteralParsingTests.SingleLineDoubleQuoteInside",@" +class C +{ + void M() + { + var v = $"""""" """" """"""; + } +}") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("RawInterpolatedStringLiteralParsingTests.SingleLineInterpolationInside",@" +class C +{ + void M() + { + var v = $""""""{0}""""""; + } +}") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("RawInterpolatedStringLiteralParsingTests.SingleLineInterpolationInsideSpacesOutside",@" +class C +{ + void M() + { + var v = $"""""" {0} """"""; + } +}") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("RawInterpolatedStringLiteralParsingTests.SingleLineInterpolationInsideSpacesInside",@" +class C +{ + void M() + { + var v = $""""""{ 0 }""""""; + } +}") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("RawInterpolatedStringLiteralParsingTests.SingleLineInterpolationInsideSpacesInsideAndOutside",@" +class C +{ + void M() + { + var v = $"""""" { 0 } """"""; + } +}") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("RawInterpolatedStringLiteralParsingTests.SingleLineInterpolationMultipleCurliesNotAllowed1",@" +class C +{ + void M() + { + var v = $""""""{{0}}""""""; + } +}") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("RawInterpolatedStringLiteralParsingTests.SingleLineInterpolationMultipleCurliesNotAllowed2",@" +class C +{ + void M() + { + var v = $$""""""{{{{0}}}}""""""; + } +}") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("RawInterpolatedStringLiteralParsingTests.SingleLineInterpolationMultipleCurliesNotAllowed3",@" +class C +{ + void M() + { + var v = $""""""{0}}}""""""; + } +}") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("RawInterpolatedStringLiteralParsingTests.SingleLineInterpolationMultipleCurliesNotAllowed4",@" +class C +{ + void M() + { + var v = $$""""""{{{0}}}}""""""; + } +}") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("RawInterpolatedStringLiteralParsingTests.SingleLineInterpolationMultipleCurliesNotAllowed5",@" +class C +{ + void M() + { + var v = $$""""""{0}}""""""; + } +}") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("RawInterpolatedStringLiteralParsingTests.SingleLineInterpolationMultipleCurliesNotAllowed6",@" +class C +{ + void M() + { + var v = $$""""""{{{0}""""""; + } +}") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("RawInterpolatedStringLiteralParsingTests.SingleLineInterpolationMultipleCurliesAllowed1",@" +class C +{ + void M() + { + var v = $$""""""{{0}}""""""; + } +}") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("RawInterpolatedStringLiteralParsingTests.SingleLineInterpolationMultipleCurliesAllowed2",@" +class C +{ + void M() + { + var v = $$""""""{{{0}}}""""""; + } +}") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("RawInterpolatedStringLiteralParsingTests.SingleLineInterpolationMultipleCurliesAllowed4",@" +class C +{ + void M() + { + var v = $$""""""{{{0}}""""""; + } +}") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("RawInterpolatedStringLiteralParsingTests.SingleLineInterpolationContainingNormalString",@" +class C +{ + void M() + { + var v = $""""""{""a""}""""""; + } +}") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("RawInterpolatedStringLiteralParsingTests.SingleLineInterpolationContainingVerbatimString1",@" +class C +{ + void M() + { + var v = $""""""{@""a""}""""""; + } +}") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("RawInterpolatedStringLiteralParsingTests.SingleLineInterpolationContainingVerbatimString2",@" +class C +{ + void M() + { + var v = $""""""{@"" +a""}""""""; + } +}") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("RawInterpolatedStringLiteralParsingTests.SingleLineInterpolationContainingInterpolatedString1",@" +class C +{ + void M() + { + var v = $""""""{$""a""}""""""; + } +}") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("RawInterpolatedStringLiteralParsingTests.SingleLineInterpolationContainingInterpolatedString2",@" +class C +{ + void M() + { + var v = $""""""{$""{0}""}""""""; + } +}") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("RawInterpolatedStringLiteralParsingTests.SingleLineInterpolationContainingVerbatimInterpolatedString1",@" +class C +{ + void M() + { + var v = $""""""{$@""{0}""}""""""; + } +}") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("RawInterpolatedStringLiteralParsingTests.SingleLineInterpolationContainingVerbatimInterpolatedString2",@" +class C +{ + void M() + { + var v = $""""""{@$""{0}""}""""""; + } +}") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("RawInterpolatedStringLiteralParsingTests.SingleLineInterpolationContainingVerbatimInterpolatedString3",@" +class C +{ + void M() + { + var v = $""""""{$@""{ +0}""}""""""; + } +}") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("RawInterpolatedStringLiteralParsingTests.SingleLineInterpolationContainingVerbatimInterpolatedString4",@" +class C +{ + void M() + { + var v = $""""""{ +$@""{ +0}""}""""""; + } +}") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("RawInterpolatedStringLiteralParsingTests.SingleLineInterpolationContainingRawStringLiteral1",@" +class C +{ + void M() + { + var v = $""""""{""""""a""""""}""""""; + } +}") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("RawInterpolatedStringLiteralParsingTests.SingleLineInterpolationContainingRawStringLiteral2",@" +class C +{ + void M() + { + var v = $""""""{"""""" + a + """"""}""""""; + } +}") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("RawInterpolatedStringLiteralParsingTests.SingleLineInterpolationContainingRawStringLiteral3",@" +class C +{ + void M() + { + var v = $""""""{"""""" + a + """"""}""""""; + } +}") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("RawInterpolatedStringLiteralParsingTests.SingleLineInterpolationContainingRawInterpolatedStringLiteral1",@" +class C +{ + void M() + { + var v = $""""""{$"""""" """"""}""""""; + } +}") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("RawInterpolatedStringLiteralParsingTests.SingleLineInterpolationContainingRawInterpolatedStringLiteral2",@" +class C +{ + void M() + { + var v = $""""""{$"""""""" """"""""}""""""; + } +}") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("RawInterpolatedStringLiteralParsingTests.SingleLineInterpolationContainingRawInterpolatedStringLiteral3",@" +class C +{ + void M() + { + var v = $""""""{$""""""{0}""""""}""""""; + } +}") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("RawInterpolatedStringLiteralParsingTests.SingleLineInterpolationContainingRawInterpolatedStringLiteral4",@" +class C +{ + void M() + { + var v = $""""""{$""""""{ +0}""""""}""""""; + } +}") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("RawInterpolatedStringLiteralParsingTests.SingleLineInterpolationContainingRawInterpolatedStringLiteral5",@" +class C +{ + void M() + { + var v = $""""""{ +$""""""{ +0}""""""}""""""; + } +}") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("RawInterpolatedStringLiteralParsingTests.SingleLineInterpolationContainingRawInterpolatedStringLiteral6",@" +class C +{ + void M() + { + var v = $""""""{$$""""""{{0}}""""""}""""""; + } +}") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("RawInterpolatedStringLiteralParsingTests.SingleLineInterpolationContainingRawInterpolatedStringLiteral7",@" +class C +{ + void M() + { + var v = $""""""{$$""""""{{{0}}}""""""}""""""; + } +}") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("RawInterpolatedStringLiteralParsingTests.SingleLineInterpolationContainingRawInterpolatedStringLiteral8",@" +class C +{ + void M() + { + var v = $$""""""{{{$""""""{0}""""""}}}""""""; + } +}") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("RawInterpolatedStringLiteralParsingTests.SingleLineInterpolationContainingClosingBraceAsCharacterLiteral",@" +class C +{ + void M() + { + var v = $""""""{'}'}""""""; + } +}") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("RawInterpolatedStringLiteralParsingTests.SingleLineInterpolationContainingClosingBraceAsRegularStringLiteral",@" +class C +{ + void M() + { + var v = $""""""{""}""}""""""; + } +}") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("RawInterpolatedStringLiteralParsingTests.SingleLineInterpolationContainingClosingBraceAsVerbatimStringLiteral",@" +class C +{ + void M() + { + var v = $""""""{@""}""}""""""; + } +}") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("RawInterpolatedStringLiteralParsingTests.SingleLineInterpolationContainingClosingBraceAsRawStringLiteral",@" +class C +{ + void M() + { + var v = $""""""{""""""}""""""}""""""; + } +}") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("RawInterpolatedStringLiteralParsingTests.OuterNormalMiddleNormalInnerNormal",@" +class C +{ + void M() + { + var v = $""{$""{$""{0}""}""}""; + } +}") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("RawInterpolatedStringLiteralParsingTests.OuterNormalMiddleNormalInnerVerbatim",@" +class C +{ + void M() + { + var v = $""{$""{$@""{0}""}""}""; + } +}") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("RawInterpolatedStringLiteralParsingTests.OuterNormalMiddleNormalInnerRaw",@" +class C +{ + void M() + { + var v = $""{$""{$""""""{0}""""""}""}""; + } +}") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("RawInterpolatedStringLiteralParsingTests.OuterNormalMiddleVerbatimInnerNormal",@" +class C +{ + void M() + { + var v = $""{@$""{$""{0}""}""}""; + } +}") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("RawInterpolatedStringLiteralParsingTests.OuterNormalMiddleVerbatimInnerVerbatim",@" +class C +{ + void M() + { + var v = $""{@$""{@$""{0}""}""}""; + } +}") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("RawInterpolatedStringLiteralParsingTests.OuterNormalMiddleVerbatimInnerRaw",@" +class C +{ + void M() + { + var v = $""{@$""{$""""""{0}""""""}""}""; + } +}") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("RawInterpolatedStringLiteralParsingTests.OuterNormalMiddleRawInnerNormal",@" +class C +{ + void M() + { + var v = $""{$""""""{$""{0}""}""""""}""; + } +}") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("RawInterpolatedStringLiteralParsingTests.OuterNormalMiddleRawInnerVerbatim",@" +class C +{ + void M() + { + var v = $""{$""""""{@$""{0}""}""""""}""; + } +}") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("RawInterpolatedStringLiteralParsingTests.OuterNormalMiddleRawInnerRaw",@" +class C +{ + void M() + { + var v = $""{$""""""{$""""""{0}""""""}""""""}""; + } +}") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("RawInterpolatedStringLiteralParsingTests.OuterVerbatimMiddleNormalInnerNormal",@" +class C +{ + void M() + { + var v = $@""{$""{$""{0}""}""}""; + } +}") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("RawInterpolatedStringLiteralParsingTests.OuterVerbatimMiddleNormalInnerVerbatim",@" +class C +{ + void M() + { + var v = $@""{$""{$@""{0}""}""}""; + } +}") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("RawInterpolatedStringLiteralParsingTests.OuterVerbatimMiddleNormalInnerRaw",@" +class C +{ + void M() + { + var v = $@""{$""{$""""""{0}""""""}""}""; + } +}") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("RawInterpolatedStringLiteralParsingTests.OuterVerbatimMiddleVerbatimInnerNormal",@" +class C +{ + void M() + { + var v = $@""{@$""{$""{0}""}""}""; + } +}") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("RawInterpolatedStringLiteralParsingTests.OuterVerbatimMiddleVerbatimInnerVerbatim",@" +class C +{ + void M() + { + var v = $@""{@$""{@$""{0}""}""}""; + } +}") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("RawInterpolatedStringLiteralParsingTests.OuterVerbatimMiddleVerbatimInnerRaw",@" +class C +{ + void M() + { + var v = $@""{@$""{$""""""{0}""""""}""}""; + } +}") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("RawInterpolatedStringLiteralParsingTests.OuterVerbatimMiddleRawInnerNormal",@" +class C +{ + void M() + { + var v = $@""{$""""""{$""{0}""}""""""}""; + } +}") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("RawInterpolatedStringLiteralParsingTests.OuterVerbatimMiddleRawInnerVerbatim",@" +class C +{ + void M() + { + var v = $@""{$""""""{@$""{0}""}""""""}""; + } +}") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("RawInterpolatedStringLiteralParsingTests.OuterVerbatimMiddleRawInnerRaw",@" +class C +{ + void M() + { + var v = $@""{$""""""{$""""""{0}""""""}""""""}""; + } +}") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("RawInterpolatedStringLiteralParsingTests.OuterRawMiddleNormalInnerNormal",@" +class C +{ + void M() + { + var v = $""""""{$""{$""{0}""}""}""""""; + } +}") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("RawInterpolatedStringLiteralParsingTests.OuterRawMiddleNormalInnerVerbatim",@" +class C +{ + void M() + { + var v = $""""""{$""{$@""{0}""}""}""""""; + } +}") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("RawInterpolatedStringLiteralParsingTests.OuterRawMiddleNormalInnerRaw",@" +class C +{ + void M() + { + var v = $""""""{$""{$""""""{0}""""""}""}""""""; + } +}") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("RawInterpolatedStringLiteralParsingTests.OuterRawMiddleVerbatimInnerNormal",@" +class C +{ + void M() + { + var v = $""""""{@$""{$""{0}""}""}""""""; + } +}") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("RawInterpolatedStringLiteralParsingTests.OuterRawMiddleVerbatimInnerVerbatim",@" +class C +{ + void M() + { + var v = $""""""{@$""{@$""{0}""}""}""""""; + } +}") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("RawInterpolatedStringLiteralParsingTests.OuterRawMiddleVerbatimInnerRaw",@" +class C +{ + void M() + { + var v = $""""""{@$""{$""""""{0}""""""}""}""""""; + } +}") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("RawInterpolatedStringLiteralParsingTests.OuterRawMiddleRawInnerNormal",@" +class C +{ + void M() + { + var v = $""""""{$""""""{$""{0}""}""""""}""""""; + } +}") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("RawInterpolatedStringLiteralParsingTests.OuterRawMiddleRawInnerVerbatim",@" +class C +{ + void M() + { + var v = $""""""{$""""""{@$""{0}""}""""""}""""""; + } +}") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("RawInterpolatedStringLiteralParsingTests.OuterRawMiddleRawInnerRaw",@" +class C +{ + void M() + { + var v = $""""""{$""""""{$""""""{0}""""""}""""""}""""""; + } +}") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("RawInterpolatedStringLiteralParsingTests.MultipleAtSigns1",@" +class C +{ + void M() + { + var v = @@; + } +}") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("RawInterpolatedStringLiteralParsingTests.MultipleAtSigns2",@" +class C +{ + void M() + { + var v = @@""; + } +}") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("RawInterpolatedStringLiteralParsingTests.MultipleAtSigns3",@" +class C +{ + void M() + { + var v = @@"" ""; + } +}") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("RawInterpolatedStringLiteralParsingTests.MultipleAtSigns4",@" +class C +{ + void M() + { + var v = @@"""""" """"""; + } +}") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("RawInterpolatedStringLiteralParsingTests.MultipleAtSigns5",@" +class C +{ + void M() + { + var v = @@@; + } +}") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("RawInterpolatedStringLiteralParsingTests.MultipleAtSigns6",@" +class C +{ + void M() + { + var v = @@@""; + } +}") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("RawInterpolatedStringLiteralParsingTests.MultipleAtSigns7",@" +class C +{ + void M() + { + var v = @@@"" ""; + } +}") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("RawInterpolatedStringLiteralParsingTests.MultipleAtSigns8",@" +class C +{ + void M() + { + var v = @@@"""""" """"""; + } +}") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("RawInterpolatedStringLiteralParsingTests.DollarThenAt1",@" +class C +{ + void M() + { + var v = $@@; + } +}") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("RawInterpolatedStringLiteralParsingTests.DollarThenAt2",@" +class C +{ + void M() + { + var v = $@@""; + } +}") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("RawInterpolatedStringLiteralParsingTests.DollarThenAt3",@" +class C +{ + void M() + { + var v = $@@"" ""; + } +}") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("RawInterpolatedStringLiteralParsingTests.DollarThenAt4",@" +class C +{ + void M() + { + var v = $@@"""""" """"""; + } +}") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("RawInterpolatedStringLiteralParsingTests.DollarThenAt5",@" +class C +{ + void M() + { + var v = $@@@; + } +}") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("RawInterpolatedStringLiteralParsingTests.DollarThenAt6",@" +class C +{ + void M() + { + var v = $@@@""; + } +}") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("RawInterpolatedStringLiteralParsingTests.DollarThenAt7",@" +class C +{ + void M() + { + var v = $@@@"" ""; + } +}") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("RawInterpolatedStringLiteralParsingTests.DollarThenAt8",@" +class C +{ + void M() + { + var v = $@@@"""""" """"""; + } +}") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("RawInterpolatedStringLiteralParsingTests.AtThenDollar1",@" +class C +{ + void M() + { + var v = @@$; + } +}") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("RawInterpolatedStringLiteralParsingTests.AtThenDollar2",@" +class C +{ + void M() + { + var v = @@$""; + } +}") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("RawInterpolatedStringLiteralParsingTests.AtThenDollar3",@" +class C +{ + void M() + { + var v = @@$"" ""; + } +}") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("RawInterpolatedStringLiteralParsingTests.AtThenDollar4",@" +class C +{ + void M() + { + var v = @@$"""""" """"""; + } +}") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("RawInterpolatedStringLiteralParsingTests.AtThenDollar5",@" +class C +{ + void M() + { + var v = @@$$; + } +}") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("RawInterpolatedStringLiteralParsingTests.AtThenDollar6",@" +class C +{ + void M() + { + var v = @@$$""; + } +}") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("RawInterpolatedStringLiteralParsingTests.AtThenDollar7",@" +class C +{ + void M() + { + var v = @@$$"" ""; + } +}") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("RawInterpolatedStringLiteralParsingTests.AtThenDollar8",@" +class C +{ + void M() + { + var v = @@$$"""""" """"""; + } +}") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("RawInterpolatedStringLiteralParsingTests.AtThenDollarThenAt1",@" +class C +{ + void M() + { + var v = @@$@; + } +}") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("RawInterpolatedStringLiteralParsingTests.AtThenDollarThenAt2",@" +class C +{ + void M() + { + var v = @@$@""; + } +}") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("RawInterpolatedStringLiteralParsingTests.AtThenDollarThenAt3",@" +class C +{ + void M() + { + var v = @@$@"" ""; + } +}") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("RawInterpolatedStringLiteralParsingTests.AtThenDollarThenAt4",@" +class C +{ + void M() + { + var v = @@$@"""""" """"""; + } +}") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("RawInterpolatedStringLiteralParsingTests.AtThenDollarThenAt5",@" +class C +{ + void M() + { + var v = @@$$@; + } +}") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("RawInterpolatedStringLiteralParsingTests.AtThenDollarThenAt6",@" +class C +{ + void M() + { + var v = @@$$@""; + } +}") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("RawInterpolatedStringLiteralParsingTests.AtThenDollarThenAt7",@" +class C +{ + void M() + { + var v = @@$$@"" ""; + } +}") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("RawInterpolatedStringLiteralParsingTests.AtThenDollarThenAt8",@" +class C +{ + void M() + { + var v = @@$$@"""""" """"""; + } +}") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("RawInterpolatedStringLiteralParsingTests.DollarsWithoutQuotes0",@" +class C +{ + void M() + { + var v = $; + } +}") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("RawInterpolatedStringLiteralParsingTests.DollarsWithoutQuotes1",@" +class C +{ + void M() + { + var v = $$; + } +}") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("RawInterpolatedStringLiteralParsingTests.DollarsWithoutQuotes2",@" +class C +{ + void M() + { + var v = $$$; + } +}") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("RawInterpolatedStringLiteralParsingTests.DollarsWithQuotes1",@" +class C +{ + void M() + { + var v = $$""; + } +}") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("RawInterpolatedStringLiteralParsingTests.DollarsWithQuotes2",@" +class C +{ + void M() + { + var v = $$"" ""; + } +}") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("RawInterpolatedStringLiteralParsingTests.DollarsWithQuotes3",@" +class C +{ + void M() + { + var v = $$"""" """"; + } +}") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("RawInterpolatedStringLiteralParsingTests.DollarsWithQuotes2_MultiLine",@" +class C +{ + void M() + { + var v = $$"" + +""; + } +}") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("RawInterpolatedStringLiteralParsingTests.DollarsWithQuotes3_MultiLine",@" +class C +{ + void M() + { + var v = $$"""" + +""""; + } +}") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("ReadOnlyStructs.ReadOnlyStructSimple",@" +class Program +{ + readonly struct S1{} + + public readonly struct S2{} + + readonly public struct S3{} +} +") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("ReadOnlyStructs.ReadOnlyStructSimpleLangVer",@" +class Program +{ + readonly struct S1{} + + public readonly struct S2{} + + readonly public struct S3{} +} +") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("ReadOnlyStructs.ReadOnlyClassErr",@" +class Program +{ + readonly class S1{} + + public readonly delegate ref readonly int S2(); + + readonly public interface S3{} +} +") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("ReadOnlyStructs.ReadOnlyRefStruct",@" +class Program +{ + readonly ref struct S1{} + + unsafe readonly public ref struct S2{} +} +") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("ReadOnlyStructs.ReadOnlyStructPartialMatchingModifiers",@" +class Program +{ + readonly partial struct S1{} + + readonly partial struct S1{} + + readonly ref partial struct S2{} + + readonly ref partial struct S2{} +} +") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("ReadOnlyStructs.ReadOnlyStructPartialNotMatchingModifiers",@" +class Program +{ + readonly partial struct S1{} + + readonly ref partial struct S1{} + + readonly partial struct S2{} + + partial struct S2{} + + readonly ref partial struct S3{} + + partial struct S3{} +} +") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("RecordParsingTests.FieldNamedData",@" +class C +{ + int data; +}") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("RecordParsingTests.RecordParsing01","record C(int X, int Y);") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("RecordParsingTests.RecordParsing02","record C(int X, int Y);") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("RecordParsingTests.RecordParsing03","record C;") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("RecordParsingTests.RecordParsing04","record C { public int record; }") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("RecordParsingTests.RecordParsing05","record Point;") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("RecordParsingTests.RecordParsing07","interface P(int x, int y);") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("RecordParsingTests.RecordParsingAmbiguities",@" +record R1() { return null; } +abstract record D +{ + record R2() { return null; } + abstract record R3(); +}") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("RecordParsingTests.RecordParsing_BlockBodyAndSemiColon","record C { };") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("RecordParsingTests.WithParsingLangVer",@" +class C +{ + int x = 0 with {}; +}") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("RecordParsingTests.WithParsing1",@" +class C +{ + with { }; + x with { }; + int x = with { }; + int x = 0 with { }; +}") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("RecordParsingTests.WithParsing2",@" +class C +{ + int M() + { + int x = M() with { } + 3; + } +}") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("RecordParsingTests.WithParsing3","0 with {") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("RecordParsingTests.WithParsing4","0 with { X") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("RecordParsingTests.WithParsing5","0 with { X 3 =,") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("RecordParsingTests.WithParsing6",@"M() with { } switch { }") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("RecordParsingTests.WithParsing7",@"M() with { } + 3") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("RecordParsingTests.WithParsing8",@"M() with { }.ToString()") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("RecordParsingTests.WithParsing9",@"M() with { } with { }") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("RecordParsingTests.WithParsing12",@"M() switch { } with { }") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("RecordParsingTests.WithParsing13",@"M(out await with)") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("RecordParsingTests.WithParsing14",@"x is int y with {}") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("RecordParsingTests.WithParsing15",@"x with { X = ""2"" }") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("RecordParsingTests.WithParsing16",@"x with { X = ""2"" };") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("RecordParsingTests.WithParsing17",@"x = x with { X = ""2"" };") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("RecordParsingTests.WithParsing18",@"x with { A = e is T y B = y }") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("RecordParsingTests.WithParsingInConditionalExpression1","x is X ? record with { } : record with { }") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("RecordParsingTests.WithParsingInConditionalExpression2","x is X.Y ? record with { } : record with { }") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("RecordParsingTests.WithParsingInConditionalExpression_Incomplete","x is X ? record with") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("RecordParsingTests.Base_03","interface C : B;") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("RecordParsingTests.Base_04","interface C(int X, int Y) : B;") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("RecordParsingTests.Base_05","interface C : B(X, Y);") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("RecordParsingTests.RecordStructParsing_RecordNamedStruct","record struct(int X, int Y);") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("RecordParsingTests.RecordStructParsing","record struct C(int X, int Y);") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("RecordParsingTests.RecordStructParsing_WithBody","record struct C(int X, int Y) { }") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("RecordParsingTests.RecordClassParsing","record class C(int X, int Y);") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("RecordParsingTests.RecordInterfaceParsing","record interface C(int X, int Y);") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("RecordParsingTests.RecordRecordParsing","record record C(int X, int Y);") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("RecordParsingTests.RecordStructParsing_WrongOrder_CSharp10","struct record C(int X, int Y);") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("RecordParsingTests.RecordStructParsing_WrongOrder_CSharp9","struct record C(int X, int Y);") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("RecordParsingTests.StructNamedRecord_CSharp8","struct record { }") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("RecordParsingTests.StructNamedRecord_CSharp9","struct record { }") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("RecordParsingTests.StructNamedRecord_CSharp10","struct record { }") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("RecordParsingTests.RecordClassParsing_WrongOrder_CSharp10","class record C(int X, int Y);") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("RecordParsingTests.RecordClassParsing_WrongOrder_CSharp9","class record C(int X, int Y);") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("RecordParsingTests.RecordInterfaceParsing_WrongOrder","interface record C(int X, int Y);") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("RecordParsingTests.RecordStructParsing_Partial","partial record struct S;") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("RecordParsingTests.RecordClassParsing_Partial","partial record class S;") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("RecordParsingTests.RecordParsing_Partial","partial record S;") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("RecordParsingTests.RecordStructParsing_Partial_WithParameterList","partial record struct S(int X);") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("RecordParsingTests.RecordStructParsing_Partial_WithParameterList_AndMembers","partial record struct S(int X) { }") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("RecordParsingTests.RecordStructParsing_Readonly","readonly record struct S;") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("RecordParsingTests.RecordStructParsing_ReadonlyPartial","readonly partial record struct S;") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("RecordParsingTests.RecordStructParsing_PartialReadonly","partial readonly record struct S;") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("RecordParsingTests.RecordStructParsing_New","new record struct S;") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("RecordParsingTests.RecordStructParsing_Ref","ref record struct S;") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("RecordParsingTests.RecordParsing_Ref","ref record R;") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("RecordParsingTests.RecordStructParsing_Const","const record struct S;") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("RecordParsingTests.RecordStructParsing_Fixed","fixed record struct S;") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("RecordParsingTests.RecordStructParsing_BaseListWithParens","record struct S : Base(1);") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("RecordParsingTests.RecordStructParsing_BaseListWithParens_WithPositionalParameterList","record struct S(int X) : Base(1);") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("RefReadonlyTests.RefReadonlyReturn_CSharp7",@" +unsafe class Program +{ + delegate ref readonly int D1(); + + static ref readonly T M() + { + return ref (new T[1])[0]; + } + + public virtual ref readonly int* P1 => throw null; + + public ref readonly int[][] this[int i] => throw null; +} +") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("RefReadonlyTests.InArgs_CSharp7",@" +class Program +{ + static void M(in int x) + { + } + + int this[in int x] + { + get + { + return 1; + } + } + + static void Test1() + { + int x = 1; + M(in x); + + _ = (new Program())[in x]; + } +} +") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("RefReadonlyTests.RefReadonlyReturn_Unexpected",@" + +class Program +{ + static void Main() + { + } + + ref readonly int Field; + + public static ref readonly Program operator +(Program x, Program y) + { + throw null; + } + + // this parses fine + static async ref readonly Task M() + { + throw null; + } + + public ref readonly virtual int* P1 => throw null; + +} +") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("RefReadonlyTests.RefReadonlyReturn_UnexpectedBindTime",@" + +class Program +{ + static void Main() + { + ref readonly int local = ref (new int[1])[0]; + + (ref readonly int, ref readonly int Alice)? t = null; + + System.Collections.Generic.List x = null; + + Use(local); + Use(t); + Use(x); + } + + static void Use(T dummy) + { + } +} +") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("RefStructs.RefStructSimple",@" +class Program +{ + ref struct S1{} + + public ref struct S2{} +} +") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("RefStructs.RefStructSimpleLangVer",@" +class Program +{ + ref struct S1{} + + public ref struct S2{} +} +") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("RefStructs.RefStructErr",@" +class Program +{ + ref class S1{} + + public ref unsafe struct S2{} + + ref interface I1{}; + + public ref delegate ref int D1(); +} +") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("RefStructs.PartialRefStruct",@" +class Program +{ + partial ref struct S {} + partial ref struct S {} +} +") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("SeparatedSyntaxListParsingTests.TypeArguments2WithCSharp6",@" +class C +{ + new C<>(); + new C<, >(); + C> a1; + C> a1; + object a1 = typeof(C, int>); + object a2 = Swap<>(1, 1); +} + +class M<,> { } +") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("StatementParsingTests.TestDottedName","a.b();") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("StatementParsingTests.TestGenericName","a();") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("StatementParsingTests.TestGenericDotName","a.c();") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("StatementParsingTests.TestDotGenericName","a.b();") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("StatementParsingTests.TestLocalDeclarationStatement","T a;") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("StatementParsingTests.TestLocalDeclarationStatementWithVar","var a;") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("StatementParsingTests.TestLocalDeclarationStatementWithTuple","(int, int) a;") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("StatementParsingTests.TestLocalDeclarationStatementWithNamedTuple","(T x, (U k, V l, W m) y) a;") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("StatementParsingTests.TestLocalDeclarationStatementWithDynamic","dynamic a;") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("StatementParsingTests.TestLocalDeclarationStatementWithGenericType","T b;") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("StatementParsingTests.TestLocalDeclarationStatementWithDottedType","T.X.Y a;") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("StatementParsingTests.TestLocalDeclarationStatementWithMixedType","T.X.Y a;") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("StatementParsingTests.TestLocalDeclarationStatementWithArrayType","T[][,][,,] a;") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("StatementParsingTests.TestLocalDeclarationStatementWithPointerType","T* a;") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("StatementParsingTests.TestLocalDeclarationStatementWithNullableType","T? a;") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("StatementParsingTests.TestLocalDeclarationStatementWithMultipleVariables","T a, b, c;") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("StatementParsingTests.TestLocalDeclarationStatementWithInitializer","T a = b;") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("StatementParsingTests.TestLocalDeclarationStatementWithMultipleVariablesAndInitializers","T a = va, b = vb, c = vc;") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("StatementParsingTests.TestLocalDeclarationStatementWithArrayInitializer","T a = {b, c};") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("StatementParsingTests.TestConstLocalDeclarationStatement","const T a = b;") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("StatementParsingTests.TestStaticLocalDeclarationStatement","static T a = b;") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("StatementParsingTests.TestReadOnlyLocalDeclarationStatement","readonly T a = b;") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("StatementParsingTests.TestVolatileLocalDeclarationStatement","volatile T a = b;") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("StatementParsingTests.TestRefLocalDeclarationStatement","ref T a;") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("StatementParsingTests.TestRefLocalDeclarationStatementWithInitializer","ref T a = ref b;") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("StatementParsingTests.TestRefLocalDeclarationStatementWithMultipleInitializers","ref T a = ref b, c = ref d;") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("StatementParsingTests.TestFixedStatement","fixed(T a = b) { }") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("StatementParsingTests.TestFixedVarStatement","fixed(var a = b) { }") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("StatementParsingTests.TestFixedStatementWithMultipleVariables","fixed(T a = b, c = d) { }") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("StatementParsingTests.TestEmptyStatement",";") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("StatementParsingTests.TestLabeledStatement","label: ;") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("StatementParsingTests.TestBreakStatement","break;") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("StatementParsingTests.TestContinueStatement","continue;") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("StatementParsingTests.TestGotoStatement","goto label;") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("StatementParsingTests.TestGotoCaseStatement","goto case label;") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("StatementParsingTests.TestGotoDefault","goto default;") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("StatementParsingTests.TestReturn","return;") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("StatementParsingTests.TestReturnExpression","return a;") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("StatementParsingTests.TestYieldReturnExpression","yield return a;") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("StatementParsingTests.TestYieldBreakExpression","yield break;") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("StatementParsingTests.TestThrow","throw;") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("StatementParsingTests.TestThrowExpression","throw a;") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("StatementParsingTests.TestTryCatch","try { } catch(T e) { }") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("StatementParsingTests.TestTryCatchWithNoExceptionName","try { } catch(T) { }") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("StatementParsingTests.TestTryCatchWithNoExceptionDeclaration","try { } catch { }") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("StatementParsingTests.TestTryCatchWithMultipleCatches","try { } catch(T e) { } catch(T2) { } catch { }") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("StatementParsingTests.TestTryFinally","try { } finally { }") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("StatementParsingTests.TestTryCatchWithMultipleCatchesAndFinally","try { } catch(T e) { } catch(T2) { } catch { } finally { }") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("StatementParsingTests.TestChecked","checked { }") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("StatementParsingTests.TestUnchecked","unchecked { }") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("StatementParsingTests.TestUnsafe","unsafe { }") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("StatementParsingTests.TestWhile","while(a) { }") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("StatementParsingTests.TestDoWhile","do { } while (a);") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("StatementParsingTests.TestFor","for(;;) { }") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("StatementParsingTests.TestForWithVariableDeclaration","for(T a = 0;;) { }") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("StatementParsingTests.TestForWithVarDeclaration","for(var a = 0;;) { }") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("StatementParsingTests.TestForWithMultipleVariableDeclarations","for(T a = 0, b = 1;;) { }") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("StatementParsingTests.TestForWithRefVariableDeclaration","for(ref T a = ref b, c = ref d;;) { }") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("StatementParsingTests.TestForWithVariableInitializer","for(a = 0;;) { }") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("StatementParsingTests.TestForWithMultipleVariableInitializers","for(a = 0, b = 1;;) { }") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("StatementParsingTests.TestForWithCondition","for(; a;) { }") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("StatementParsingTests.TestForWithIncrementor","for(; ; a++) { }") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("StatementParsingTests.TestForWithMultipleIncrementors","for(; ; a++, b++) { }") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("StatementParsingTests.TestForWithDeclarationConditionAndIncrementor","for(T a = 0; a < 10; a++) { }") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("StatementParsingTests.TestForEach","foreach(T a in b) { }") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("StatementParsingTests.TestForAsForEach","for(T a in b) { }") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("StatementParsingTests.TestForEachWithVar","foreach(var a in b) { }") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("StatementParsingTests.TestIf","if (a) { }") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("StatementParsingTests.TestIfElse","if (a) { } else { }") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("StatementParsingTests.TestIfElseIf","if (a) { } else if (b) { }") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("StatementParsingTests.TestLock","lock (a) { }") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("StatementParsingTests.TestSwitch","switch (a) { }") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("StatementParsingTests.TestSwitchWithCase","switch (a) { case b:; }") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("StatementParsingTests.TestSwitchWithMultipleCases","switch (a) { case b:; case c:; }") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("StatementParsingTests.TestSwitchWithDefaultCase","switch (a) { default:; }") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("StatementParsingTests.TestSwitchWithMultipleLabelsOnOneCase","switch (a) { case b: case c:; }") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("StatementParsingTests.TestSwitchWithMultipleStatementsOnOneCase","switch (a) { case b: s1(); s2(); }") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("StatementParsingTests.TestUsingWithExpression","using (a) { }") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("StatementParsingTests.TestUsingWithDeclaration","using (T a = b) { }") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("StatementParsingTests.TestUsingVarWithDeclaration","using T a = b;") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("StatementParsingTests.TestUsingWithVarDeclaration","using (var a = b) { }") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("StatementParsingTests.TestUsingVarWithVarDeclaration","using var a = b;") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("StatementParsingTests.TestAwaitUsingWithVarDeclaration","await using var a = b;") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("StatementParsingTests.TestUsingWithDeclarationWithMultipleVariables","using (T a = b, c = d) { }") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("StatementParsingTests.TestUsingVarWithDeclarationWithMultipleVariables","using T a = b, c = d;") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("StatementParsingTests.TestUsingSpecialCase1","using (f ? x = a : x = b) { }") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("StatementParsingTests.TestUsingVarSpecialCase1","using var x = f ? a : b;") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("StatementParsingTests.TestUsingSpecialCase2","using (f ? x = a) { }") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("StatementParsingTests.TestUsingVarSpecialCase2","using f ? x = a;") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("StatementParsingTests.TestUsingSpecialCase3","using (f ? x, y) { }") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("StatementParsingTests.TestUsingVarSpecialCase3","using f ? x, y;") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("StatementParsingTests.Bug862649",@"static char[] delimiter;") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("StatementParsingTests.TestRunEmbeddedStatementNotFollowedBySemicolon",@"if (true) +System.Console.WriteLine(true)") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("SuppressNullableWarningExpressionParsingTests.ConditionalAccess_Suppression_LangVersion","x?.y!.z") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("TopLevelStatementsParsingTests.TestIncompleteGlobalMembers",@" +asas] +extern alias A; +asas +using System; +sadasdasd] + +[assembly: goo] + +class C +{ +} + + +[a]fod; +[b") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("TopLevelStatementsParsingTests.IncompleteTopLevelOperator",@" +fg implicit// +class C { } +") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("TopLevelStatementsParsingTests.TestGlobalNamespaceWithOpenBraceBeforeNamespace","{ namespace n { }") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("TopLevelStatementsParsingTests.EmptyLocalDeclaration",""" +struct S { } +partial ext X +""") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("UsingDirectiveParsingTests.StaticUsingDirectiveRefType",@"using static x = ref int;") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("UsingDirectiveParsingTests.AliasUsingDirectiveNamePointer1",@"using x = A*; + +struct A { }") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("UsingDirectiveParsingTests.AliasUsingDirectiveNamePointer2",@"using unsafe x = A*; + +struct A { }") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("UsingDirectiveParsingTests.AliasUsingDirectiveFunctionPointer1",@"using x = delegate*;") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("UsingDirectiveParsingTests.AliasUsingDirectiveFunctionPointer2",@"using unsafe x = delegate*;") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("UsingDirectiveParsingTests.UsingUnsafeNonAlias",@"using unsafe System;") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("UsingDirectiveParsingTests.AliasUsingDirectivePredefinedType_CSharp11",@"using x = int;") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("UsingDirectiveParsingTests.AliasUsingDirectivePredefinedType_CSharp12",@"using x = int;") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("UsingDirectiveParsingTests.AliasUsingDirectivePredefinedType_Preview",@"using x = int;") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("UsingDirectiveParsingTests.AliasUsingDirectiveRefType",@"using x = ref int;") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("UsingDirectiveParsingTests.AliasUsingDirectiveRefReadonlyType",@"using x = ref readonly int;") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("UsingDirectiveParsingTests.AliasUsingDirectivePredefinedTypePointer1",@"using x = int*;") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("UsingDirectiveParsingTests.AliasUsingDirectivePredefinedTypePointer2",@"using unsafe x = int*;") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("UsingDirectiveParsingTests.AliasUsingDirectivePredefinedTypePointer3",@" +using unsafe X = int*; + +namespace N +{ + using Y = X; +}") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("UsingDirectiveParsingTests.AliasUsingDirectivePredefinedTypePointer4",@" +using unsafe X = int*; + +namespace N +{ + using unsafe Y = X; +}") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("UsingDirectiveParsingTests.AliasUsingDirectivePredefinedTypePointer5",@" +using X = int*; + +namespace N +{ + using unsafe Y = X; +}") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("UsingDirectiveParsingTests.AliasUsingDirectivePredefinedTypePointer6",@" +using unsafe X = int*; + +namespace N +{ + using Y = X[]; +}") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("UsingDirectiveParsingTests.AliasUsingDirectivePredefinedTypePointer7",@" +using unsafe X = int*; + +namespace N +{ + using unsafe Y = X[]; +}") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("UsingDirectiveParsingTests.AliasUsingDirectiveTuple1",@"using x = (int, int);") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("UsingDirectiveParsingTests.AliasUsingDirectiveTuple2",""" + using X = (int, int); + + class C + { + X x = (0, 0); + } + """) + }; + + yield return new object[] + { + new CSharpSyntaxFragment("UsingDirectiveParsingTests.AliasUsingDirectiveTuple3",""" + using X = (int, int); + + class C + { + X x = (true, false); + } + """) + }; + + yield return new object[] + { + new CSharpSyntaxFragment("UsingDirectiveParsingTests.AliasUsingNullableValueType",@"using x = int?;") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("UsingDirectiveParsingTests.AliasUsingNullableReferenceType1",@"using x = string?;") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("UsingDirectiveParsingTests.AliasUsingNullableReferenceType2",""" + #nullable enable + using X = string?; + """) + }; + + yield return new object[] + { + new CSharpSyntaxFragment("UsingDirectiveParsingTests.AliasUsingNullableReferenceType3",""" + using X = string; + namespace N + { + using Y = X?; + } + """) + }; + + yield return new object[] + { + new CSharpSyntaxFragment("UsingDirectiveParsingTests.AliasUsingNullableReferenceType4",""" + #nullable enable + using X = string; + namespace N + { + using Y = X?; + } + """) + }; + + yield return new object[] + { + new CSharpSyntaxFragment("UsingDirectiveParsingTests.AliasUsingVoidPointer1",@"using unsafe VP = void*; + +class C +{ + void M(VP vp) { } +}") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("UsingDirectiveParsingTests.AliasUsingVoidPointer2",@"using unsafe VP = void*; + +class C +{ + unsafe void M(VP vp) { } +}") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("UsingDirectiveParsingTests.AliasUsingVoidPointer3",@"using VP = void*; + +class C +{ + unsafe void M(VP vp) { } +}") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("UsingDirectiveParsingTests.AliasUsingVoid1",@"using V = void; + +class C +{ + void M(V v) { } +}") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("UsingDirectiveParsingTests.AliasUsingVoid2",@"using V = void; + +class C +{ + V M() { } +}") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("UsingDirectiveParsingTests.AliasUsingVoid3",@"using V = void[]; + +class C +{ + V M() { } +}") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("UsingDirectiveParsingTests.UsingDirectiveDynamic1",@" +using dynamic;") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("UsingDirectiveParsingTests.AliasUsingDirectiveDynamic1",@" +using D = dynamic; + +class C +{ + void M(D d) + { + d.Goo(); + } +}") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("UsingDirectiveParsingTests.AliasUsingDirectiveDynamic2",@" +using D = System.Collections.Generic.List; + +class C +{ + void M(D d) + { + d[0].Goo(); + } +}") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("UsingDirectiveParsingTests.AliasUsingDirectiveDynamic3",@" +using D = dynamic[]; + +class C +{ + void M(D d) + { + d[0].Goo(); + } +}") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("UsingDirectiveParsingTests.AliasUsingDirectiveDynamic4",@" +using D = dynamic; + +class dynamic +{ + void M(D d) + { + d.Goo(); + } +}") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("UsingDirectiveParsingTests.AliasUsingDirectiveDynamic5",@" +// Note: this is weird, but is supported by language. It checks just that the ValueText is `dynamic`, not the raw text. +using D = @dynamic; + +class C +{ + void M(D d) + { + d.Goo(); + } +}") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("UsingDirectiveParsingTests.AliasUsingDuplicate1",""" + using X = int?; + using X = System; + """) + }; + + yield return new object[] + { + new CSharpSyntaxFragment("UsingDirectiveParsingTests.AliasUsingDuplicate2",""" + using X = int?; + using X = int; + """) + }; + + yield return new object[] + { + new CSharpSyntaxFragment("UsingDirectiveParsingTests.AliasUsingDuplicate3",""" + using X = int?; + using X = System.Int32; + """) + }; + + yield return new object[] + { + new CSharpSyntaxFragment("UsingDirectiveParsingTests.AliasUsingNotDuplicate1",""" + using X = int?; + namespace N; + using X = int; + """) + }; + + yield return new object[] + { + new CSharpSyntaxFragment("UsingDirectiveParsingTests.TestScopedType1",@" +using scoped int; +") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("UsingDirectiveParsingTests.TestScopedType2",@" +using X = scoped int; +") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("UsingDirectiveParsingTests.TestScopedType3",@" +using X = scoped System; +") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("UsingDirectiveParsingTests.TestScopedType4",@" +using X = scoped System.AppDomain; +") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("UsingDirectiveParsingTests.TestObsolete1",""" + using System; + using X = C; + + [Obsolete("", error: true)] + class C + { + } + + class D + { + X x; + C c; + } + """) + }; + + yield return new object[] + { + new CSharpSyntaxFragment("UsingDirectiveParsingTests.TestObsolete2",""" + using System; + using X = C[]; + + [Obsolete("", error: true)] + class C + { + } + + class D + { + X x1; + C[] c1; + } + """) + }; + + yield return new object[] + { + new CSharpSyntaxFragment("UsingDirectiveParsingTests.TestArgList",@" +using X = __arglist; +") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("UsingDirectiveParsingTests.TestMakeref",@" +using X = __makeref; +") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("UsingDirectiveParsingTests.TestUnsafeStatic1_CSharp11_NoUnsafeFlag",@"using unsafe static System.Console;") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("UsingDirectiveParsingTests.TestUnsafeStatic1_CSharp11_UnsafeFlag",@"using unsafe static System.Console;") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("UsingDirectiveParsingTests.TestUnsafeStatic1_CSharp12_NoUnsafeFlag",@"using unsafe static System.Console;") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("UsingDirectiveParsingTests.TestUnsafeStatic1_CSharp12_UnsafeFlag",@"using unsafe static System.Console;") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("UsingDirectiveParsingTests.TestUnsafeStatic2_CSharp11_NoUnsafeFlag",@"using unsafe static X = System.Console;") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("UsingDirectiveParsingTests.TestUnsafeStatic2_CSharp11_UnsafeFlag",@"using unsafe static X = System.Console;") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("UsingDirectiveParsingTests.TestUnsafeStatic2_CSharp12_NoUnsafeFlag",@"using unsafe static X = System.Console;") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("UsingDirectiveParsingTests.TestUnsafeStatic2_CSharp12_UnsafeFlag",@"using unsafe static X = System.Console;") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("UsingDirectiveParsingTests.UsingStaticUnsafe_SafeType_CSharp11_NoUnsafeFlag",@"using static unsafe System.Console;") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("UsingDirectiveParsingTests.UsingStaticUnsafe_SafeType_CSharp11_UnsafeFlag",@"using static unsafe System.Console;") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("UsingDirectiveParsingTests.UsingStaticUnsafe_SafeType_CSharp12_NoUnsafeFlag",@"using static unsafe System.Console;") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("UsingDirectiveParsingTests.UsingStaticUnsafe_SafeType_CSharp12_UnsafeFlag",@"using static unsafe System.Console;") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("UsingDirectiveParsingTests.UsingStaticUnsafe_UnsafeType_CSharp11_NoUnsafeFlag",@"using static unsafe System.Collections.Generic.List;") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("UsingDirectiveParsingTests.UsingStaticUnsafe_UnsafeType_CSharp11_UnsafeFlag",@"using static unsafe System.Collections.Generic.List;") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("UsingDirectiveParsingTests.UsingStaticUnsafe_UnsafeType_CSharp12_NoUnsafeFlag",@"using static unsafe System.Collections.Generic.List;") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("UsingDirectiveParsingTests.UsingStaticUnsafe_UnsafeType_CSharp12_UnsafeFlag",@"using static unsafe System.Collections.Generic.List;") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("UsingDirectiveParsingTests.UsingStatic_UnsafeType_CSharp11_NoUnsafeFlag",@"using static System.Collections.Generic.List;") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("UsingDirectiveParsingTests.UsingStatic_UnsafeType_CSharp11_UnsafeFlag",@"using static System.Collections.Generic.List;") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("UsingDirectiveParsingTests.UsingStatic_UnsafeType_CSharp12_NoUnsafeFlag",@"using static System.Collections.Generic.List;") + }; + + yield return new object[] + { + new CSharpSyntaxFragment("UsingDirectiveParsingTests.UsingStatic_UnsafeType_CSharp12_UnsafeFlag",@"using static System.Collections.Generic.List;") + }; + + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetEnumerator(); + } +} \ No newline at end of file diff --git a/Rewrite/tests/Rewrite.CSharp.Tests/Solutions/SolutionParser.cs b/Rewrite/tests/Rewrite.CSharp.Tests/Solutions/SolutionParser.cs deleted file mode 100644 index 6c4854d2..00000000 --- a/Rewrite/tests/Rewrite.CSharp.Tests/Solutions/SolutionParser.cs +++ /dev/null @@ -1,69 +0,0 @@ -using System.Reflection; -using log4net; -using Microsoft.CodeAnalysis; -using Microsoft.CodeAnalysis.MSBuild; -using Rewrite.Core; -using Rewrite.RewriteCSharp; - -namespace Rewrite.CSharp.Tests.Solutions; - -public class SolutionParser -{ - private static readonly ILog log = LogManager.GetLogger(typeof(SolutionParser)); - - public async Task LoadSolutionAsync(string solutionFilePath, CancellationToken cancellationToken) - { - var workspace = MSBuildWorkspace.Create(); - return await workspace.OpenSolutionAsync(solutionFilePath, cancellationToken: cancellationToken); - } - - public IEnumerable ParseProjectSources(Solution solution, string projectName, string rootDir, - InMemoryExecutionContext ctx) - { - var project = solution.Projects.First(it => it.FilePath!.Equals(projectName)); - var fullProjectPath = Path.GetFullPath(Path.GetDirectoryName(project.FilePath!)!); - var objPath = Path.Combine(Path.GetDirectoryName(project.FilePath!)!, "obj"); - var builder = new CSharpParser.Builder(); - var allMetadataReferences = GetAllMetadataReferences(project); - var parser = builder.References(allMetadataReferences).Build(); - - IList inputs = []; - foreach (var doc in project.Documents - .Where(d => d.SourceCodeKind == SourceCodeKind.Regular) - .Where(d => Path.GetFullPath(d.FilePath!).StartsWith(fullProjectPath)) - .Where(d => !d.FilePath!.StartsWith(objPath))) - { - inputs.Add(new Parser.Input(Path.GetFullPath(doc.FilePath!), - () => new FileStream(doc.FilePath!, FileMode.Open))); - } - - var sourceFiles = parser.ParseInputs(inputs, rootDir, ctx); - return sourceFiles; - } - - private static IEnumerable GetAllMetadataReferences(Project project) - { - var allReferences = new HashSet(); - var projectsToProcess = new Queue(); - projectsToProcess.Enqueue(project); - - while (projectsToProcess.Count > 0) - { - var currentProject = projectsToProcess.Dequeue(); - - // Add metadata references of the current project - foreach (var reference in currentProject.MetadataReferences) - allReferences.Add(reference); - - // Queue up the referenced projects for processing - foreach (var projectReference in currentProject.ProjectReferences) - { - var referencedProject = project.Solution.GetProject(projectReference.ProjectId); - if (referencedProject != null && !projectsToProcess.Contains(referencedProject)) - projectsToProcess.Enqueue(referencedProject); - } - } - - return allReferences; - } -} diff --git a/Rewrite/tests/Rewrite.CSharp.Tests/Solutions/SolutionTests.cs b/Rewrite/tests/Rewrite.CSharp.Tests/Solutions/SolutionTests.cs index 30f0c148..6449d94a 100644 --- a/Rewrite/tests/Rewrite.CSharp.Tests/Solutions/SolutionTests.cs +++ b/Rewrite/tests/Rewrite.CSharp.Tests/Solutions/SolutionTests.cs @@ -1,6 +1,7 @@ using System.Diagnostics; using System.Runtime.ExceptionServices; using System.Text.RegularExpressions; +using Rewrite.MSBuild; using Rewrite.Test.CSharp; namespace Rewrite.CSharp.Tests.Solutions; From aa632d0ff0ee786c9cdadc7b0b2572b1b0f575c2 Mon Sep 17 00:00:00 2001 From: Andrew Stakhov Date: Fri, 11 Oct 2024 17:47:03 -0400 Subject: [PATCH 2/5] Add text delta visualizer for tests, remove negative roslyn test cases --- .../Rewrite.CSharp.Tests.csproj | 2 + .../RoslynTestCases/ParseTests.cs | 139 +- .../RoslynTestCases/RoslynTestData.g.cs | 4763 +++++------------ .../RoslynTestCases/SourceTestCase.cs | 6 + .../StringAssertionExtensions.cs | 90 + 5 files changed, 1457 insertions(+), 3543 deletions(-) create mode 100644 Rewrite/tests/Rewrite.CSharp.Tests/RoslynTestCases/SourceTestCase.cs create mode 100644 Rewrite/tests/Rewrite.CSharp.Tests/StringAssertionExtensions.cs diff --git a/Rewrite/tests/Rewrite.CSharp.Tests/Rewrite.CSharp.Tests.csproj b/Rewrite/tests/Rewrite.CSharp.Tests/Rewrite.CSharp.Tests.csproj index 5b81dfd4..dee12f8d 100644 --- a/Rewrite/tests/Rewrite.CSharp.Tests/Rewrite.CSharp.Tests.csproj +++ b/Rewrite/tests/Rewrite.CSharp.Tests/Rewrite.CSharp.Tests.csproj @@ -11,6 +11,7 @@ all runtime; build; native; contentfiles; analyzers; buildtransitive + @@ -20,6 +21,7 @@ + diff --git a/Rewrite/tests/Rewrite.CSharp.Tests/RoslynTestCases/ParseTests.cs b/Rewrite/tests/Rewrite.CSharp.Tests/RoslynTestCases/ParseTests.cs index 3417224a..fdbcbce2 100644 --- a/Rewrite/tests/Rewrite.CSharp.Tests/RoslynTestCases/ParseTests.cs +++ b/Rewrite/tests/Rewrite.CSharp.Tests/RoslynTestCases/ParseTests.cs @@ -1,7 +1,11 @@ using System.Collections; using System.Diagnostics; +using System.Text.RegularExpressions; +using Microsoft.CodeAnalysis; +using Microsoft.CodeAnalysis.CSharp; using Rewrite.Test.CSharp; using Rewrite.Test; +using Socolin.ANSITerminalColor; namespace Rewrite.CSharp.Tests.RoslynTestCases; @@ -10,17 +14,148 @@ namespace Rewrite.CSharp.Tests.RoslynTestCases; public class ParseTests : RewriteTest { private readonly ITestOutputHelper _output; + private readonly CSharpParser _parser; public ParseTests(ITestOutputHelper output) { _output = output; + _parser = new CSharpParser.Builder().Build(); } + [Fact] + [Exploratory] + public void Delta() + { + string before = @" + one two three + same + 123 + def + another + same + diff1 + @"; + + string after = @" + two two + same + 13 + another + added + same + diff2 + @"; + before.ShouldBeSameAs(after); + } + + [Fact] + [Exploratory] + public void TestReport() + { + var badTestCases = new List<(SourceTestCase, List)>(); + var testCases = new CSharpSyntaxFragments().Select(x => (SourceTestCase)x[0]).ToList(); + List report = new(); + foreach (var testCase in testCases) + { + var roslynDiagnostics = CSharpSyntaxTree.ParseText(testCase.SourceText).GetDiagnostics().ToList(); + if (roslynDiagnostics.Any()) + { + badTestCases.Add((testCase,roslynDiagnostics)); + // report.Add(testCase.Fail("Original.Parse.RoslynIssues")); + continue; + } + + var lst = _parser.Parse(testCase.SourceText); + + if (lst is ParseError) + { + report.Add(testCase.Fail("LstParseError")); + continue; + } + + var lstPrint = lst.ToString()!; + + string StripWhiteSpace(string s) => Regex.Replace(s, @"[\r\n]", ""); + var equalBeforeTrim = lstPrint == testCase.SourceText; + var equalAfterTrim = StripWhiteSpace(lstPrint) == StripWhiteSpace(testCase.SourceText); + if (!equalBeforeTrim && equalAfterTrim) + { + report.Add(testCase.Fail("DifferentWhitespace")); + } + else if(!equalAfterTrim) + { + var roslynLstReParse = CSharpSyntaxTree.ParseText(lstPrint); + if (roslynLstReParse.GetDiagnostics().Where(x => x.Severity == DiagnosticSeverity.Error).Any()) + { + report.Add(testCase.Fail("DifferentUncompilable")); + } + else + { + report.Add(testCase.Fail("DifferentCompilable")); + } + + + } + else + { + report.Add(testCase.Pass()); + } + } + + _output.WriteLine(AnsiColor.ColorizeText($"Total: {report.Count}", AnsiColor.Foreground(Terminal256ColorCodes.Red1C196))); + _output.WriteLine($" Successful: {report.Count(x => x.Success)}"); + var failed = report.Where(x => !x.Success).ToList(); + _output.WriteLine($" Failed: {failed.Count}"); + foreach (var (failureReason, count) in failed + .GroupBy(x => x.FailureReason) + .Select(x => (Reason: x.Key, count: x.Count())) + .OrderBy(x => x.Reason)) + { + _output.WriteLine($" {failureReason}: {count}"); + } + + foreach (var (testCase, diagnostics) in badTestCases) + { + _output.WriteLine($"\"{testCase.Name}\","); + // _output.WriteLine(testCase.SourceText); + // _output.WriteLine(string.Join("\n", diagnostics.Select(x => x.ToString()))); + } + } + + + + [Theory] [ClassData(typeof(CSharpSyntaxFragments))] [Category("Roslyn")] - public void ParseAndPrint(CSharpSyntaxFragment syntax) + public void ParseAndPrint(SourceTestCase syntax) { - RewriteRun(CSharp(syntax.Content)); + var lst = _parser.Parse(syntax.SourceText); + lst.Should().NotBeOfType(); + + var lstPrint = lst.ToString()!; + // lstPrint.Should().Be(syntax.SourceText); + lstPrint.ShouldBeSameAs(syntax.SourceText); + } } + +public class TestResult +{ + public TestResult(SourceTestCase testCase, string? failureReason = null) + { + TestCase = testCase.Name; + FailureReason = failureReason; + } + + public bool Success => FailureReason == null; + public string TestCase { get; } + public string? FailureReason { get; set; } +} + +public static class Extensions +{ + public static TestResult Pass(this SourceTestCase testCase) => new TestResult(testCase); + public static TestResult Fail(this SourceTestCase testCase, string reason) => new TestResult(testCase, reason); +} + diff --git a/Rewrite/tests/Rewrite.CSharp.Tests/RoslynTestCases/RoslynTestData.g.cs b/Rewrite/tests/Rewrite.CSharp.Tests/RoslynTestCases/RoslynTestData.g.cs index 4dcb5336..cd9f8609 100644 --- a/Rewrite/tests/Rewrite.CSharp.Tests/RoslynTestCases/RoslynTestData.g.cs +++ b/Rewrite/tests/Rewrite.CSharp.Tests/RoslynTestCases/RoslynTestData.g.cs @@ -6,898 +6,739 @@ public IEnumerator GetEnumerator() { yield return new object[] { - new CSharpSyntaxFragment("AllowsConstraintParsing.RefStruct_Single",@" + new SourceTestCase("AllowsConstraintParsing.RefStruct_Single",@" class C where T : allows ref struct {}") }; - - yield return new object[] - { - new CSharpSyntaxFragment("AllowsConstraintParsing.RefStruct_Single_MissingRef",@" -class C where T : allows struct -{}") - }; - - yield return new object[] - { - new CSharpSyntaxFragment("AllowsConstraintParsing.RefStruct_Single_MissingStruct",@" -class C where T : allows ref -{}") - }; - + yield return new object[] { - new CSharpSyntaxFragment("AllowsConstraintParsing.RefStruct_Single_MissingRefAndStruct",@" + new SourceTestCase("AllowsConstraintParsing.RefStruct_Single_MissingRefAndStruct",@" class C where T : allows {}") }; - - yield return new object[] - { - new CSharpSyntaxFragment("AllowsConstraintParsing.RefStruct_Single_EscapedAllows",@" -class C where T : @allows ref struct -{}") - }; - - yield return new object[] - { - new CSharpSyntaxFragment("AllowsConstraintParsing.RefStruct_Single_EscapedRef",@" -class C where T : allows @ref struct -{}") - }; - - yield return new object[] - { - new CSharpSyntaxFragment("AllowsConstraintParsing.RefStruct_Single_EscapedStruct",@" -class C where T : allows ref @struct -{}") - }; - + + yield return new object[] { - new CSharpSyntaxFragment("AllowsConstraintParsing.RefStruct_TwoInARow",@" + new SourceTestCase("AllowsConstraintParsing.RefStruct_TwoInARow",@" class C where T : allows ref struct, ref struct {}") }; - + yield return new object[] { - new CSharpSyntaxFragment("AllowsConstraintParsing.RefStruct_TwoInARow_MissingRef",@" + new SourceTestCase("AllowsConstraintParsing.RefStruct_TwoInARow_MissingRef",@" class C where T : allows ref struct, struct {}") }; - - yield return new object[] - { - new CSharpSyntaxFragment("AllowsConstraintParsing.RefStruct_TwoInARow_MissingStruct",@" -class C where T : allows ref struct, ref -{}") - }; - + yield return new object[] { - new CSharpSyntaxFragment("AllowsConstraintParsing.RefStruct_TwoAllowsInARow",@" + new SourceTestCase("AllowsConstraintParsing.RefStruct_TwoAllowsInARow",@" class C where T : allows ref struct, allows ref struct {}") }; - - yield return new object[] - { - new CSharpSyntaxFragment("AllowsConstraintParsing.RefStruct_FollowedByAComma_01",@" -class C where T : allows ref struct, -{}") - }; - - yield return new object[] - { - new CSharpSyntaxFragment("AllowsConstraintParsing.RefStruct_FollowedByAComma_02",@" -class C where T : struct, allows ref struct, -{}") - }; - - yield return new object[] - { - new CSharpSyntaxFragment("AllowsConstraintParsing.RefStruct_FollowedByACommaAndWhere_01",@" -class C where T : allows ref struct, where S : class -{}") - }; - - yield return new object[] - { - new CSharpSyntaxFragment("AllowsConstraintParsing.RefStruct_FollowedByACommaAndWhere_02",@" -class C where T : struct, allows ref struct, where S : class -{}") - }; - + yield return new object[] { - new CSharpSyntaxFragment("AllowsConstraintParsing.RefStruct_FollowedByWhere_01",@" + new SourceTestCase("AllowsConstraintParsing.RefStruct_FollowedByWhere_01",@" class C where T : allows ref struct where S : class {}") }; - + yield return new object[] { - new CSharpSyntaxFragment("AllowsConstraintParsing.RefStruct_FollowedByWhere_02",@" + new SourceTestCase("AllowsConstraintParsing.RefStruct_FollowedByWhere_02",@" class C where T : struct, allows ref struct where S : class {}") }; - + yield return new object[] { - new CSharpSyntaxFragment("AllowsConstraintParsing.RefStruct_AfterStruct",@" + new SourceTestCase("AllowsConstraintParsing.RefStruct_AfterStruct",@" class C where T : struct, allows ref struct {}") }; - - yield return new object[] - { - new CSharpSyntaxFragment("AllowsConstraintParsing.RefStruct_AfterStructAndMissingComma",@" -class C where T : struct allows ref struct -{}") - }; - + yield return new object[] { - new CSharpSyntaxFragment("AllowsConstraintParsing.RefStruct_AfterClass",@" + new SourceTestCase("AllowsConstraintParsing.RefStruct_AfterClass",@" class C where T : class, allows ref struct {}") }; - + yield return new object[] { - new CSharpSyntaxFragment("AllowsConstraintParsing.RefStruct_AfterDefault",@" + new SourceTestCase("AllowsConstraintParsing.RefStruct_AfterDefault",@" class C where T : default, allows ref struct {}") }; - + yield return new object[] { - new CSharpSyntaxFragment("AllowsConstraintParsing.RefStruct_AfterUnmanaged",@" + new SourceTestCase("AllowsConstraintParsing.RefStruct_AfterUnmanaged",@" class C where T : unmanaged, allows ref struct {}") }; - + yield return new object[] { - new CSharpSyntaxFragment("AllowsConstraintParsing.RefStruct_AfterNotNull",@" + new SourceTestCase("AllowsConstraintParsing.RefStruct_AfterNotNull",@" class C where T : notnull, allows ref struct {}") }; - + yield return new object[] { - new CSharpSyntaxFragment("AllowsConstraintParsing.RefStruct_AfterTypeConstraint",@" + new SourceTestCase("AllowsConstraintParsing.RefStruct_AfterTypeConstraint",@" class C where T : SomeType, allows ref struct {}") }; - + yield return new object[] { - new CSharpSyntaxFragment("AllowsConstraintParsing.RefStruct_AfterNew",@" + new SourceTestCase("AllowsConstraintParsing.RefStruct_AfterNew",@" class C where T : new(), allows ref struct {}") }; - + yield return new object[] { - new CSharpSyntaxFragment("AllowsConstraintParsing.RefStruct_AfterMultiple",@" + new SourceTestCase("AllowsConstraintParsing.RefStruct_AfterMultiple",@" class C where T : struct, SomeType, new(), allows ref struct {}") }; - + yield return new object[] { - new CSharpSyntaxFragment("AllowsConstraintParsing.RefStruct_BeforeClass",@" + new SourceTestCase("AllowsConstraintParsing.RefStruct_BeforeClass",@" class C where T : allows ref struct, class {}") }; - + yield return new object[] { - new CSharpSyntaxFragment("AllowsConstraintParsing.RefStruct_BeforeDefault",@" + new SourceTestCase("AllowsConstraintParsing.RefStruct_BeforeDefault",@" class C where T : allows ref struct, default {}") }; - + yield return new object[] { - new CSharpSyntaxFragment("AllowsConstraintParsing.RefStruct_BeforeUnmanaged",@" + new SourceTestCase("AllowsConstraintParsing.RefStruct_BeforeUnmanaged",@" class C where T : allows ref struct, unmanaged {}") }; - + yield return new object[] { - new CSharpSyntaxFragment("AllowsConstraintParsing.RefStruct_BeforeNotNull",@" + new SourceTestCase("AllowsConstraintParsing.RefStruct_BeforeNotNull",@" class C where T : allows ref struct, notnull {}") }; - + yield return new object[] { - new CSharpSyntaxFragment("AllowsConstraintParsing.RefStruct_BeforeTypeConstraint",@" + new SourceTestCase("AllowsConstraintParsing.RefStruct_BeforeTypeConstraint",@" class C where T : allows ref struct, SomeType {}") }; - + yield return new object[] { - new CSharpSyntaxFragment("AllowsConstraintParsing.RefStruct_BeforeNew",@" + new SourceTestCase("AllowsConstraintParsing.RefStruct_BeforeNew",@" class C where T : allows ref struct, new() {}") }; - - yield return new object[] - { - new CSharpSyntaxFragment("AsyncParsingTests.AsyncAsType_Indexer_ExpressionBody_ErrorCase","interface async { async this[async i] => null; }") - }; - - yield return new object[] - { - new CSharpSyntaxFragment("DeclarationParsingTests.TestExternAlias","extern alias a;") - }; - - yield return new object[] - { - new CSharpSyntaxFragment("DeclarationParsingTests.TestUsing","using a;") - }; - - yield return new object[] - { - new CSharpSyntaxFragment("DeclarationParsingTests.TestUsingStatic","using static a;") - }; - - yield return new object[] - { - new CSharpSyntaxFragment("DeclarationParsingTests.TestUsingStaticInWrongOrder","static using a;") - }; - - yield return new object[] - { - new CSharpSyntaxFragment("DeclarationParsingTests.TestDuplicateStatic","using static static a;") - }; - - yield return new object[] - { - new CSharpSyntaxFragment("DeclarationParsingTests.TestUsingNamespace","using namespace a;") - }; - - yield return new object[] - { - new CSharpSyntaxFragment("DeclarationParsingTests.TestUsingDottedName","using a.b;") - }; - - yield return new object[] - { - new CSharpSyntaxFragment("DeclarationParsingTests.TestUsingStaticDottedName","using static a.b;") - }; - + yield return new object[] { - new CSharpSyntaxFragment("DeclarationParsingTests.TestUsingStaticGenericName","using static a;") + new SourceTestCase("AsyncParsingTests.AsyncAsType_Indexer_ExpressionBody_ErrorCase","interface async { async this[async i] => null; }") }; - + yield return new object[] { - new CSharpSyntaxFragment("DeclarationParsingTests.TestUsingAliasName","using a = b;") + new SourceTestCase("DeclarationParsingTests.TestExternAlias","extern alias a;") }; - + yield return new object[] { - new CSharpSyntaxFragment("DeclarationParsingTests.TestUsingAliasGenericName","using a = b;") + new SourceTestCase("DeclarationParsingTests.TestUsing","using a;") }; - + yield return new object[] { - new CSharpSyntaxFragment("DeclarationParsingTests.TestGlobalAttribute","[assembly:a]") + new SourceTestCase("DeclarationParsingTests.TestUsingStatic","using static a;") }; - + yield return new object[] { - new CSharpSyntaxFragment("DeclarationParsingTests.TestGlobalAttribute_Verbatim","[@assembly:a]") + new SourceTestCase("DeclarationParsingTests.TestUsingDottedName","using a.b;") }; - + yield return new object[] { - new CSharpSyntaxFragment("DeclarationParsingTests.TestGlobalAttribute_Escape",@"[as\u0073embly:a]") + new SourceTestCase("DeclarationParsingTests.TestUsingStaticDottedName","using static a.b;") }; - + yield return new object[] { - new CSharpSyntaxFragment("DeclarationParsingTests.TestGlobalModuleAttribute","[module:a]") + new SourceTestCase("DeclarationParsingTests.TestUsingStaticGenericName","using static a;") }; - + yield return new object[] { - new CSharpSyntaxFragment("DeclarationParsingTests.TestGlobalModuleAttribute_Verbatim","[@module:a]") + new SourceTestCase("DeclarationParsingTests.TestUsingAliasName","using a = b;") }; - + yield return new object[] { - new CSharpSyntaxFragment("DeclarationParsingTests.TestGlobalAttributeWithParentheses","[assembly:a()]") + new SourceTestCase("DeclarationParsingTests.TestUsingAliasGenericName","using a = b;") }; - + yield return new object[] { - new CSharpSyntaxFragment("DeclarationParsingTests.TestGlobalAttributeWithMultipleArguments","[assembly:a(b, c)]") + new SourceTestCase("DeclarationParsingTests.TestGlobalAttribute","[assembly:a]") }; - + yield return new object[] { - new CSharpSyntaxFragment("DeclarationParsingTests.TestGlobalAttributeWithNamedArguments","[assembly:a(b = c)]") + new SourceTestCase("DeclarationParsingTests.TestGlobalAttribute_Verbatim","[@assembly:a]") }; - + yield return new object[] { - new CSharpSyntaxFragment("DeclarationParsingTests.TestGlobalAttributeWithMultipleAttributes","[assembly:a, b]") + new SourceTestCase("DeclarationParsingTests.TestGlobalAttribute_Escape",@"[as\u0073embly:a]") }; - + yield return new object[] { - new CSharpSyntaxFragment("DeclarationParsingTests.TestMultipleGlobalAttributeDeclarations","[assembly:a] [assembly:b]") + new SourceTestCase("DeclarationParsingTests.TestGlobalModuleAttribute","[module:a]") }; - + yield return new object[] { - new CSharpSyntaxFragment("DeclarationParsingTests.TestNamespace","namespace a { }") + new SourceTestCase("DeclarationParsingTests.TestGlobalModuleAttribute_Verbatim","[@module:a]") }; - + yield return new object[] { - new CSharpSyntaxFragment("DeclarationParsingTests.TestFileScopedNamespace","namespace a;") + new SourceTestCase("DeclarationParsingTests.TestGlobalAttributeWithParentheses","[assembly:a()]") }; - + yield return new object[] { - new CSharpSyntaxFragment("DeclarationParsingTests.TestNamespaceWithDottedName","namespace a.b.c { }") + new SourceTestCase("DeclarationParsingTests.TestGlobalAttributeWithMultipleArguments","[assembly:a(b, c)]") }; - + yield return new object[] { - new CSharpSyntaxFragment("DeclarationParsingTests.TestNamespaceWithUsing","namespace a { using b.c; }") + new SourceTestCase("DeclarationParsingTests.TestGlobalAttributeWithNamedArguments","[assembly:a(b = c)]") }; - + yield return new object[] { - new CSharpSyntaxFragment("DeclarationParsingTests.TestFileScopedNamespaceWithUsing","namespace a; using b.c;") + new SourceTestCase("DeclarationParsingTests.TestGlobalAttributeWithMultipleAttributes","[assembly:a, b]") }; - + yield return new object[] { - new CSharpSyntaxFragment("DeclarationParsingTests.TestNamespaceWithExternAlias","namespace a { extern alias b; }") + new SourceTestCase("DeclarationParsingTests.TestMultipleGlobalAttributeDeclarations","[assembly:a] [assembly:b]") }; - + yield return new object[] { - new CSharpSyntaxFragment("DeclarationParsingTests.TestFileScopedNamespaceWithExternAlias","namespace a; extern alias b;") + new SourceTestCase("DeclarationParsingTests.TestNamespace","namespace a { }") }; - + yield return new object[] { - new CSharpSyntaxFragment("DeclarationParsingTests.TestNamespaceWithExternAliasFollowingUsingBad","namespace a { using b; extern alias c; }") + new SourceTestCase("DeclarationParsingTests.TestFileScopedNamespace","namespace a;") }; - + yield return new object[] { - new CSharpSyntaxFragment("DeclarationParsingTests.TestNamespaceWithNestedNamespace","namespace a { namespace b { } }") + new SourceTestCase("DeclarationParsingTests.TestNamespaceWithDottedName","namespace a.b.c { }") }; - + yield return new object[] { - new CSharpSyntaxFragment("DeclarationParsingTests.TestClass","class a { }") + new SourceTestCase("DeclarationParsingTests.TestNamespaceWithUsing","namespace a { using b.c; }") }; - + yield return new object[] { - new CSharpSyntaxFragment("DeclarationParsingTests.TestClassWithPublic","public class a { }") + new SourceTestCase("DeclarationParsingTests.TestFileScopedNamespaceWithUsing","namespace a; using b.c;") }; - + yield return new object[] { - new CSharpSyntaxFragment("DeclarationParsingTests.TestClassWithInternal","internal class a { }") + new SourceTestCase("DeclarationParsingTests.TestNamespaceWithExternAlias","namespace a { extern alias b; }") }; - + yield return new object[] { - new CSharpSyntaxFragment("DeclarationParsingTests.TestClassWithStatic","static class a { }") + new SourceTestCase("DeclarationParsingTests.TestFileScopedNamespaceWithExternAlias","namespace a; extern alias b;") }; - + yield return new object[] { - new CSharpSyntaxFragment("DeclarationParsingTests.TestClassWithSealed","sealed class a { }") + new SourceTestCase("DeclarationParsingTests.TestNamespaceWithNestedNamespace","namespace a { namespace b { } }") }; - + yield return new object[] { - new CSharpSyntaxFragment("DeclarationParsingTests.TestClassWithAbstract","abstract class a { }") + new SourceTestCase("DeclarationParsingTests.TestClass","class a { }") }; - + yield return new object[] { - new CSharpSyntaxFragment("DeclarationParsingTests.TestClassWithPartial","partial class a { }") + new SourceTestCase("DeclarationParsingTests.TestClassWithPublic","public class a { }") }; - + yield return new object[] { - new CSharpSyntaxFragment("DeclarationParsingTests.TestClassWithAttribute","[attr] class a { }") + new SourceTestCase("DeclarationParsingTests.TestClassWithInternal","internal class a { }") }; - + yield return new object[] { - new CSharpSyntaxFragment("DeclarationParsingTests.TestClassWithMultipleAttributes","[attr1] [attr2] class a { }") + new SourceTestCase("DeclarationParsingTests.TestClassWithStatic","static class a { }") }; - + yield return new object[] { - new CSharpSyntaxFragment("DeclarationParsingTests.TestClassWithMultipleAttributesInAList","[attr1, attr2] class a { }") + new SourceTestCase("DeclarationParsingTests.TestClassWithSealed","sealed class a { }") }; - + yield return new object[] { - new CSharpSyntaxFragment("DeclarationParsingTests.TestClassWithBaseType","class a : b { }") + new SourceTestCase("DeclarationParsingTests.TestClassWithAbstract","abstract class a { }") }; - + yield return new object[] { - new CSharpSyntaxFragment("DeclarationParsingTests.TestClassWithMultipleBases","class a : b, c { }") + new SourceTestCase("DeclarationParsingTests.TestClassWithPartial","partial class a { }") }; - + yield return new object[] { - new CSharpSyntaxFragment("DeclarationParsingTests.TestClassWithTypeConstraintBound","class a where b : c { }") + new SourceTestCase("DeclarationParsingTests.TestClassWithAttribute","[attr] class a { }") }; - + yield return new object[] { - new CSharpSyntaxFragment("DeclarationParsingTests.TestNonGenericClassWithTypeConstraintBound","class a where b : c { }") + new SourceTestCase("DeclarationParsingTests.TestClassWithMultipleAttributes","[attr1] [attr2] class a { }") }; - + yield return new object[] { - new CSharpSyntaxFragment("DeclarationParsingTests.TestNonGenericMethodWithTypeConstraintBound","class a { void M() where b : c { } }") + new SourceTestCase("DeclarationParsingTests.TestClassWithMultipleAttributesInAList","[attr1, attr2] class a { }") }; - + yield return new object[] { - new CSharpSyntaxFragment("DeclarationParsingTests.TestClassWithNewConstraintBound","class a where b : new() { }") + new SourceTestCase("DeclarationParsingTests.TestClassWithBaseType","class a : b { }") }; - + yield return new object[] { - new CSharpSyntaxFragment("DeclarationParsingTests.TestClassWithClassConstraintBound","class a where b : class { }") + new SourceTestCase("DeclarationParsingTests.TestClassWithMultipleBases","class a : b, c { }") }; - + yield return new object[] { - new CSharpSyntaxFragment("DeclarationParsingTests.TestClassWithStructConstraintBound","class a where b : struct { }") + new SourceTestCase("DeclarationParsingTests.TestClassWithTypeConstraintBound","class a where b : c { }") }; - + yield return new object[] { - new CSharpSyntaxFragment("DeclarationParsingTests.TestClassWithMultipleConstraintBounds","class a where b : class, c, new() { }") + new SourceTestCase("DeclarationParsingTests.TestNonGenericClassWithTypeConstraintBound","class a where b : c { }") }; - + yield return new object[] { - new CSharpSyntaxFragment("DeclarationParsingTests.TestClassWithMultipleConstraints","class a where b : c where b : new() { }") + new SourceTestCase("DeclarationParsingTests.TestNonGenericMethodWithTypeConstraintBound","class a { void M() where b : c { } }") }; - + yield return new object[] { - new CSharpSyntaxFragment("DeclarationParsingTests.TestClassWithMultipleConstraints001","class a where b : c where b { }") + new SourceTestCase("DeclarationParsingTests.TestClassWithNewConstraintBound","class a where b : new() { }") }; - + yield return new object[] { - new CSharpSyntaxFragment("DeclarationParsingTests.TestClassWithMultipleConstraints002","class a where b : c where { }") + new SourceTestCase("DeclarationParsingTests.TestClassWithClassConstraintBound","class a where b : class { }") }; - + yield return new object[] { - new CSharpSyntaxFragment("DeclarationParsingTests.TestClassWithMultipleBasesAndConstraints","class a : c, d where b : class, e, new() { }") + new SourceTestCase("DeclarationParsingTests.TestClassWithStructConstraintBound","class a where b : struct { }") }; - + yield return new object[] { - new CSharpSyntaxFragment("DeclarationParsingTests.TestInterface","interface a { }") + new SourceTestCase("DeclarationParsingTests.TestClassWithMultipleConstraintBounds","class a where b : class, c, new() { }") }; - + yield return new object[] { - new CSharpSyntaxFragment("DeclarationParsingTests.TestGenericInterface","interface A { }") + new SourceTestCase("DeclarationParsingTests.TestClassWithMultipleConstraints","class a where b : c where b : new() { }") }; - + yield return new object[] { - new CSharpSyntaxFragment("DeclarationParsingTests.TestGenericInterfaceWithAttributesAndVariance","interface A<[B] out C> { }") + new SourceTestCase("DeclarationParsingTests.TestClassWithMultipleBasesAndConstraints","class a : c, d where b : class, e, new() { }") }; - + yield return new object[] { - new CSharpSyntaxFragment("DeclarationParsingTests.TestStruct","struct a { }") + new SourceTestCase("DeclarationParsingTests.TestInterface","interface a { }") }; - + yield return new object[] { - new CSharpSyntaxFragment("DeclarationParsingTests.TestNestedClass","class a { class b { } }") + new SourceTestCase("DeclarationParsingTests.TestGenericInterface","interface A { }") }; - + yield return new object[] { - new CSharpSyntaxFragment("DeclarationParsingTests.TestNestedPrivateClass","class a { private class b { } }") + new SourceTestCase("DeclarationParsingTests.TestGenericInterfaceWithAttributesAndVariance","interface A<[B] out C> { }") }; - + yield return new object[] { - new CSharpSyntaxFragment("DeclarationParsingTests.TestNestedProtectedClass","class a { protected class b { } }") + new SourceTestCase("DeclarationParsingTests.TestStruct","struct a { }") }; - + yield return new object[] { - new CSharpSyntaxFragment("DeclarationParsingTests.TestNestedProtectedInternalClass","class a { protected internal class b { } }") + new SourceTestCase("DeclarationParsingTests.TestNestedClass","class a { class b { } }") }; - + yield return new object[] { - new CSharpSyntaxFragment("DeclarationParsingTests.TestNestedInternalProtectedClass","class a { internal protected class b { } }") + new SourceTestCase("DeclarationParsingTests.TestNestedPrivateClass","class a { private class b { } }") }; - + yield return new object[] { - new CSharpSyntaxFragment("DeclarationParsingTests.TestNestedPublicClass","class a { public class b { } }") + new SourceTestCase("DeclarationParsingTests.TestNestedProtectedClass","class a { protected class b { } }") }; - + yield return new object[] { - new CSharpSyntaxFragment("DeclarationParsingTests.TestNestedInternalClass","class a { internal class b { } }") + new SourceTestCase("DeclarationParsingTests.TestNestedProtectedInternalClass","class a { protected internal class b { } }") }; - + yield return new object[] { - new CSharpSyntaxFragment("DeclarationParsingTests.TestDelegate","delegate a b();") + new SourceTestCase("DeclarationParsingTests.TestNestedInternalProtectedClass","class a { internal protected class b { } }") }; - + yield return new object[] { - new CSharpSyntaxFragment("DeclarationParsingTests.TestDelegateWithRefReturnType","delegate ref a b();") + new SourceTestCase("DeclarationParsingTests.TestNestedPublicClass","class a { public class b { } }") }; - + yield return new object[] { - new CSharpSyntaxFragment("DeclarationParsingTests.TestDelegateWithRefReadonlyReturnType","delegate ref readonly a b();") + new SourceTestCase("DeclarationParsingTests.TestNestedInternalClass","class a { internal class b { } }") }; - + yield return new object[] { - new CSharpSyntaxFragment("DeclarationParsingTests.TestDelegateWithParameter","delegate a b(c d);") + new SourceTestCase("DeclarationParsingTests.TestDelegate","delegate a b();") }; - + yield return new object[] { - new CSharpSyntaxFragment("DeclarationParsingTests.TestDelegateWithMultipleParameters","delegate a b(c d, e f);") + new SourceTestCase("DeclarationParsingTests.TestDelegateWithRefReturnType","delegate ref a b();") }; - + yield return new object[] { - new CSharpSyntaxFragment("DeclarationParsingTests.TestDelegateWithRefParameter","delegate a b(ref c d);") + new SourceTestCase("DeclarationParsingTests.TestDelegateWithRefReadonlyReturnType","delegate ref readonly a b();") }; - + yield return new object[] { - new CSharpSyntaxFragment("DeclarationParsingTests.TestDelegateWithOutParameter","delegate a b(out c d);") + new SourceTestCase("DeclarationParsingTests.TestDelegateWithParameter","delegate a b(c d);") }; - + yield return new object[] { - new CSharpSyntaxFragment("DeclarationParsingTests.TestDelegateWithParamsParameter","delegate a b(params c d);") + new SourceTestCase("DeclarationParsingTests.TestDelegateWithMultipleParameters","delegate a b(c d, e f);") }; - + yield return new object[] { - new CSharpSyntaxFragment("DeclarationParsingTests.TestDelegateWithArgListParameter","delegate a b(__arglist);") + new SourceTestCase("DeclarationParsingTests.TestDelegateWithRefParameter","delegate a b(ref c d);") }; - + yield return new object[] { - new CSharpSyntaxFragment("DeclarationParsingTests.TestDelegateWithParameterAttribute","delegate a b([attr] c d);") + new SourceTestCase("DeclarationParsingTests.TestDelegateWithOutParameter","delegate a b(out c d);") }; - + yield return new object[] { - new CSharpSyntaxFragment("DeclarationParsingTests.TestNestedDelegate","class a { delegate b c(); }") + new SourceTestCase("DeclarationParsingTests.TestDelegateWithParamsParameter","delegate a b(params c d);") }; - + yield return new object[] { - new CSharpSyntaxFragment("DeclarationParsingTests.TestClassMethod","class a { b X() { } }") + new SourceTestCase("DeclarationParsingTests.TestDelegateWithArgListParameter","delegate a b(__arglist);") }; - + yield return new object[] { - new CSharpSyntaxFragment("DeclarationParsingTests.TestClassMethodWithRefReturn","class a { ref b X() { } }") + new SourceTestCase("DeclarationParsingTests.TestDelegateWithParameterAttribute","delegate a b([attr] c d);") }; - + yield return new object[] { - new CSharpSyntaxFragment("DeclarationParsingTests.TestClassMethodWithRefReadonlyReturn","class a { ref readonly b X() { } }") + new SourceTestCase("DeclarationParsingTests.TestNestedDelegate","class a { delegate b c(); }") }; - + yield return new object[] { - new CSharpSyntaxFragment("DeclarationParsingTests.TestClassMethodWithRef","class a { ref }") + new SourceTestCase("DeclarationParsingTests.TestClassMethod","class a { b X() { } }") }; - + yield return new object[] { - new CSharpSyntaxFragment("DeclarationParsingTests.TestClassMethodWithRefReadonly","class a { ref readonly }") + new SourceTestCase("DeclarationParsingTests.TestClassMethodWithRefReturn","class a { ref b X() { } }") }; - + yield return new object[] { - new CSharpSyntaxFragment("DeclarationParsingTests.TestClassMethodWithPartial","class a { partial void M() { } }") + new SourceTestCase("DeclarationParsingTests.TestClassMethodWithRefReadonlyReturn","class a { ref readonly b X() { } }") }; - + yield return new object[] { - new CSharpSyntaxFragment("DeclarationParsingTests.TestStructMethodWithReadonly","struct a { readonly void M() { } }") + new SourceTestCase("DeclarationParsingTests.TestClassMethodWithPartial","class a { partial void M() { } }") }; - + yield return new object[] { - new CSharpSyntaxFragment("DeclarationParsingTests.TestReadOnlyRefReturning","struct a { readonly ref readonly int M() { } }") + new SourceTestCase("DeclarationParsingTests.TestStructMethodWithReadonly","struct a { readonly void M() { } }") }; - + yield return new object[] { - new CSharpSyntaxFragment("DeclarationParsingTests.TestStructExpressionPropertyWithReadonly","struct a { readonly int M => 42; }") + new SourceTestCase("DeclarationParsingTests.TestReadOnlyRefReturning","struct a { readonly ref readonly int M() { } }") }; - + yield return new object[] { - new CSharpSyntaxFragment("DeclarationParsingTests.TestStructGetterPropertyWithReadonly","struct a { int P { readonly get { return 42; } } }") + new SourceTestCase("DeclarationParsingTests.TestStructExpressionPropertyWithReadonly","struct a { readonly int M => 42; }") }; - + yield return new object[] { - new CSharpSyntaxFragment("DeclarationParsingTests.TestStructBadExpressionProperty",@"public struct S -{ - public int P readonly => 0; -} -") + new SourceTestCase("DeclarationParsingTests.TestStructGetterPropertyWithReadonly","struct a { int P { readonly get { return 42; } } }") }; - + yield return new object[] { - new CSharpSyntaxFragment("DeclarationParsingTests.TestClassMethodWithParameter","class a { b X(c d) { } }") + new SourceTestCase("DeclarationParsingTests.TestClassMethodWithParameter","class a { b X(c d) { } }") }; - + yield return new object[] { - new CSharpSyntaxFragment("DeclarationParsingTests.TestClassMethodWithMultipleParameters","class a { b X(c d, e f) { } }") + new SourceTestCase("DeclarationParsingTests.TestClassMethodWithMultipleParameters","class a { b X(c d, e f) { } }") }; - + yield return new object[] { - new CSharpSyntaxFragment("DeclarationParsingTests.TestClassMethodWithArgListParameter","class a { b X(__arglist) { } }") + new SourceTestCase("DeclarationParsingTests.TestClassMethodWithArgListParameter","class a { b X(__arglist) { } }") }; - + yield return new object[] { - new CSharpSyntaxFragment("DeclarationParsingTests.TestGenericClassMethod","class a { b M() { } }") + new SourceTestCase("DeclarationParsingTests.TestGenericClassMethod","class a { b M() { } }") }; - + yield return new object[] { - new CSharpSyntaxFragment("DeclarationParsingTests.TestGenericClassMethodWithTypeConstraintBound","class a { b X() where b : d { } }") + new SourceTestCase("DeclarationParsingTests.TestGenericClassMethodWithTypeConstraintBound","class a { b X() where b : d { } }") }; - + yield return new object[] { - new CSharpSyntaxFragment("DeclarationParsingTests.TestGenericClassConstructor",@" + new SourceTestCase("DeclarationParsingTests.TestGenericClassConstructor",@" class Class1{ public Class1() { } } ") }; - - yield return new object[] - { - new CSharpSyntaxFragment("DeclarationParsingTests.TestClassConstructor","class a { a() { } }") - }; - - yield return new object[] - { - new CSharpSyntaxFragment("DeclarationParsingTests.TestClassDestructor","class a { ~a() { } }") - }; - + yield return new object[] { - new CSharpSyntaxFragment("DeclarationParsingTests.TestClassField","class a { b c; }") + new SourceTestCase("DeclarationParsingTests.TestClassConstructor","class a { a() { } }") }; - + yield return new object[] { - new CSharpSyntaxFragment("DeclarationParsingTests.TestClassConstField","class a { const b c = d; }") + new SourceTestCase("DeclarationParsingTests.TestClassDestructor","class a { ~a() { } }") }; - + yield return new object[] { - new CSharpSyntaxFragment("DeclarationParsingTests.TestClassFieldWithInitializer","class a { b c = e; }") + new SourceTestCase("DeclarationParsingTests.TestClassField","class a { b c; }") }; - + yield return new object[] { - new CSharpSyntaxFragment("DeclarationParsingTests.TestClassFieldWithArrayInitializer","class a { b c = { }; }") + new SourceTestCase("DeclarationParsingTests.TestClassConstField","class a { const b c = d; }") }; - + yield return new object[] { - new CSharpSyntaxFragment("DeclarationParsingTests.TestClassFieldWithMultipleVariables","class a { b c, d, e; }") + new SourceTestCase("DeclarationParsingTests.TestClassFieldWithInitializer","class a { b c = e; }") }; - + yield return new object[] { - new CSharpSyntaxFragment("DeclarationParsingTests.TestClassFieldWithMultipleVariablesAndInitializers","class a { b c = x, d = y, e = z; }") + new SourceTestCase("DeclarationParsingTests.TestClassFieldWithArrayInitializer","class a { b c = { }; }") }; - + yield return new object[] { - new CSharpSyntaxFragment("DeclarationParsingTests.TestClassFixedField","class a { fixed b c[10]; }") + new SourceTestCase("DeclarationParsingTests.TestClassFieldWithMultipleVariables","class a { b c, d, e; }") }; - + yield return new object[] { - new CSharpSyntaxFragment("DeclarationParsingTests.TestClassProperty","class a { b c { get; set; } }") + new SourceTestCase("DeclarationParsingTests.TestClassFieldWithMultipleVariablesAndInitializers","class a { b c = x, d = y, e = z; }") }; - + yield return new object[] { - new CSharpSyntaxFragment("DeclarationParsingTests.TestClassPropertyWithRefReturn","class a { ref b c { get; set; } }") + new SourceTestCase("DeclarationParsingTests.TestClassFixedField","class a { fixed b c[10]; }") }; - + yield return new object[] { - new CSharpSyntaxFragment("DeclarationParsingTests.TestClassPropertyWithRefReadonlyReturn","class a { ref readonly b c { get; set; } }") + new SourceTestCase("DeclarationParsingTests.TestClassProperty","class a { b c { get; set; } }") }; - + yield return new object[] { - new CSharpSyntaxFragment("DeclarationParsingTests.TestClassPropertyWithBodies","class a { b c { get { } set { } } }") + new SourceTestCase("DeclarationParsingTests.TestClassPropertyWithRefReturn","class a { ref b c { get; set; } }") }; - + yield return new object[] { - new CSharpSyntaxFragment("DeclarationParsingTests.TestClassAutoPropertyWithInitializer","class a { b c { get; set; } = d; }") + new SourceTestCase("DeclarationParsingTests.TestClassPropertyWithRefReadonlyReturn","class a { ref readonly b c { get; set; } }") }; - + yield return new object[] { - new CSharpSyntaxFragment("DeclarationParsingTests.InitializerOnNonAutoProp","class C { int P { set {} } = 0; }") + new SourceTestCase("DeclarationParsingTests.TestClassPropertyWithBodies","class a { b c { get { } set { } } }") }; - + yield return new object[] { - new CSharpSyntaxFragment("DeclarationParsingTests.TestClassPropertyExplicit","class a { b I.c { get; set; } }") + new SourceTestCase("DeclarationParsingTests.TestClassAutoPropertyWithInitializer","class a { b c { get; set; } = d; }") }; - + yield return new object[] { - new CSharpSyntaxFragment("DeclarationParsingTests.TestClassEventProperty","class a { event b c { add { } remove { } } }") + new SourceTestCase("DeclarationParsingTests.InitializerOnNonAutoProp","class C { int P { set {} } = 0; }") }; - + yield return new object[] { - new CSharpSyntaxFragment("DeclarationParsingTests.TestClassEventPropertyExplicit","class a { event b I.c { add { } remove { } } }") + new SourceTestCase("DeclarationParsingTests.TestClassPropertyExplicit","class a { b I.c { get; set; } }") }; - + yield return new object[] { - new CSharpSyntaxFragment("DeclarationParsingTests.TestClassIndexer","class a { b this[c d] { get; set; } }") + new SourceTestCase("DeclarationParsingTests.TestClassEventProperty","class a { event b c { add { } remove { } } }") }; - + yield return new object[] { - new CSharpSyntaxFragment("DeclarationParsingTests.TestClassIndexerWithRefReturn","class a { ref b this[c d] { get; set; } }") + new SourceTestCase("DeclarationParsingTests.TestClassEventPropertyExplicit","class a { event b I.c { add { } remove { } } }") }; - + yield return new object[] { - new CSharpSyntaxFragment("DeclarationParsingTests.TestClassIndexerWithRefReadonlyReturn","class a { ref readonly b this[c d] { get; set; } }") + new SourceTestCase("DeclarationParsingTests.TestClassIndexer","class a { b this[c d] { get; set; } }") }; - + yield return new object[] { - new CSharpSyntaxFragment("DeclarationParsingTests.TestClassIndexerWithMultipleParameters","class a { b this[c d, e f] { get; set; } }") + new SourceTestCase("DeclarationParsingTests.TestClassIndexerWithRefReturn","class a { ref b this[c d] { get; set; } }") }; - + yield return new object[] { - new CSharpSyntaxFragment("DeclarationParsingTests.TestClassIndexerExplicit","class a { b I.this[c d] { get; set; } }") + new SourceTestCase("DeclarationParsingTests.TestClassIndexerWithRefReadonlyReturn","class a { ref readonly b this[c d] { get; set; } }") }; - + yield return new object[] { - new CSharpSyntaxFragment("DeclarationParsingTests.TestClassRightShiftOperatorMethod","class a { b operator >> (c d, e f) { } }") + new SourceTestCase("DeclarationParsingTests.TestClassIndexerWithMultipleParameters","class a { b this[c d, e f] { get; set; } }") }; - + yield return new object[] { - new CSharpSyntaxFragment("DeclarationParsingTests.TestClassUnsignedRightShiftOperatorMethod","class a { b operator >>> (c d, e f) { } }") + new SourceTestCase("DeclarationParsingTests.TestClassIndexerExplicit","class a { b I.this[c d] { get; set; } }") }; - + yield return new object[] { - new CSharpSyntaxFragment("DeclarationParsingTests.TestClassImplicitConversionOperatorMethod","class a { implicit operator b (c d) { } }") + new SourceTestCase("DeclarationParsingTests.TestClassRightShiftOperatorMethod","class a { b operator >> (c d, e f) { } }") }; - + yield return new object[] { - new CSharpSyntaxFragment("DeclarationParsingTests.TestClassExplicitConversionOperatorMethod","class a { explicit operator b (c d) { } }") + new SourceTestCase("DeclarationParsingTests.TestClassUnsignedRightShiftOperatorMethod","class a { b operator >>> (c d, e f) { } }") }; - + yield return new object[] { - new CSharpSyntaxFragment("DeclarationParsingTests.TestNamespaceDeclarationsBadNames","namespace A::B { }") + new SourceTestCase("DeclarationParsingTests.TestClassImplicitConversionOperatorMethod","class a { implicit operator b (c d) { } }") }; - + yield return new object[] { - new CSharpSyntaxFragment("DeclarationParsingTests.TestNamespaceDeclarationsBadNames1",@"namespace A::B { }") + new SourceTestCase("DeclarationParsingTests.TestClassExplicitConversionOperatorMethod","class a { explicit operator b (c d) { } }") }; - + yield return new object[] { - new CSharpSyntaxFragment("DeclarationParsingTests.TestNamespaceDeclarationsBadNames2",@"namespace A { }") + new SourceTestCase("DeclarationParsingTests.TestNamespaceDeclarationsBadNames","namespace A::B { }") }; - + yield return new object[] { - new CSharpSyntaxFragment("DeclarationParsingTests.TestNamespaceDeclarationsBadNames3",@"namespace A<,> { }") + new SourceTestCase("DeclarationParsingTests.TestNamespaceDeclarationsBadNames1",@"namespace A::B { }") }; - + yield return new object[] { - new CSharpSyntaxFragment("DeclarationParsingTests.TestMissingSemicolonAfterListInitializer",@"using System; -using System.Linq; -class Program { - static void Main() { - var r = new List() { 3, 3 } - var s = 2; - } -} -") + new SourceTestCase("DeclarationParsingTests.TestNamespaceDeclarationsBadNames2",@"namespace A { }") }; - + yield return new object[] { - new CSharpSyntaxFragment("DeclarationParsingTests.TestPartialPartial",@" -partial class PartialPartial -{ - int i = 1; - partial partial void PM(); - partial partial void PM() - { - i = 0; - } - static int Main() - { - PartialPartial t = new PartialPartial(); - t.PM(); - return t.i; - } -} -") + new SourceTestCase("DeclarationParsingTests.TestNamespaceDeclarationsBadNames3",@"namespace A<,> { }") }; - + yield return new object[] { - new CSharpSyntaxFragment("DeclarationParsingTests.TestPartialEnum",@"partial enum E{}") + new SourceTestCase("DeclarationParsingTests.TestPartialEnum",@"partial enum E{}") }; - + yield return new object[] { - new CSharpSyntaxFragment("DeclarationParsingTests.TestEscapedConstructor",@" + new SourceTestCase("DeclarationParsingTests.TestEscapedConstructor",@" class @class { public @class() @@ -906,10 +747,10 @@ public @class() } ") }; - + yield return new object[] { - new CSharpSyntaxFragment("DeclarationParsingTests.TestAnonymousMethodWithDefaultParameter",@" + new SourceTestCase("DeclarationParsingTests.TestAnonymousMethodWithDefaultParameter",@" delegate void F(int x); class C { void M() { @@ -918,10 +759,10 @@ void M() { } ") }; - + yield return new object[] { - new CSharpSyntaxFragment("DeclarationParsingTests.RegressIfDevTrueUnicode",@" + new SourceTestCase("DeclarationParsingTests.RegressIfDevTrueUnicode",@" class P { static void Main() @@ -935,10 +776,10 @@ static void Main() } ") }; - + yield return new object[] { - new CSharpSyntaxFragment("DeclarationParsingTests.RegressLongDirectiveIdentifierDefn",@" + new SourceTestCase("DeclarationParsingTests.RegressLongDirectiveIdentifierDefn",@" //130 chars (max is 128) #define A234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890 class P @@ -955,10 +796,10 @@ static void Main() } ") }; - + yield return new object[] { - new CSharpSyntaxFragment("DeclarationParsingTests.RegressLongDirectiveIdentifierUse",@" + new SourceTestCase("DeclarationParsingTests.RegressLongDirectiveIdentifierUse",@" //128 chars (max) #define A2345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678 class P @@ -975,34 +816,34 @@ static void Main() } ") }; - + yield return new object[] { - new CSharpSyntaxFragment("DeclarationParsingTests.ValidFixedBufferTypes",@" + new SourceTestCase("DeclarationParsingTests.ValidFixedBufferTypes",@" unsafe struct s { public fixed bool _Type1[10]; internal fixed int _Type3[10]; private fixed short _Type4[10]; unsafe fixed long _Type5[10]; - new fixed char _Type6[10]; + new fixed char _Type6[10]; } ") }; - + yield return new object[] { - new CSharpSyntaxFragment("DeclarationParsingTests.ValidFixedBufferTypesMultipleDeclarationsOnSameLine",@" + new SourceTestCase("DeclarationParsingTests.ValidFixedBufferTypesMultipleDeclarationsOnSameLine",@" unsafe struct s { public fixed bool _Type1[10], _Type2[10], _Type3[20]; } ") }; - + yield return new object[] { - new CSharpSyntaxFragment("DeclarationParsingTests.ValidFixedBufferTypesWithCountFromConstantOrLiteral",@" + new SourceTestCase("DeclarationParsingTests.ValidFixedBufferTypesWithCountFromConstantOrLiteral",@" unsafe struct s { public const int abc = 10; @@ -1011,33 +852,33 @@ unsafe struct s } ") }; - + yield return new object[] { - new CSharpSyntaxFragment("DeclarationParsingTests.ValidFixedBufferTypesAllValidTypes",@" + new SourceTestCase("DeclarationParsingTests.ValidFixedBufferTypesAllValidTypes",@" unsafe struct s { - public fixed bool _Type1[10]; - public fixed byte _Type12[10]; - public fixed int _Type2[10]; - public fixed short _Type3[10]; - public fixed long _Type4[10]; - public fixed char _Type5[10]; - public fixed sbyte _Type6[10]; - public fixed ushort _Type7[10]; - public fixed uint _Type8[10]; - public fixed ulong _Type9[10]; - public fixed float _Type10[10]; - public fixed double _Type11[10]; + public fixed bool _Type1[10]; + public fixed byte _Type12[10]; + public fixed int _Type2[10]; + public fixed short _Type3[10]; + public fixed long _Type4[10]; + public fixed char _Type5[10]; + public fixed sbyte _Type6[10]; + public fixed ushort _Type7[10]; + public fixed uint _Type8[10]; + public fixed ulong _Type9[10]; + public fixed float _Type10[10]; + public fixed double _Type11[10]; } ") }; - + yield return new object[] { - new CSharpSyntaxFragment("DeclarationParsingTests.TupleArgument01",@" + new SourceTestCase("DeclarationParsingTests.TupleArgument01",@" class C1 { static (T, T) Test1(int a, (byte, byte) arg0) @@ -1052,10 +893,10 @@ class C1 } ") }; - + yield return new object[] { - new CSharpSyntaxFragment("DeclarationParsingTests.TupleArgument02",@" + new SourceTestCase("DeclarationParsingTests.TupleArgument02",@" class C1 { static (T, T) Test3((byte, byte) arg0) @@ -1070,3097 +911,1362 @@ class C1 } ") }; - + yield return new object[] { - new CSharpSyntaxFragment("DeclarationParsingTests.TestNamespaceWithDotDot1",@"namespace a..b { }") + new SourceTestCase("DeclarationParsingTests.Interface_SemicolonBody",@" +interface C +;") }; - + yield return new object[] { - new CSharpSyntaxFragment("DeclarationParsingTests.TestExtraneousColonInBaseList",@" -class A : B : C -{ -} -") + new SourceTestCase("DeclarationParsingTests.Interface_SemicolonBodyAfterBase_01",@" +interface C : I1 +;") }; - + yield return new object[] { - new CSharpSyntaxFragment("DeclarationParsingTests.TestNamespaceWithDotDot2",@"namespace a - ..b { }") + new SourceTestCase("DeclarationParsingTests.Interface_SemicolonBodyAfterBase_02",@" +interface C : I1, I2 +;") }; - + yield return new object[] { - new CSharpSyntaxFragment("DeclarationParsingTests.TestNamespaceWithDotDot3",@"namespace a.. -b { }") + new SourceTestCase("DeclarationParsingTests.Interface_SemicolonBodyAfterConstraint_01",@" +interface C where T1 : U1 +;") }; - + yield return new object[] { - new CSharpSyntaxFragment("DeclarationParsingTests.TestNamespaceWithDotDot4",@"namespace a - .. -b { }") + new SourceTestCase("DeclarationParsingTests.Interface_SemicolonBodyAfterConstraint_02",@" +interface C where T1 : U1 where T2 : U2 +;") }; - - yield return new object[] - { - new CSharpSyntaxFragment("DeclarationParsingTests.Interface_NoBody",@" -interface C") - }; - - yield return new object[] - { - new CSharpSyntaxFragment("DeclarationParsingTests.Interface_SemicolonBody",@" -interface C -;") - }; - - yield return new object[] - { - new CSharpSyntaxFragment("DeclarationParsingTests.Interface_SemicolonBodyAfterBase_01",@" -interface C : I1 -;") - }; - - yield return new object[] - { - new CSharpSyntaxFragment("DeclarationParsingTests.Interface_SemicolonBodyAfterBase_02",@" -interface C : I1, I2 -;") - }; - - yield return new object[] - { - new CSharpSyntaxFragment("DeclarationParsingTests.Interface_SemicolonBodyAfterConstraint_01",@" -interface C where T1 : U1 -;") - }; - - yield return new object[] - { - new CSharpSyntaxFragment("DeclarationParsingTests.Interface_SemicolonBodyAfterConstraint_02",@" -interface C where T1 : U1 where T2 : U2 -;") - }; - - yield return new object[] - { - new CSharpSyntaxFragment("DeconstructionTests.TupleArray","(T, T)[] id;") - }; - - yield return new object[] - { - new CSharpSyntaxFragment("DeconstructionTests.ParenthesizedExpression","(x).ToString();") - }; - - yield return new object[] - { - new CSharpSyntaxFragment("DeconstructionTests.TupleLiteralStatement","(x, x).ToString();") - }; - - yield return new object[] - { - new CSharpSyntaxFragment("DeconstructionTests.Statement4","((x)).ToString();") - }; - - yield return new object[] - { - new CSharpSyntaxFragment("DeconstructionTests.Statement5","((x, y) = M()).ToString();") - }; - - yield return new object[] - { - new CSharpSyntaxFragment("DeconstructionTests.CastWithTupleType","(((x, y))z).Goo();") - }; - - yield return new object[] - { - new CSharpSyntaxFragment("DeconstructionTests.NotACast","((Int32.MaxValue, Int32.MaxValue)).ToString();") - }; - - yield return new object[] - { - new CSharpSyntaxFragment("DeconstructionTests.AlsoNotACast","((x, y)).ToString();") - }; - - yield return new object[] - { - new CSharpSyntaxFragment("DeconstructionTests.StillNotACast","((((x, y)))).ToString();") - }; - - yield return new object[] - { - new CSharpSyntaxFragment("DeconstructionTests.LambdaInExpressionStatement","(a) => a;") - }; - - yield return new object[] - { - new CSharpSyntaxFragment("DeconstructionTests.LambdaWithBodyInExpressionStatement","(a, b) => { };") - }; - - yield return new object[] - { - new CSharpSyntaxFragment("DeconstructionTests.InvalidStatement","(x, y)? = M();") - }; - - yield return new object[] - { - new CSharpSyntaxFragment("DeconstructionTests.NullableTuple","(x, y)? z = M();") - }; - - yield return new object[] - { - new CSharpSyntaxFragment("ExpressionParsingTests.TestAltInterpolatedVerbatimString_CSharp73",@"@$""hello""") - }; - - yield return new object[] - { - new CSharpSyntaxFragment("ExpressionParsingTests.TestParenthesizedExpression","(goo)") - }; - - yield return new object[] - { - new CSharpSyntaxFragment("ExpressionParsingTests.TestStringLiteralExpression","\"stuff\"") - }; - - yield return new object[] - { - new CSharpSyntaxFragment("ExpressionParsingTests.TestVerbatimLiteralExpression","@\"\"\"stuff\"\"\"") - }; - - yield return new object[] - { - new CSharpSyntaxFragment("ExpressionParsingTests.TestCharacterLiteralExpression","'c'") - }; - - yield return new object[] - { - new CSharpSyntaxFragment("ExpressionParsingTests.TestNumericLiteralExpression","0") - }; - - yield return new object[] - { - new CSharpSyntaxFragment("ExpressionParsingTests.TestRefValue","(a, b)") - }; - - yield return new object[] - { - new CSharpSyntaxFragment("ExpressionParsingTests.TestConditional","a ? b : c") - }; - - yield return new object[] - { - new CSharpSyntaxFragment("ExpressionParsingTests.TestConditional02","a ? b=c : d=e") - }; - - yield return new object[] - { - new CSharpSyntaxFragment("ExpressionParsingTests.TestCast","(a) b") - }; - - yield return new object[] - { - new CSharpSyntaxFragment("ExpressionParsingTests.TestCall","a(b)") - }; - - yield return new object[] - { - new CSharpSyntaxFragment("ExpressionParsingTests.TestCallWithRef","a(ref b)") - }; - - yield return new object[] - { - new CSharpSyntaxFragment("ExpressionParsingTests.TestCallWithOut","a(out b)") - }; - - yield return new object[] - { - new CSharpSyntaxFragment("ExpressionParsingTests.TestCallWithNamedArgument","a(B: b)") - }; - - yield return new object[] - { - new CSharpSyntaxFragment("ExpressionParsingTests.TestIndex","a[b]") - }; - - yield return new object[] - { - new CSharpSyntaxFragment("ExpressionParsingTests.TestIndexWithRef","a[ref b]") - }; - - yield return new object[] - { - new CSharpSyntaxFragment("ExpressionParsingTests.TestIndexWithOut","a[out b]") - }; - - yield return new object[] - { - new CSharpSyntaxFragment("ExpressionParsingTests.TestIndexWithNamedArgument","a[B: b]") - }; - - yield return new object[] - { - new CSharpSyntaxFragment("ExpressionParsingTests.TestNew","new a()") - }; - - yield return new object[] - { - new CSharpSyntaxFragment("ExpressionParsingTests.TestNewWithArgument","new a(b)") - }; - - yield return new object[] - { - new CSharpSyntaxFragment("ExpressionParsingTests.TestNewWithNamedArgument","new a(B: b)") - }; - - yield return new object[] - { - new CSharpSyntaxFragment("ExpressionParsingTests.TestNewWithEmptyInitializer","new a() { }") - }; - - yield return new object[] - { - new CSharpSyntaxFragment("ExpressionParsingTests.TestNewWithNoArgumentsAndEmptyInitializer","new a { }") - }; - - yield return new object[] - { - new CSharpSyntaxFragment("ExpressionParsingTests.TestNewWithNoArgumentsAndInitializer","new a { b }") - }; - - yield return new object[] - { - new CSharpSyntaxFragment("ExpressionParsingTests.TestNewWithNoArgumentsAndInitializers","new a { b, c, d }") - }; - - yield return new object[] - { - new CSharpSyntaxFragment("ExpressionParsingTests.TestNewWithNoArgumentsAndAssignmentInitializer","new a { B = b }") - }; - - yield return new object[] - { - new CSharpSyntaxFragment("ExpressionParsingTests.TestNewWithNoArgumentsAndNestedAssignmentInitializer","new a { B = { X = x } }") - }; - - yield return new object[] - { - new CSharpSyntaxFragment("ExpressionParsingTests.TestNewArray","new a[1]") - }; - - yield return new object[] - { - new CSharpSyntaxFragment("ExpressionParsingTests.TestNewArrayWithInitializer","new a[] {b}") - }; - - yield return new object[] - { - new CSharpSyntaxFragment("ExpressionParsingTests.TestNewArrayWithInitializers","new a[] {b, c, d}") - }; - - yield return new object[] - { - new CSharpSyntaxFragment("ExpressionParsingTests.TestNewMultiDimensionalArrayWithInitializer","new a[][,][,,] {b}") - }; - - yield return new object[] - { - new CSharpSyntaxFragment("ExpressionParsingTests.TestImplicitArrayCreation","new [] {b}") - }; - - yield return new object[] - { - new CSharpSyntaxFragment("ExpressionParsingTests.TestAnonymousObjectCreation","new {a, b}") - }; - - yield return new object[] - { - new CSharpSyntaxFragment("ExpressionParsingTests.TestAnonymousMethod","delegate (int a) { }") - }; - - yield return new object[] - { - new CSharpSyntaxFragment("ExpressionParsingTests.TestAnonymousMethodWithNoArguments","delegate () { }") - }; - - yield return new object[] - { - new CSharpSyntaxFragment("ExpressionParsingTests.TestAnonymousMethodWithNoArgumentList","delegate { }") - }; - - yield return new object[] - { - new CSharpSyntaxFragment("ExpressionParsingTests.TestSimpleLambda","a => b") - }; - - yield return new object[] - { - new CSharpSyntaxFragment("ExpressionParsingTests.TestSimpleLambdaWithRefReturn","a => ref b") - }; - - yield return new object[] - { - new CSharpSyntaxFragment("ExpressionParsingTests.TestSimpleLambdaWithBlock","a => { }") - }; - - yield return new object[] - { - new CSharpSyntaxFragment("ExpressionParsingTests.TestLambdaWithNoParameters","() => b") - }; - - yield return new object[] - { - new CSharpSyntaxFragment("ExpressionParsingTests.TestLambdaWithNoParametersAndRefReturn","() => ref b") - }; - - yield return new object[] - { - new CSharpSyntaxFragment("ExpressionParsingTests.TestLambdaWithNoParametersAndBlock","() => { }") - }; - - yield return new object[] - { - new CSharpSyntaxFragment("ExpressionParsingTests.TestLambdaWithOneParameter","(a) => b") - }; - - yield return new object[] - { - new CSharpSyntaxFragment("ExpressionParsingTests.TestLambdaWithTwoParameters","(a, a2) => b") - }; - - yield return new object[] - { - new CSharpSyntaxFragment("ExpressionParsingTests.TestLambdaWithOneTypedParameter","(T a) => b") - }; - - yield return new object[] - { - new CSharpSyntaxFragment("ExpressionParsingTests.TestLambdaWithOneRefParameter","(ref T a) => b") - }; - - yield return new object[] - { - new CSharpSyntaxFragment("ExpressionParsingTests.TestTupleWithTwoArguments","(a, a2)") - }; - - yield return new object[] - { - new CSharpSyntaxFragment("ExpressionParsingTests.TestTupleWithTwoNamedArguments","(arg1: (a, a2), arg2: a2)") - }; - - yield return new object[] - { - new CSharpSyntaxFragment("ExpressionParsingTests.TestFromSelect","from a in A select b") - }; - - yield return new object[] - { - new CSharpSyntaxFragment("ExpressionParsingTests.TestFromWithType","from T a in A select b") - }; - - yield return new object[] - { - new CSharpSyntaxFragment("ExpressionParsingTests.TestFromSelectIntoSelect","from a in A select b into c select d") - }; - - yield return new object[] - { - new CSharpSyntaxFragment("ExpressionParsingTests.TestFromWhereSelect","from a in A where b select c") - }; - - yield return new object[] - { - new CSharpSyntaxFragment("ExpressionParsingTests.TestFromFromSelect","from a in A from b in B select c") - }; - - yield return new object[] - { - new CSharpSyntaxFragment("ExpressionParsingTests.TestFromLetSelect","from a in A let b = B select c") - }; - - yield return new object[] - { - new CSharpSyntaxFragment("ExpressionParsingTests.TestFromOrderBySelect","from a in A orderby b select c") - }; - - yield return new object[] - { - new CSharpSyntaxFragment("ExpressionParsingTests.TestFromOrderBy2Select","from a in A orderby b, b2 select c") - }; - + yield return new object[] { - new CSharpSyntaxFragment("ExpressionParsingTests.TestFromOrderByAscendingSelect","from a in A orderby b ascending select c") + new SourceTestCase("DeconstructionTests.TupleArray","(T, T)[] id;") }; - + yield return new object[] { - new CSharpSyntaxFragment("ExpressionParsingTests.TestFromOrderByDescendingSelect","from a in A orderby b descending select c") + new SourceTestCase("DeconstructionTests.ParenthesizedExpression","(x).ToString();") }; - + yield return new object[] { - new CSharpSyntaxFragment("ExpressionParsingTests.TestFromGroupBy","from a in A group b by c") + new SourceTestCase("DeconstructionTests.TupleLiteralStatement","(x, x).ToString();") }; - + yield return new object[] { - new CSharpSyntaxFragment("ExpressionParsingTests.TestFromGroupByIntoSelect","from a in A group b by c into d select e") + new SourceTestCase("DeconstructionTests.Statement4","((x)).ToString();") }; - + yield return new object[] { - new CSharpSyntaxFragment("ExpressionParsingTests.TestFromJoinSelect","from a in A join b in B on a equals b select c") + new SourceTestCase("DeconstructionTests.Statement5","((x, y) = M()).ToString();") }; - + yield return new object[] { - new CSharpSyntaxFragment("ExpressionParsingTests.TestFromJoinWithTypesSelect","from Ta a in A join Tb b in B on a equals b select c") + new SourceTestCase("DeconstructionTests.CastWithTupleType","(((x, y))z).Goo();") }; - + yield return new object[] { - new CSharpSyntaxFragment("ExpressionParsingTests.TestFromJoinIntoSelect","from a in A join b in B on a equals b into c select d") + new SourceTestCase("DeconstructionTests.NotACast","((Int32.MaxValue, Int32.MaxValue)).ToString();") }; - + yield return new object[] { - new CSharpSyntaxFragment("ExpressionParsingTests.TestFromGroupBy1","from it in goo group x by y") + new SourceTestCase("DeconstructionTests.AlsoNotACast","((x, y)).ToString();") }; - + yield return new object[] { - new CSharpSyntaxFragment("ExpressionParsingTests.UnterminatedRankSpecifier","new int[") + new SourceTestCase("DeconstructionTests.StillNotACast","((((x, y)))).ToString();") }; - + yield return new object[] { - new CSharpSyntaxFragment("ExpressionParsingTests.UnterminatedTypeArgumentList","new C<") + new SourceTestCase("DeconstructionTests.LambdaInExpressionStatement","(a) => a;") }; - + yield return new object[] { - new CSharpSyntaxFragment("ExpressionParsingTests.QueryKeywordInObjectInitializer","from elem in aRay select new Result { A = on = true }") + new SourceTestCase("DeconstructionTests.LambdaWithBodyInExpressionStatement","(a, b) => { };") }; - + yield return new object[] { - new CSharpSyntaxFragment("ExpressionParsingTests.IndexingExpressionInParens","(aRay[i,j])") + new SourceTestCase("DeconstructionTests.NullableTuple","(x, y)? z = M();") }; - - yield return new object[] - { - new CSharpSyntaxFragment("ExpressionParsingTests.ParseBigExpression",@" - -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text.RegularExpressions; -namespace WB.Core.SharedKernels.DataCollection.Generated -{ - internal partial class QuestionnaireTopLevel - { - private bool IsValid_a() - { - return (stackDepth == 100) || ((stackDepth == 200) || ((stackDepth == 300) || ((stackDepth == 400) || ((stackDepth == 501) || ((stackDepth == 502) || ((stackDepth == 600) || ((stackDepth == 701) || ((stackDepth == 702) || ((stackDepth == 801) || ((stackDepth == 802) || ((stackDepth == 901) || ((stackDepth == 902) || ((stackDepth == 903) || ((stackDepth == 1001) || ((stackDepth == 1002) || ((stackDepth == 1101) || ((stackDepth == 1102) || ((stackDepth == 1201) || ((stackDepth == 1202) || ((stackDepth == 1301) || ((stackDepth == 1302) || ((stackDepth == 1401) || ((stackDepth == 1402) || ((stackDepth == 1403) || ((stackDepth == 1404) || ((stackDepth == 1405) || ((stackDepth == 1406) || ((stackDepth == 1407) || ((stackDepth == 1408) || ((stackDepth == 1409) || ((stackDepth == 1410) || ((stackDepth == 1411) || ((stackDepth == 1412) || ((stackDepth == 1413) || ((stackDepth == 1500) || ((stackDepth == 1601) || ((stackDepth == 1602) || ((stackDepth == 1701) || ((stackDepth == 1702) || ((stackDepth == 1703) || ((stackDepth == 1800) || ((stackDepth == 1901) || ((stackDepth == 1902) || ((stackDepth == 1903) || ((stackDepth == 1904) || ((stackDepth == 2000) || ((stackDepth == 2101) || ((stackDepth == 2102) || ((stackDepth == 2103) || ((stackDepth == 2104) || ((stackDepth == 2105) || ((stackDepth == 2106) || ((stackDepth == 2107) || ((stackDepth == 2201) || ((stackDepth == 2202) || ((stackDepth == 2203) || ((stackDepth == 2301) || ((stackDepth == 2302) || ((stackDepth == 2303) || ((stackDepth == 2304) || ((stackDepth == 2305) || ((stackDepth == 2401) || ((stackDepth == 2402) || ((stackDepth == 2403) || ((stackDepth == 2404) || ((stackDepth == 2501) || ((stackDepth == 2502) || ((stackDepth == 2503) || ((stackDepth == 2504) || ((stackDepth == 2505) || ((stackDepth == 2601) || ((stackDepth == 2602) || ((stackDepth == 2603) || ((stackDepth == 2604) || ((stackDepth == 2605) || ((stackDepth == 2606) || ((stackDepth == 2607) || ((stackDepth == 2608) || ((stackDepth == 2701) || ((stackDepth == 2702) || ((stackDepth == 2703) || ((stackDepth == 2704) || ((stackDepth == 2705) || ((stackDepth == 2706) || ((stackDepth == 2801) || ((stackDepth == 2802) || ((stackDepth == 2803) || ((stackDepth == 2804) || ((stackDepth == 2805) || ((stackDepth == 2806) || ((stackDepth == 2807) || ((stackDepth == 2808) || ((stackDepth == 2809) || ((stackDepth == 2810) || ((stackDepth == 2901) || ((stackDepth == 2902) || ((stackDepth == 3001) || ((stackDepth == 3002) || ((stackDepth == 3101) || ((stackDepth == 3102) || ((stackDepth == 3103) || ((stackDepth == 3104) || ((stackDepth == 3105) || ((stackDepth == 3201) || ((stackDepth == 3202) || ((stackDepth == 3203) || ((stackDepth == 3301) || ((stackDepth == 3302) || ((stackDepth == 3401) || ((stackDepth == 3402) || ((stackDepth == 3403) || ((stackDepth == 3404) || ((stackDepth == 3405) || ((stackDepth == 3406) || ((stackDepth == 3407) || ((stackDepth == 3408) || ((stackDepth == 3409) || ((stackDepth == 3410) || ((stackDepth == 3501) || ((stackDepth == 3502) || ((stackDepth == 3503) || ((stackDepth == 3504) || ((stackDepth == 3505) || ((stackDepth == 3506) || ((stackDepth == 3507) || ((stackDepth == 3508) || ((stackDepth == 3509) || ((stackDepth == 3601) || ((stackDepth == 3602) || ((stackDepth == 3701) || ((stackDepth == 3702) || ((stackDepth == 3703) || ((stackDepth == 3704) || ((stackDepth == 3705) || ((stackDepth == 3706) || ((stackDepth == 3801) || ((stackDepth == 3802) || ((stackDepth == 3803) || ((stackDepth == 3804) || ((stackDepth == 3805) || ((stackDepth == 3901) || ((stackDepth == 3902) || ((stackDepth == 3903) || ((stackDepth == 3904) || ((stackDepth == 3905) || ((stackDepth == 4001) || ((stackDepth == 4002) || ((stackDepth == 4003) || ((stackDepth == 4004) || ((stackDepth == 4005) || ((stackDepth == 4006) || ((stackDepth == 4007) || ((stackDepth == 4100) || ((stackDepth == 4201) || ((stackDepth == 4202) || ((stackDepth == 4203) || ((stackDepth == 4204) || ((stackDepth == 4301) || ((stackDepth == 4302) || ((stackDepth == 4304) || ((stackDepth == 4401) || ((stackDepth == 4402) || ((stackDepth == 4403) || ((stackDepth == 4404) || ((stackDepth == 4501) || ((stackDepth == 4502) || ((stackDepth == 4503) || ((stackDepth == 4504) || ((stackDepth == 4600) || ((stackDepth == 4701) || ((stackDepth == 4702) || ((stackDepth == 4801) || ((stackDepth == 4802) || ((stackDepth == 4803) || ((stackDepth == 4804) || ((stackDepth == 4805) || ((stackDepth == 4806) || ((stackDepth == 4807) || ((stackDepth == 4808) || ((stackDepth == 4809) || ((stackDepth == 4811) || ((stackDepth == 4901) || ((stackDepth == 4902) || ((stackDepth == 4903) || ((stackDepth == 4904) || ((stackDepth == 4905) || ((stackDepth == 4906) || ((stackDepth == 4907) || ((stackDepth == 4908) || ((stackDepth == 4909) || ((stackDepth == 4910) || ((stackDepth == 4911) || ((stackDepth == 4912) || ((stackDepth == 4913) || ((stackDepth == 4914) || ((stackDepth == 4915) || ((stackDepth == 4916) || ((stackDepth == 4917) || ((stackDepth == 4918) || ((stackDepth == 4919) || ((stackDepth == 4920) || ((stackDepth == 4921) || ((stackDepth == 4922) || ((stackDepth == 4923) || ((stackDepth == 5001) || ((stackDepth == 5002) || ((stackDepth == 5003) || ((stackDepth == 5004) || ((stackDepth == 5005) || ((stackDepth == 5006) || ((stackDepth == 5100) || ((stackDepth == 5200) || ((stackDepth == 5301) || ((stackDepth == 5302) || ((stackDepth == 5400) || ((stackDepth == 5500) || ((stackDepth == 5600) || ((stackDepth == 5700) || ((stackDepth == 5801) || ((stackDepth == 5802) || ((stackDepth == 5901) || ((stackDepth == 5902) || ((stackDepth == 6001) || ((stackDepth == 6002) || ((stackDepth == 6101) || ((stackDepth == 6102) || ((stackDepth == 6201) || ((stackDepth == 6202) || ((stackDepth == 6203) || ((stackDepth == 6204) || ((stackDepth == 6205) || ((stackDepth == 6301) || ((stackDepth == 6302) || ((stackDepth == 6401) || ((stackDepth == 6402) || ((stackDepth == 6501) || ((stackDepth == 6502) || ((stackDepth == 6503) || ((stackDepth == 6504) || ((stackDepth == 6601) || ((stackDepth == 6602) || ((stackDepth == 6701) || ((stackDepth == 6702) || ((stackDepth == 6703) || ((stackDepth == 6704) || ((stackDepth == 6801) || ((stackDepth == 6802) || ((stackDepth == 6901) || ((stackDepth == 6902) || ((stackDepth == 6903) || ((stackDepth == 6904) || ((stackDepth == 7001) || ((stackDepth == 7002) || ((stackDepth == 7101) || ((stackDepth == 7102) || ((stackDepth == 7103) || ((stackDepth == 7200) || ((stackDepth == 7301) || ((stackDepth == 7302) || ((stackDepth == 7400) || ((stackDepth == 7501) || ((stackDepth == 7502) || ((stackDepth == 7503) || ((stackDepth == 7600) || ((stackDepth == 7700) || ((stackDepth == 7800) || ((stackDepth == 7900) || ((stackDepth == 8001) || ((stackDepth == 8002) || ((stackDepth == 8101) || ((stackDepth == 8102) || ((stackDepth == 8103) || ((stackDepth == 8200) || ((stackDepth == 8300) || ((stackDepth == 8400) || ((stackDepth == 8501) || ((stackDepth == 8502) || ((stackDepth == 8601) || ((stackDepth == 8602) || ((stackDepth == 8700) || ((stackDepth == 8801) || ((stackDepth == 8802) || ((stackDepth == 8901) || ((stackDepth == 8902) || ((stackDepth == 8903) || ((stackDepth == 9001) || ((stackDepth == 9002) || ((stackDepth == 9003) || ((stackDepth == 9004) || ((stackDepth == 9005) || ((stackDepth == 9101) || ((stackDepth == 9102) || ((stackDepth == 9200) || ((stackDepth == 9300) || ((stackDepth == 9401) || ((stackDepth == 9402) || ((stackDepth == 9403) || ((stackDepth == 9500) || ((stackDepth == 9601) || ((stackDepth == 9602) || ((stackDepth == 9701) || ((stackDepth == 9702) || ((stackDepth == 9801) || ((stackDepth == 9802) || ((stackDepth == 9900) || ((stackDepth == 10000) || ((stackDepth == 10100) || ((stackDepth == 10201) || ((stackDepth == 10202) || ((stackDepth == 10301) || ((stackDepth == 10302) || ((stackDepth == 10401) || ((stackDepth == 10402) || ((stackDepth == 10403) || ((stackDepth == 10501) || ((stackDepth == 10502) || ((stackDepth == 10601) || ((stackDepth == 10602) || ((stackDepth == 10701) || ((stackDepth == 10702) || ((stackDepth == 10703) || ((stackDepth == 10704) || ((stackDepth == 10705) || ((stackDepth == 10706) || ((stackDepth == 10801) || ((stackDepth == 10802) || ((stackDepth == 10803) || ((stackDepth == 10804) || ((stackDepth == 10805) || ((stackDepth == 10806) || ((stackDepth == 10807) || ((stackDepth == 10808) || ((stackDepth == 10809) || ((stackDepth == 10900) || ((stackDepth == 11000) || ((stackDepth == 11100) || ((stackDepth == 11201) || ((stackDepth == 11202) || ((stackDepth == 11203) || ((stackDepth == 11204) || ((stackDepth == 11205) || ((stackDepth == 11206) || ((stackDepth == 11207) || ((stackDepth == 11208) || ((stackDepth == 11209) || ((stackDepth == 11210) || ((stackDepth == 11211) || ((stackDepth == 11212) || ((stackDepth == 11213) || ((stackDepth == 11214) || ((stackDepth == 11301) || ((stackDepth == 11302) || ((stackDepth == 11303) || ((stackDepth == 11304) || ((stackDepth == 11305) || ((stackDepth == 11306) || ((stackDepth == 11307) || ((stackDepth == 11308) || ((stackDepth == 11309) || ((stackDepth == 11401) || ((stackDepth == 11402) || ((stackDepth == 11403) || ((stackDepth == 11404) || ((stackDepth == 11501) || ((stackDepth == 11502) || ((stackDepth == 11503) || ((stackDepth == 11504) || ((stackDepth == 11505) || ((stackDepth == 11601) || ((stackDepth == 11602) || ((stackDepth == 11603) || ((stackDepth == 11604) || ((stackDepth == 11605) || ((stackDepth == 11606) || ((stackDepth == 11701) || ((stackDepth == 11702) || ((stackDepth == 11800) || ((stackDepth == 11901) || ((stackDepth == 11902) || ((stackDepth == 11903) || ((stackDepth == 11904) || ((stackDepth == 11905) || ((stackDepth == 12001) || ((stackDepth == 12002) || ((stackDepth == 12003) || ((stackDepth == 12004) || ((stackDepth == 12101) || ((stackDepth == 12102) || ((stackDepth == 12103) || ((stackDepth == 12104) || ((stackDepth == 12105) || ((stackDepth == 12106) || ((stackDepth == 12107) || ((stackDepth == 12108) || ((stackDepth == 12109) || ((stackDepth == 12110) || ((stackDepth == 12111) || ((stackDepth == 12112) || ((stackDepth == 12113) || ((stackDepth == 12114) || ((stackDepth == 12115) || ((stackDepth == 12116) || ((stackDepth == 12201) || ((stackDepth == 12202) || ((stackDepth == 12203) || ((stackDepth == 12204) || ((stackDepth == 12205) || ((stackDepth == 12301) || ((stackDepth == 12302) || ((stackDepth == 12401) || ((stackDepth == 12402) || ((stackDepth == 12403) || ((stackDepth == 12404) || ((stackDepth == 12405) || ((stackDepth == 12406) || ((stackDepth == 12501) || ((stackDepth == 12502) || ((stackDepth == 12601) || ((stackDepth == 12602) || ((stackDepth == 12603) || ((stackDepth == 12700) || ((stackDepth == 12800) || ((stackDepth == 12900) || ((stackDepth == 13001) || ((stackDepth == 13002) || ((stackDepth == 13003) || ((stackDepth == 13004) || ((stackDepth == 13005) || ((stackDepth == 13101) || ((stackDepth == 13102) || ((stackDepth == 13103) || ((stackDepth == 13201) || ((stackDepth == 13202) || ((stackDepth == 13203) || ((stackDepth == 13301) || ((stackDepth == 13302) || ((stackDepth == 13303) || ((stackDepth == 13304) || ((stackDepth == 13401) || ((stackDepth == 13402) || ((stackDepth == 13403) || ((stackDepth == 13404) || ((stackDepth == 13405) || ((stackDepth == 13501) || ((stackDepth == 13502) || ((stackDepth == 13600) || ((stackDepth == 13701) || ((stackDepth == 13702) || ((stackDepth == 13703) || ((stackDepth == 13800) || ((stackDepth == 13901) || ((stackDepth == 13902) || ((stackDepth == 13903) || ((stackDepth == 14001) || ((stackDepth == 14002) || ((stackDepth == 14100) || ((stackDepth == 14200) || ((stackDepth == 14301) || ((stackDepth == 14302) || ((stackDepth == 14400) || ((stackDepth == 14501) || ((stackDepth == 14502) || ((stackDepth == 14601) || ((stackDepth == 14602) || ((stackDepth == 14603) || ((stackDepth == 14604) || ((stackDepth == 14605) || ((stackDepth == 14606) || ((stackDepth == 14607) || ((stackDepth == 14701) || ((stackDepth == 14702) || ((stackDepth == 14703) || ((stackDepth == 14704) || ((stackDepth == 14705) || ((stackDepth == 14706) || ((stackDepth == 14707) || ((stackDepth == 14708) || ((stackDepth == 14709) || ((stackDepth == 14710) || ((stackDepth == 14711) || ((stackDepth == 14712) || ((stackDepth == 14713) || ((stackDepth == 14714) || ((stackDepth == 14715) || ((stackDepth == 14716) || ((stackDepth == 14717) || ((stackDepth == 14718) || ((stackDepth == 14719) || ((stackDepth == 14720 || ((stackDepth == 14717 || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717 || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717 || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717) || ((stackDepth == 14717)))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))); - } - } -} -") - }; - - yield return new object[] - { - new CSharpSyntaxFragment("ExpressionParsingTests.InProgressLocalDeclaration1",@" -class C -{ - async void M() - { - Task. - await Task.Delay(); - } -} -") - }; - - yield return new object[] - { - new CSharpSyntaxFragment("ExpressionParsingTests.InProgressLocalDeclaration2",@" -class C -{ - async void M() - { - Task.await Task.Delay(); - } -} -") - }; - - yield return new object[] - { - new CSharpSyntaxFragment("ExpressionParsingTests.InProgressLocalDeclaration3",@" -class C -{ - async void M() - { - Task. - await Task; - } -} -") - }; - - yield return new object[] - { - new CSharpSyntaxFragment("ExpressionParsingTests.InProgressLocalDeclaration4",@" -class C -{ - async void M() - { - Task. - await Task = 1; - } -} -") - }; - - yield return new object[] - { - new CSharpSyntaxFragment("ExpressionParsingTests.InProgressLocalDeclaration5",@" -class C -{ - async void M() - { - Task. - await Task, Task2; - } -} -") - }; - - yield return new object[] - { - new CSharpSyntaxFragment("ExpressionParsingTests.InProgressLocalDeclaration6",@" -class C -{ - async void M() - { - Task. - await Task(); - } -} -") - }; - - yield return new object[] - { - new CSharpSyntaxFragment("ExpressionParsingTests.InProgressLocalDeclaration7",@" -class C -{ - async void M() - { - Task. - await Task(); - } -} -") - }; - - yield return new object[] - { - new CSharpSyntaxFragment("ExpressionParsingTests.InProgressLocalDeclaration8",@" -class C -{ - async void M() - { - Task. - await Task[1]; - } -} -") - }; - - yield return new object[] - { - new CSharpSyntaxFragment("ExpressionParsingTests.TypeArgumentShiftAmbiguity_01",@" -class C -{ - void M() - { - //int a = 1; - //int i = 1; - var j = a < i >> 2; - } -} -") - }; - - yield return new object[] - { - new CSharpSyntaxFragment("ExpressionParsingTests.TypeArgumentShiftAmbiguity_02",@" -class C -{ - void M() - { - //const int a = 1; - //const int i = 2; - switch (false) - { - case a < i >> 2: break; - } - } -} -") - }; - - yield return new object[] - { - new CSharpSyntaxFragment("ExpressionParsingTests.TypeArgumentShiftAmbiguity_03",@" -class C -{ - void M() - { - M(out a < i >> 2); - } -} -") - }; - - yield return new object[] - { - new CSharpSyntaxFragment("ExpressionParsingTests.TypeArgumentShiftAmbiguity_04",@" -class C -{ - void M() - { - // (e is a) > 2 - var j = e is a < i >> 2; - } -} -") - }; - - yield return new object[] - { - new CSharpSyntaxFragment("ExpressionParsingTests.TypeArgumentShiftAmbiguity_05",@" -class C -{ - void M() - { - var j = e is a < i >>> 2; - } -} -") - }; - - yield return new object[] - { - new CSharpSyntaxFragment("ExpressionParsingTests.TypeArgumentShiftAmbiguity_06",@" -class C -{ - void M() - { - // syntax error - var j = e is a < i > << 2; - } -} -") - }; - - yield return new object[] - { - new CSharpSyntaxFragment("ExpressionParsingTests.TypeArgumentShiftAmbiguity_07",@" -class C -{ - void M() - { - // syntax error - var j = e is a < i >>>> 2; - } -} -") - }; - - yield return new object[] - { - new CSharpSyntaxFragment("ExpressionParsingTests.TypeArgumentShiftAmbiguity_08",@" -class C -{ - void M() - { - M(out a < i >>> 2); - } -} -") - }; - - yield return new object[] - { - new CSharpSyntaxFragment("ExpressionParsingTests.TypeArgumentShiftAmbiguity_09",@" -class C -{ - void M() - { - //const int a = 1; - //const int i = 2; - switch (false) - { - case a < i >>> 2: break; - } - } -} -") - }; - - yield return new object[] - { - new CSharpSyntaxFragment("ExpressionParsingTests.TypeArgumentShiftAmbiguity_10",@" -class C -{ - void M() - { - //int a = 1; - //int i = 1; - var j = a < i >>> 2; - } -} -") - }; - - yield return new object[] - { - new CSharpSyntaxFragment("ExpressionParsingTests.TestTargetTypedDefaultWithCSharp7_1","default") - }; - - yield return new object[] - { - new CSharpSyntaxFragment("ExpressionParsingTests.MismatchedInterpolatedStringContents_01",@"class A -{ - void M() - { - if (b) - { - A B = new C($@""{D(.E}""); - N.O("""", P.Q); - R.S(T); - U.V(W.X, Y.Z); - } - } - - string M() => """"; -}") - }; - - yield return new object[] - { - new CSharpSyntaxFragment("ExpressionParsingTests.MismatchedInterpolatedStringContents_02",@"class A -{ - void M() - { - if (b) - { - A B = new C($@""{D(.E}\F\G{H}_{I.J.K(""L"")}.M""); - N.O("""", P.Q); - R.S(T); - U.V(W.X, Y.Z); - } - } - - string M() => """"; -}") - }; - - yield return new object[] - { - new CSharpSyntaxFragment("ExpressionParsingTests.LinqQueryInConditionalExpression1","x is X ? from item in collection select item : null") - }; - - yield return new object[] - { - new CSharpSyntaxFragment("ExpressionParsingTests.LinqQueryInConditionalExpression2","x is X.Y ? from item in collection select item : null") - }; - - yield return new object[] - { - new CSharpSyntaxFragment("ExpressionParsingTests.LinqQueryInConditionalExpression_Incomplete","x is X.Y ? from item") - }; - - yield return new object[] - { - new CSharpSyntaxFragment("FunctionPointerTests.LangVersion8","delegate* unmanaged[cdecl] ptr;") - }; - - yield return new object[] - { - new CSharpSyntaxFragment("LocalFunctionParsingTests.DiagnosticsWithoutExperimental",@" -class c -{ - void m() - { - int local() => 0; - } - void m2() - { - int local() { return 0; } - } -}") - }; - - yield return new object[] - { - new CSharpSyntaxFragment("LocalFunctionParsingTests.StaticFunctions",@"class Program -{ - void M() - { - static void F() { } - } -}") - }; - - yield return new object[] - { - new CSharpSyntaxFragment("LocalFunctionParsingTests.AsyncStaticFunctions",@"class Program -{ - void M() - { - static async void F1() { } - async static void F2() { } - } -}") - }; - - yield return new object[] - { - new CSharpSyntaxFragment("LocalFunctionParsingTests.DuplicateStatic",@"class Program -{ - void M() - { - static static void F1() { } - static async static void F2() { } - } -}") - }; - - yield return new object[] - { - new CSharpSyntaxFragment("LocalFunctionParsingTests.DuplicateAsyncs1",""" - class Program - { - void M() - { - #pragma warning disable 1998, 8321 - async async void F() { } - } - } - """) - }; - - yield return new object[] - { - new CSharpSyntaxFragment("LocalFunctionParsingTests.DuplicateAsyncs2",""" - class Program - { - void M() - { - #pragma warning disable 1998, 8321 - async async async void F() { } - } - } - """) - }; - - yield return new object[] - { - new CSharpSyntaxFragment("LocalFunctionParsingTests.DuplicateAsyncs3",""" - class Program - { - void M() - { - #pragma warning disable 1998, 8321 - async async async async void F() { } - } - } - """) - }; - - yield return new object[] - { - new CSharpSyntaxFragment("LocalFunctionParsingTests.DuplicateAsyncs4",""" - class Program - { - void M() - { - #pragma warning disable 1998, 8321 - async async async async async void F() { } - } - } - """) - }; - - yield return new object[] - { - new CSharpSyntaxFragment("LocalFunctionParsingTests.ReturnTypeBeforeStatic",@"class Program -{ - void M() - { - void static F() { } - } -}") - }; - - yield return new object[] - { - new CSharpSyntaxFragment("LocalFunctionParsingTests.ExtraInvocationClosingParentheses",""" - public class C - { - public void M() - { - int sum0 = Sum(1, 2)); - - void Local() - { - AnotherLocal()); - - int sum1 = Sum(1, 2)); - int sum2 = Sum(1, 3)); - - void AnotherLocal() - { - int x = sum2 + 2; - } - } - } - - public static int Sum(int a, int b) => a + b; - } - """) - }; - - yield return new object[] - { - new CSharpSyntaxFragment("MemberDeclarationParsingTests.OperatorDeclaration_ExplicitImplementation_01","public int N.I.operator +(int x, int y) => x + y;") - }; - - yield return new object[] - { - new CSharpSyntaxFragment("MemberDeclarationParsingTests.OperatorDeclaration_ExplicitImplementation_02","public int N.I.implicit (int x) => x;") - }; - - yield return new object[] - { - new CSharpSyntaxFragment("MemberDeclarationParsingTests.OperatorDeclaration_ExplicitImplementation_03","public int N.I.explicit (int x) => x;") - }; - - yield return new object[] - { - new CSharpSyntaxFragment("MemberDeclarationParsingTests.OperatorDeclaration_ExplicitImplementation_04","public int N.I operator +(int x) => x;") - }; - - yield return new object[] - { - new CSharpSyntaxFragment("MemberDeclarationParsingTests.OperatorDeclaration_ExplicitImplementation_05","public int I operator +(int x) => x;") - }; - - yield return new object[] - { - new CSharpSyntaxFragment("MemberDeclarationParsingTests.OperatorDeclaration_ExplicitImplementation_11","public int N.I.operator +(int x, int y) => x + y;") - }; - - yield return new object[] - { - new CSharpSyntaxFragment("MemberDeclarationParsingTests.OperatorDeclaration_ExplicitImplementation_12","public int N.I.implicit (int x) => x;") - }; - - yield return new object[] - { - new CSharpSyntaxFragment("MemberDeclarationParsingTests.OperatorDeclaration_ExplicitImplementation_13","public int N.I.explicit (int x) => x;") - }; - - yield return new object[] - { - new CSharpSyntaxFragment("MemberDeclarationParsingTests.OperatorDeclaration_ExplicitImplementation_14","public int N.I operator +(int x) => x;") - }; - - yield return new object[] - { - new CSharpSyntaxFragment("MemberDeclarationParsingTests.OperatorDeclaration_ExplicitImplementation_15","public int I operator +(int x) => x;") - }; - - yield return new object[] - { - new CSharpSyntaxFragment("MemberDeclarationParsingTests.OperatorDeclaration_ExplicitImplementation_23","int N.I.operator +(int x, int y) => x + y;") - }; - - yield return new object[] - { - new CSharpSyntaxFragment("MemberDeclarationParsingTests.OperatorDeclaration_ExplicitImplementation_24","int N.I.implicit (int x) => x;") - }; - - yield return new object[] - { - new CSharpSyntaxFragment("MemberDeclarationParsingTests.OperatorDeclaration_ExplicitImplementation_25","int N.I.explicit (int x) => x;") - }; - - yield return new object[] - { - new CSharpSyntaxFragment("MemberDeclarationParsingTests.OperatorDeclaration_ExplicitImplementation_26","int N.I operator +(int x) => x;") - }; - - yield return new object[] - { - new CSharpSyntaxFragment("MemberDeclarationParsingTests.OperatorDeclaration_ExplicitImplementation_27","int I operator +(int x) => x;") - }; - - yield return new object[] - { - new CSharpSyntaxFragment("MemberDeclarationParsingTests.OperatorDeclaration_ExplicitImplementation_33","int N.I.operator +(int x, int y) => x + y;") - }; - - yield return new object[] - { - new CSharpSyntaxFragment("MemberDeclarationParsingTests.OperatorDeclaration_ExplicitImplementation_34","int N.I.implicit (int x) => x;") - }; - - yield return new object[] - { - new CSharpSyntaxFragment("MemberDeclarationParsingTests.OperatorDeclaration_ExplicitImplementation_35","int N.I.explicit (int x) => x;") - }; - - yield return new object[] - { - new CSharpSyntaxFragment("MemberDeclarationParsingTests.OperatorDeclaration_ExplicitImplementation_36","int N.I operator +(int x) => x;") - }; - - yield return new object[] - { - new CSharpSyntaxFragment("MemberDeclarationParsingTests.OperatorDeclaration_ExplicitImplementation_37","int I operator +(int x) => x;") - }; - - yield return new object[] - { - new CSharpSyntaxFragment("MemberDeclarationParsingTests.ConversionDeclaration_ExplicitImplementation_01","implicit N.I.operator int(int x) => x;") - }; - - yield return new object[] - { - new CSharpSyntaxFragment("MemberDeclarationParsingTests.ConversionDeclaration_ExplicitImplementation_02","N.I.operator int(int x) => x;") - }; - - yield return new object[] - { - new CSharpSyntaxFragment("MemberDeclarationParsingTests.ConversionDeclaration_ExplicitImplementation_04","implicit N.I operator int(int x) => x;") - }; - - yield return new object[] - { - new CSharpSyntaxFragment("MemberDeclarationParsingTests.ConversionDeclaration_ExplicitImplementation_05","explicit I operator int(int x) => x;") - }; - - yield return new object[] - { - new CSharpSyntaxFragment("MemberDeclarationParsingTests.ConversionDeclaration_ExplicitImplementation_11","explicit N.I.operator int(int x) => x;") - }; - - yield return new object[] - { - new CSharpSyntaxFragment("MemberDeclarationParsingTests.ConversionDeclaration_ExplicitImplementation_12","implicit N.I int(int x) => x;") - }; - - yield return new object[] - { - new CSharpSyntaxFragment("MemberDeclarationParsingTests.ConversionDeclaration_ExplicitImplementation_13","explicit N.I. int(int x) => x;") - }; - - yield return new object[] - { - new CSharpSyntaxFragment("MemberDeclarationParsingTests.ConversionDeclaration_ExplicitImplementation_14","implicit N.I operator int(int x) => x;") - }; - - yield return new object[] - { - new CSharpSyntaxFragment("MemberDeclarationParsingTests.ConversionDeclaration_ExplicitImplementation_15","explicit I operator int(int x) => x;") - }; - - yield return new object[] - { - new CSharpSyntaxFragment("MemberDeclarationParsingTests.PropertyWithErrantSemicolon1",@" -public class Class -{ - public int MyProperty; { get; set; } - - // Pretty much anything here causes an error -} -") - }; - - yield return new object[] - { - new CSharpSyntaxFragment("MemberDeclarationParsingTests.PropertyWithErrantSemicolon2",@" -public class Class -{ - public int MyProperty; => 0; - - // Pretty much anything here causes an error -} -") - }; - - yield return new object[] - { - new CSharpSyntaxFragment("NameParsingTests.TestBasicName","goo") - }; - - yield return new object[] - { - new CSharpSyntaxFragment("NameParsingTests.TestBasicNameWithTrash","/*comment*/goo/*comment2*/ bar") - }; - - yield return new object[] - { - new CSharpSyntaxFragment("NameParsingTests.TestMissingNameDueToKeyword","class") - }; - - yield return new object[] - { - new CSharpSyntaxFragment("NameParsingTests.TestMissingNameDueToPartialClassStart","partial class") - }; - - yield return new object[] - { - new CSharpSyntaxFragment("NameParsingTests.TestMissingNameDueToPartialMethodStart","partial void Method()") - }; - - yield return new object[] - { - new CSharpSyntaxFragment("NameParsingTests.TestAliasedName","goo::bar") - }; - - yield return new object[] - { - new CSharpSyntaxFragment("NameParsingTests.TestGlobalAliasedName","global::bar") - }; - - yield return new object[] - { - new CSharpSyntaxFragment("NameParsingTests.TestDottedName","goo.bar") - }; - - yield return new object[] - { - new CSharpSyntaxFragment("NameParsingTests.TestAliasedDottedName","goo::bar.Zed") - }; - - yield return new object[] - { - new CSharpSyntaxFragment("NameParsingTests.TestDoubleAliasName","goo::bar::baz") - }; - - yield return new object[] - { - new CSharpSyntaxFragment("NameParsingTests.TestGenericName","goo") - }; - - yield return new object[] - { - new CSharpSyntaxFragment("NameParsingTests.TestGenericNameWithTwoArguments","goo") - }; - - yield return new object[] - { - new CSharpSyntaxFragment("NameParsingTests.TestNestedGenericName_01","goo>") - }; - - yield return new object[] - { - new CSharpSyntaxFragment("NameParsingTests.TestNestedGenericName_02","goo>>") - }; - - yield return new object[] - { - new CSharpSyntaxFragment("NameParsingTests.TestOpenNameWithNoCommas","goo<>") - }; - - yield return new object[] - { - new CSharpSyntaxFragment("NameParsingTests.TestOpenNameWithAComma","goo<,>") - }; - - yield return new object[] - { - new CSharpSyntaxFragment("NameParsingTests.TestBasicTypeName","goo") - }; - - yield return new object[] - { - new CSharpSyntaxFragment("NameParsingTests.TestDottedTypeName","goo.bar") - }; - - yield return new object[] - { - new CSharpSyntaxFragment("NameParsingTests.TestGenericTypeName","goo") - }; - - yield return new object[] - { - new CSharpSyntaxFragment("NameParsingTests.TestNestedGenericTypeName_01","goo>") - }; - - yield return new object[] - { - new CSharpSyntaxFragment("NameParsingTests.TestNestedGenericTypeName_02","goo>>") - }; - - yield return new object[] - { - new CSharpSyntaxFragment("NameParsingTests.TestOpenTypeNameWithNoCommas","goo<>") - }; - - yield return new object[] - { - new CSharpSyntaxFragment("NameParsingTests.TestNullableTypeName","goo?") - }; - - yield return new object[] - { - new CSharpSyntaxFragment("NameParsingTests.TestPointerTypeName","goo*") - }; - - yield return new object[] - { - new CSharpSyntaxFragment("NameParsingTests.TestPointerTypeNameWithMultipleAsterisks","goo***") - }; - - yield return new object[] - { - new CSharpSyntaxFragment("NameParsingTests.TestArrayTypeName","goo[]") - }; - - yield return new object[] - { - new CSharpSyntaxFragment("NameParsingTests.TestMultiDimensionalArrayTypeName","goo[,,]") - }; - - yield return new object[] - { - new CSharpSyntaxFragment("NameParsingTests.TestMultiRankedArrayTypeName","goo[][,][,,]") - }; - - yield return new object[] - { - new CSharpSyntaxFragment("NameParsingTests.TestVarianceInNameBad","goo") - }; - - yield return new object[] - { - new CSharpSyntaxFragment("NameParsingTests.TestAttributeInNameBad","goo<[My]bar>") - }; - - yield return new object[] - { - new CSharpSyntaxFragment("NameParsingTests.TestConstantInGenericNameBad","goo<0>") - }; - - yield return new object[] - { - new CSharpSyntaxFragment("NameParsingTests.TestConstantInGenericNamePartiallyBad","goo<0,bool>") - }; - - yield return new object[] - { - new CSharpSyntaxFragment("NameParsingTests.TestKeywordInGenericNameBad","goo") - }; - - yield return new object[] - { - new CSharpSyntaxFragment("NameParsingTests.TestAttributeAndVarianceInNameBad","goo<[My]in bar>") - }; - - yield return new object[] - { - new CSharpSyntaxFragment("NameParsingTests.TestFormattingCharacter","\u0915\u094d\u200d\u0937") - }; - - yield return new object[] - { - new CSharpSyntaxFragment("NameParsingTests.TestSoftHyphen","x\u00ady") - }; - - yield return new object[] - { - new CSharpSyntaxFragment("ParserErrorMessageTests.CS1009ERR_IllegalEscape_Strings",@" -class Program -{ - static void Main() - { - string s; - s = ""\u""; - s = ""\u0""; - s = ""\u00""; - s = ""\u000""; - - s = ""a\uz""; - s = ""a\u0z""; - s = ""a\u00z""; - s = ""a\u000z""; - } -} -") - }; - - yield return new object[] - { - new CSharpSyntaxFragment("ParserErrorMessageTests.CS1009ERR_IllegalEscape_Identifiers",@"using System; -class Program -{ - static void Main() - { - int \u; - int \u0; - int \u00; - int \u000; - - int a\uz; - int a\u0z; - int a\u00z; - int a\u000z; - } -} -") - }; - - yield return new object[] - { - new CSharpSyntaxFragment("ParserErrorMessageTests.CS1031ERR_TypeExpected02",@"namespace x -{ - public class a - { - public static void Main() - { - e = new base; // CS1031, not a type - e = new this; // CS1031, not a type - } - } -} -") - }; - - yield return new object[] - { - new CSharpSyntaxFragment("ParserErrorMessageTests.CS1031ERR_TypeExpected02_Tuple",@"namespace x -{ - public class @a - { - public static void Main() - { - var e = new (); - } - } -} -") - }; - - yield return new object[] - { - new CSharpSyntaxFragment("ParserErrorMessageTests.CS1031ERR_TypeExpected02WithCSharp6",@"namespace x -{ - public class a - { - public static void Main() - { - e = new base; // CS1031, not a type - e = new this; // CS1031, not a type - } - } -} -") - }; - - yield return new object[] - { - new CSharpSyntaxFragment("ParserErrorMessageTests.CS1031ERR_TypeExpected02WithCSharp6_Tuple",@"namespace x -{ - public class @a - { - public static void Main() - { - var e = new (); - } - } -} -") - }; - - yield return new object[] - { - new CSharpSyntaxFragment("ParserErrorMessageTests.CS1031ERR_TypeExpected02WithCSharp7_Tuple",@"namespace x -{ - public class @a - { - public static void Main() - { - var e = new (); - } - } -} -") - }; - - yield return new object[] - { - new CSharpSyntaxFragment("ParserErrorMessageTests.InvalidQueryExpression",@" -using System; -using System.Linq; - -public class QueryExpressionTest -{ - public static void Main() - { - var expr1 = new[] { 1, 2, 3 }; - var expr2 = new[] { 1, 2, 3 }; - - var query13 = from const in expr1 join i in expr2 on const equals i select new { const, i }; - } -} -") - }; - - yield return new object[] - { - new CSharpSyntaxFragment("ParserErrorMessageTests.PartialTypesBeforeVersionTwo",@" -partial class C -{ -} -") - }; - - yield return new object[] - { - new CSharpSyntaxFragment("ParserErrorMessageTests.PartialMethodsVersionThree",@" -class C -{ - partial int Goo() { } -} -") - }; - - yield return new object[] - { - new CSharpSyntaxFragment("ParserErrorMessageTests.QueryBeforeVersionThree",@" -class C -{ - void Goo() - { - var q = from a in b - select c; - } -} -") - }; - - yield return new object[] - { - new CSharpSyntaxFragment("ParserErrorMessageTests.AnonymousTypeBeforeVersionThree",@" -class C -{ - void Goo() - { - var q = new { }; - } -} -") - }; - - yield return new object[] - { - new CSharpSyntaxFragment("ParserErrorMessageTests.ImplicitArrayBeforeVersionThree",@" -class C -{ - void Goo() - { - var q = new [] { }; - } -} -") - }; - - yield return new object[] - { - new CSharpSyntaxFragment("ParserErrorMessageTests.ObjectInitializerBeforeVersionThree",@" -class C -{ - void Goo() - { - var q = new Goo { }; - } -} -") - }; - - yield return new object[] - { - new CSharpSyntaxFragment("ParserErrorMessageTests.LambdaBeforeVersionThree",@" -class C -{ - void Goo() - { - var q = a => b; - } -} -") - }; - - yield return new object[] - { - new CSharpSyntaxFragment("ParserErrorMessageTests.ExceptionFilterBeforeVersionSix",@" -public class C -{ - public static int Main() - { - try { } catch when (true) {} - } -} -") - }; - - yield return new object[] - { - new CSharpSyntaxFragment("ParserErrorMessageTests.MissingCommaInAttribute",@"[One Two] // error: missing comma -class TestClass { }") - }; - - yield return new object[] - { - new CSharpSyntaxFragment("ParserErrorMessageTests.InterpolatedStringBeforeCSharp6",@" -class C -{ - string M() - { - return $""hello""; - } -}") - }; - - yield return new object[] - { - new CSharpSyntaxFragment("ParserErrorMessageTests.InterpolatedStringWithReplacementBeforeCSharp6",@" -class C -{ - string M() - { - string other = ""world""; - return $""hello + {other}""; - } -}") - }; - - yield return new object[] - { - new CSharpSyntaxFragment("ParserErrorMessageTests.AsyncBeforeCSharp5",@" -class C -{ - async void M() { } -} -") - }; - - yield return new object[] - { - new CSharpSyntaxFragment("ParserErrorMessageTests.AsyncWithOtherModifiersBeforeCSharp5",@" -class C -{ - async static void M() { } -} -") - }; - - yield return new object[] - { - new CSharpSyntaxFragment("ParserErrorMessageTests.AsyncLambdaBeforeCSharp5",@" -class C -{ - static void Main() - { - Func> f = async x => x; - } -} -") - }; - - yield return new object[] - { - new CSharpSyntaxFragment("ParserErrorMessageTests.AsyncDelegateBeforeCSharp5",@" -class C -{ - static void Main() - { - Func> f = async delegate (int x) { return x; }; - } -} -") - }; - - yield return new object[] - { - new CSharpSyntaxFragment("ParserErrorMessageTests.NamedArgumentBeforeCSharp4",@" -[Attr(x:1)] -class C -{ - C() - { - M(y:2); - } -} -") - }; - - yield return new object[] - { - new CSharpSyntaxFragment("ParserErrorMessageTests.GlobalKeywordBeforeCSharp2",@" -class C : global::B -{ -} -") - }; - - yield return new object[] - { - new CSharpSyntaxFragment("ParserErrorMessageTests.AliasQualifiedNameBeforeCSharp2",@" -class C : A::B -{ -} -") - }; - - yield return new object[] - { - new CSharpSyntaxFragment("ParserErrorMessageTests.OptionalParameterBeforeCSharp4",@" -class C -{ - void M(int x = 1) { } -} -") - }; - - yield return new object[] - { - new CSharpSyntaxFragment("ParserErrorMessageTests.ObjectInitializerBeforeCSharp3",@" -class C -{ - void M() - { - return new C { Goo = 1 }; - } -} -") - }; - - yield return new object[] - { - new CSharpSyntaxFragment("ParserErrorMessageTests.CollectionInitializerBeforeCSharp3",@" -class C -{ - void M() - { - return new C { 1, 2, 3 }; - } -} -") - }; - - yield return new object[] - { - new CSharpSyntaxFragment("ParserErrorMessageTests.CrefGenericBeforeCSharp2",@" -/// -class C -{ -} -") - }; - - yield return new object[] - { - new CSharpSyntaxFragment("ParserErrorMessageTests.CrefAliasQualifiedNameBeforeCSharp2",@" -/// -/// -class C { } -") - }; - - yield return new object[] - { - new CSharpSyntaxFragment("ParserErrorMessageTests.PragmaBeforeCSharp2",@" -#pragma warning disable 1584 -#pragma checksum ""file.txt"" ""{00000000-0000-0000-0000-000000000000}"" ""2453"" -class C { } -") - }; - - yield return new object[] - { - new CSharpSyntaxFragment("ParserErrorMessageTests.PragmaBeforeCSharp2_InDisabledCode",@" -#if UNDEF -#pragma warning disable 1584 -#pragma checksum ""file.txt"" ""{00000000-0000-0000-0000-000000000000}"" ""2453"" -#endif -class C { } -") - }; - - yield return new object[] - { - new CSharpSyntaxFragment("ParserErrorMessageTests.AwaitAsIdentifierInAsyncContext",@" -class C -{ - async void f() - { - int await; - } -} -") - }; - - yield return new object[] - { - new CSharpSyntaxFragment("PatternParsingTests.ParenthesizedSwitchCase",@" -switch (e) -{ - case (0): break; - case (-1): break; - case (+2): break; - case (~3): break; -} -") - }; - - yield return new object[] - { - new CSharpSyntaxFragment("RawInterpolatedStringLiteralParsingTests.SingleLine1",@" -class C -{ - void M() - { - var v = $"""""" """"""; - } -}") - }; - - yield return new object[] - { - new CSharpSyntaxFragment("RawInterpolatedStringLiteralParsingTests.SingleLineTooManyCloseQuotes1",@" -class C -{ - void M() - { - var v = $"""""" """"""""; - } -}") - }; - - yield return new object[] - { - new CSharpSyntaxFragment("RawInterpolatedStringLiteralParsingTests.SingleLineTooManyCloseQuotes2",@" -class C -{ - void M() - { - var v = $"""""" """"""""""; - } -}") - }; - - yield return new object[] - { - new CSharpSyntaxFragment("RawInterpolatedStringLiteralParsingTests.SingleLineSingleQuoteInside",@" -class C -{ - void M() - { - var v = $"""""" "" """"""; - } -}") - }; - - yield return new object[] - { - new CSharpSyntaxFragment("RawInterpolatedStringLiteralParsingTests.SingleLineDoubleQuoteInside",@" -class C -{ - void M() - { - var v = $"""""" """" """"""; - } -}") - }; - - yield return new object[] - { - new CSharpSyntaxFragment("RawInterpolatedStringLiteralParsingTests.SingleLineInterpolationInside",@" -class C -{ - void M() - { - var v = $""""""{0}""""""; - } -}") - }; - - yield return new object[] - { - new CSharpSyntaxFragment("RawInterpolatedStringLiteralParsingTests.SingleLineInterpolationInsideSpacesOutside",@" -class C -{ - void M() - { - var v = $"""""" {0} """"""; - } -}") - }; - - yield return new object[] - { - new CSharpSyntaxFragment("RawInterpolatedStringLiteralParsingTests.SingleLineInterpolationInsideSpacesInside",@" -class C -{ - void M() - { - var v = $""""""{ 0 }""""""; - } -}") - }; - - yield return new object[] - { - new CSharpSyntaxFragment("RawInterpolatedStringLiteralParsingTests.SingleLineInterpolationInsideSpacesInsideAndOutside",@" -class C -{ - void M() - { - var v = $"""""" { 0 } """"""; - } -}") - }; - - yield return new object[] - { - new CSharpSyntaxFragment("RawInterpolatedStringLiteralParsingTests.SingleLineInterpolationMultipleCurliesNotAllowed1",@" -class C -{ - void M() - { - var v = $""""""{{0}}""""""; - } -}") - }; - - yield return new object[] - { - new CSharpSyntaxFragment("RawInterpolatedStringLiteralParsingTests.SingleLineInterpolationMultipleCurliesNotAllowed2",@" -class C -{ - void M() - { - var v = $$""""""{{{{0}}}}""""""; - } -}") - }; - yield return new object[] { - new CSharpSyntaxFragment("RawInterpolatedStringLiteralParsingTests.SingleLineInterpolationMultipleCurliesNotAllowed3",@" + new SourceTestCase("ExpressionParsingTests.TypeArgumentShiftAmbiguity_01",@" class C { void M() { - var v = $""""""{0}}}""""""; + //int a = 1; + //int i = 1; + var j = a < i >> 2; } -}") +} +") }; - + yield return new object[] { - new CSharpSyntaxFragment("RawInterpolatedStringLiteralParsingTests.SingleLineInterpolationMultipleCurliesNotAllowed4",@" + new SourceTestCase("ExpressionParsingTests.TypeArgumentShiftAmbiguity_02",@" class C { void M() { - var v = $$""""""{{{0}}}}""""""; + //const int a = 1; + //const int i = 2; + switch (false) + { + case a < i >> 2: break; + } } -}") +} +") }; - + yield return new object[] { - new CSharpSyntaxFragment("RawInterpolatedStringLiteralParsingTests.SingleLineInterpolationMultipleCurliesNotAllowed5",@" + new SourceTestCase("ExpressionParsingTests.TypeArgumentShiftAmbiguity_03",@" class C { void M() { - var v = $$""""""{0}}""""""; + M(out a < i >> 2); } -}") +} +") }; - + yield return new object[] { - new CSharpSyntaxFragment("RawInterpolatedStringLiteralParsingTests.SingleLineInterpolationMultipleCurliesNotAllowed6",@" + new SourceTestCase("ExpressionParsingTests.TypeArgumentShiftAmbiguity_04",@" class C { void M() { - var v = $$""""""{{{0}""""""; + // (e is a) > 2 + var j = e is a < i >> 2; } -}") +} +") }; - + yield return new object[] { - new CSharpSyntaxFragment("RawInterpolatedStringLiteralParsingTests.SingleLineInterpolationMultipleCurliesAllowed1",@" + new SourceTestCase("ExpressionParsingTests.TypeArgumentShiftAmbiguity_05",@" class C { void M() { - var v = $$""""""{{0}}""""""; + var j = e is a < i >>> 2; } -}") +} +") }; - + yield return new object[] { - new CSharpSyntaxFragment("RawInterpolatedStringLiteralParsingTests.SingleLineInterpolationMultipleCurliesAllowed2",@" + new SourceTestCase("ExpressionParsingTests.TypeArgumentShiftAmbiguity_08",@" class C { void M() { - var v = $$""""""{{{0}}}""""""; + M(out a < i >>> 2); } -}") +} +") }; - + yield return new object[] { - new CSharpSyntaxFragment("RawInterpolatedStringLiteralParsingTests.SingleLineInterpolationMultipleCurliesAllowed4",@" + new SourceTestCase("ExpressionParsingTests.TypeArgumentShiftAmbiguity_09",@" class C { void M() { - var v = $$""""""{{{0}}""""""; + //const int a = 1; + //const int i = 2; + switch (false) + { + case a < i >>> 2: break; + } } -}") +} +") }; - + yield return new object[] { - new CSharpSyntaxFragment("RawInterpolatedStringLiteralParsingTests.SingleLineInterpolationContainingNormalString",@" + new SourceTestCase("ExpressionParsingTests.TypeArgumentShiftAmbiguity_10",@" class C { void M() { - var v = $""""""{""a""}""""""; + //int a = 1; + //int i = 1; + var j = a < i >>> 2; } -}") +} +") }; - + yield return new object[] { - new CSharpSyntaxFragment("RawInterpolatedStringLiteralParsingTests.SingleLineInterpolationContainingVerbatimString1",@" -class C -{ - void M() - { - var v = $""""""{@""a""}""""""; - } -}") + new SourceTestCase("FunctionPointerTests.LangVersion8","delegate* unmanaged[cdecl] ptr;") }; - + yield return new object[] { - new CSharpSyntaxFragment("RawInterpolatedStringLiteralParsingTests.SingleLineInterpolationContainingVerbatimString2",@" -class C + new SourceTestCase("LocalFunctionParsingTests.DiagnosticsWithoutExperimental",@" +class c { - void M() + void m() { - var v = $""""""{@"" -a""}""""""; + int local() => 0; + } + void m2() + { + int local() { return 0; } } }") }; - + yield return new object[] { - new CSharpSyntaxFragment("RawInterpolatedStringLiteralParsingTests.SingleLineInterpolationContainingInterpolatedString1",@" -class C + new SourceTestCase("LocalFunctionParsingTests.StaticFunctions",@"class Program { void M() { - var v = $""""""{$""a""}""""""; + static void F() { } } }") }; - + yield return new object[] { - new CSharpSyntaxFragment("RawInterpolatedStringLiteralParsingTests.SingleLineInterpolationContainingInterpolatedString2",@" -class C + new SourceTestCase("LocalFunctionParsingTests.AsyncStaticFunctions",@"class Program { void M() { - var v = $""""""{$""{0}""}""""""; + static async void F1() { } + async static void F2() { } } }") }; - + yield return new object[] { - new CSharpSyntaxFragment("RawInterpolatedStringLiteralParsingTests.SingleLineInterpolationContainingVerbatimInterpolatedString1",@" -class C -{ - void M() - { - var v = $""""""{$@""{0}""}""""""; - } -}") + new SourceTestCase("MemberDeclarationParsingTests.OperatorDeclaration_ExplicitImplementation_01","public int N.I.operator +(int x, int y) => x + y;") + }; + + yield return new object[] + { + new SourceTestCase("MemberDeclarationParsingTests.OperatorDeclaration_ExplicitImplementation_11","public int N.I.operator +(int x, int y) => x + y;") }; - + yield return new object[] { - new CSharpSyntaxFragment("RawInterpolatedStringLiteralParsingTests.SingleLineInterpolationContainingVerbatimInterpolatedString2",@" -class C + new SourceTestCase("MemberDeclarationParsingTests.OperatorDeclaration_ExplicitImplementation_23","int N.I.operator +(int x, int y) => x + y;") + }; + + yield return new object[] + { + new SourceTestCase("MemberDeclarationParsingTests.OperatorDeclaration_ExplicitImplementation_33","int N.I.operator +(int x, int y) => x + y;") + }; + + yield return new object[] + { + new SourceTestCase("MemberDeclarationParsingTests.ConversionDeclaration_ExplicitImplementation_01","implicit N.I.operator int(int x) => x;") + }; + + yield return new object[] + { + new SourceTestCase("MemberDeclarationParsingTests.ConversionDeclaration_ExplicitImplementation_11","explicit N.I.operator int(int x) => x;") + }; + + yield return new object[] + { + new SourceTestCase("ParserErrorMessageTests.CS1031ERR_TypeExpected02_Tuple",@"namespace x { - void M() + public class @a { - var v = $""""""{@$""{0}""}""""""; + public static void Main() + { + var e = new (); + } } -}") +} +") }; - + yield return new object[] { - new CSharpSyntaxFragment("RawInterpolatedStringLiteralParsingTests.SingleLineInterpolationContainingVerbatimInterpolatedString3",@" -class C + new SourceTestCase("ParserErrorMessageTests.CS1031ERR_TypeExpected02WithCSharp6_Tuple",@"namespace x { - void M() + public class @a { - var v = $""""""{$@""{ -0}""}""""""; + public static void Main() + { + var e = new (); + } } -}") +} +") }; - + yield return new object[] { - new CSharpSyntaxFragment("RawInterpolatedStringLiteralParsingTests.SingleLineInterpolationContainingVerbatimInterpolatedString4",@" -class C + new SourceTestCase("ParserErrorMessageTests.CS1031ERR_TypeExpected02WithCSharp7_Tuple",@"namespace x { - void M() + public class @a { - var v = $""""""{ -$@""{ -0}""}""""""; + public static void Main() + { + var e = new (); + } } -}") +} +") }; - + yield return new object[] { - new CSharpSyntaxFragment("RawInterpolatedStringLiteralParsingTests.SingleLineInterpolationContainingRawStringLiteral1",@" -class C + new SourceTestCase("ParserErrorMessageTests.PartialTypesBeforeVersionTwo",@" +partial class C { - void M() - { - var v = $""""""{""""""a""""""}""""""; - } -}") +} +") }; - + yield return new object[] { - new CSharpSyntaxFragment("RawInterpolatedStringLiteralParsingTests.SingleLineInterpolationContainingRawStringLiteral2",@" + new SourceTestCase("ParserErrorMessageTests.PartialMethodsVersionThree",@" class C { - void M() - { - var v = $""""""{"""""" - a - """"""}""""""; - } -}") + partial int Goo() { } +} +") }; - + yield return new object[] { - new CSharpSyntaxFragment("RawInterpolatedStringLiteralParsingTests.SingleLineInterpolationContainingRawStringLiteral3",@" + new SourceTestCase("ParserErrorMessageTests.QueryBeforeVersionThree",@" class C { - void M() + void Goo() { - var v = $""""""{"""""" - a - """"""}""""""; + var q = from a in b + select c; } -}") +} +") }; - + yield return new object[] { - new CSharpSyntaxFragment("RawInterpolatedStringLiteralParsingTests.SingleLineInterpolationContainingRawInterpolatedStringLiteral1",@" + new SourceTestCase("ParserErrorMessageTests.AnonymousTypeBeforeVersionThree",@" class C { - void M() + void Goo() { - var v = $""""""{$"""""" """"""}""""""; + var q = new { }; } -}") +} +") }; - + yield return new object[] { - new CSharpSyntaxFragment("RawInterpolatedStringLiteralParsingTests.SingleLineInterpolationContainingRawInterpolatedStringLiteral2",@" + new SourceTestCase("ParserErrorMessageTests.ImplicitArrayBeforeVersionThree",@" class C { - void M() + void Goo() { - var v = $""""""{$"""""""" """"""""}""""""; + var q = new [] { }; } -}") +} +") }; - + yield return new object[] { - new CSharpSyntaxFragment("RawInterpolatedStringLiteralParsingTests.SingleLineInterpolationContainingRawInterpolatedStringLiteral3",@" + new SourceTestCase("ParserErrorMessageTests.ObjectInitializerBeforeVersionThree",@" class C { - void M() + void Goo() { - var v = $""""""{$""""""{0}""""""}""""""; + var q = new Goo { }; } -}") +} +") }; - + yield return new object[] { - new CSharpSyntaxFragment("RawInterpolatedStringLiteralParsingTests.SingleLineInterpolationContainingRawInterpolatedStringLiteral4",@" + new SourceTestCase("ParserErrorMessageTests.LambdaBeforeVersionThree",@" class C { - void M() + void Goo() { - var v = $""""""{$""""""{ -0}""""""}""""""; + var q = a => b; } -}") +} +") }; - + yield return new object[] { - new CSharpSyntaxFragment("RawInterpolatedStringLiteralParsingTests.SingleLineInterpolationContainingRawInterpolatedStringLiteral5",@" -class C + new SourceTestCase("ParserErrorMessageTests.ExceptionFilterBeforeVersionSix",@" +public class C { - void M() + public static int Main() { - var v = $""""""{ -$""""""{ -0}""""""}""""""; + try { } catch when (true) {} } -}") +} +") }; - + yield return new object[] { - new CSharpSyntaxFragment("RawInterpolatedStringLiteralParsingTests.SingleLineInterpolationContainingRawInterpolatedStringLiteral6",@" + new SourceTestCase("ParserErrorMessageTests.InterpolatedStringBeforeCSharp6",@" class C { - void M() + string M() { - var v = $""""""{$$""""""{{0}}""""""}""""""; + return $""hello""; } }") }; - + yield return new object[] { - new CSharpSyntaxFragment("RawInterpolatedStringLiteralParsingTests.SingleLineInterpolationContainingRawInterpolatedStringLiteral7",@" + new SourceTestCase("ParserErrorMessageTests.InterpolatedStringWithReplacementBeforeCSharp6",@" class C { - void M() + string M() { - var v = $""""""{$$""""""{{{0}}}""""""}""""""; + string other = ""world""; + return $""hello + {other}""; } }") }; - + yield return new object[] { - new CSharpSyntaxFragment("RawInterpolatedStringLiteralParsingTests.SingleLineInterpolationContainingRawInterpolatedStringLiteral8",@" + new SourceTestCase("ParserErrorMessageTests.AsyncBeforeCSharp5",@" class C { - void M() - { - var v = $$""""""{{{$""""""{0}""""""}}}""""""; - } -}") + async void M() { } +} +") }; - + yield return new object[] { - new CSharpSyntaxFragment("RawInterpolatedStringLiteralParsingTests.SingleLineInterpolationContainingClosingBraceAsCharacterLiteral",@" + new SourceTestCase("ParserErrorMessageTests.AsyncWithOtherModifiersBeforeCSharp5",@" class C { - void M() - { - var v = $""""""{'}'}""""""; - } -}") + async static void M() { } +} +") }; - + yield return new object[] { - new CSharpSyntaxFragment("RawInterpolatedStringLiteralParsingTests.SingleLineInterpolationContainingClosingBraceAsRegularStringLiteral",@" + new SourceTestCase("ParserErrorMessageTests.AsyncLambdaBeforeCSharp5",@" class C { - void M() + static void Main() { - var v = $""""""{""}""}""""""; + Func> f = async x => x; } -}") +} +") }; - + yield return new object[] { - new CSharpSyntaxFragment("RawInterpolatedStringLiteralParsingTests.SingleLineInterpolationContainingClosingBraceAsVerbatimStringLiteral",@" + new SourceTestCase("ParserErrorMessageTests.AsyncDelegateBeforeCSharp5",@" class C { - void M() + static void Main() { - var v = $""""""{@""}""}""""""; + Func> f = async delegate (int x) { return x; }; } -}") +} +") }; - + yield return new object[] { - new CSharpSyntaxFragment("RawInterpolatedStringLiteralParsingTests.SingleLineInterpolationContainingClosingBraceAsRawStringLiteral",@" + new SourceTestCase("ParserErrorMessageTests.NamedArgumentBeforeCSharp4",@" +[Attr(x:1)] class C { - void M() + C() { - var v = $""""""{""""""}""""""}""""""; + M(y:2); } -}") +} +") }; - + yield return new object[] { - new CSharpSyntaxFragment("RawInterpolatedStringLiteralParsingTests.OuterNormalMiddleNormalInnerNormal",@" -class C + new SourceTestCase("ParserErrorMessageTests.GlobalKeywordBeforeCSharp2",@" +class C : global::B { - void M() - { - var v = $""{$""{$""{0}""}""}""; - } -}") +} +") }; - + yield return new object[] { - new CSharpSyntaxFragment("RawInterpolatedStringLiteralParsingTests.OuterNormalMiddleNormalInnerVerbatim",@" -class C + new SourceTestCase("ParserErrorMessageTests.AliasQualifiedNameBeforeCSharp2",@" +class C : A::B { - void M() - { - var v = $""{$""{$@""{0}""}""}""; - } -}") +} +") }; - + yield return new object[] { - new CSharpSyntaxFragment("RawInterpolatedStringLiteralParsingTests.OuterNormalMiddleNormalInnerRaw",@" + new SourceTestCase("ParserErrorMessageTests.OptionalParameterBeforeCSharp4",@" class C { - void M() - { - var v = $""{$""{$""""""{0}""""""}""}""; - } -}") + void M(int x = 1) { } +} +") }; - + yield return new object[] { - new CSharpSyntaxFragment("RawInterpolatedStringLiteralParsingTests.OuterNormalMiddleVerbatimInnerNormal",@" + new SourceTestCase("ParserErrorMessageTests.ObjectInitializerBeforeCSharp3",@" class C { void M() { - var v = $""{@$""{$""{0}""}""}""; + return new C { Goo = 1 }; } -}") +} +") }; - + yield return new object[] { - new CSharpSyntaxFragment("RawInterpolatedStringLiteralParsingTests.OuterNormalMiddleVerbatimInnerVerbatim",@" + new SourceTestCase("ParserErrorMessageTests.CollectionInitializerBeforeCSharp3",@" class C { void M() { - var v = $""{@$""{@$""{0}""}""}""; + return new C { 1, 2, 3 }; } -}") +} +") }; - + yield return new object[] { - new CSharpSyntaxFragment("RawInterpolatedStringLiteralParsingTests.OuterNormalMiddleVerbatimInnerRaw",@" + new SourceTestCase("ParserErrorMessageTests.CrefGenericBeforeCSharp2",@" +/// class C { - void M() - { - var v = $""{@$""{$""""""{0}""""""}""}""; - } -}") +} +") }; - + yield return new object[] { - new CSharpSyntaxFragment("RawInterpolatedStringLiteralParsingTests.OuterNormalMiddleRawInnerNormal",@" -class C + new SourceTestCase("ParserErrorMessageTests.CrefAliasQualifiedNameBeforeCSharp2",@" +/// +/// +class C { } +") + }; + + + yield return new object[] + { + new SourceTestCase("ParserErrorMessageTests.PragmaBeforeCSharp2",@" +#pragma warning disable 1584 +#pragma checksum ""file.txt"" ""{00000000-0000-0000-0000-000000000000}"" ""2453"" +class C { } +") + }; + + yield return new object[] + { + new SourceTestCase("ParserErrorMessageTests.PragmaBeforeCSharp2_InDisabledCode",@" +#if UNDEF +#pragma warning disable 1584 +#pragma checksum ""file.txt"" ""{00000000-0000-0000-0000-000000000000}"" ""2453"" +#endif +class C { } +") + }; + + yield return new object[] + { + new SourceTestCase("PatternParsingTests.ParenthesizedSwitchCase",@" +switch (e) { - void M() - { - var v = $""{$""""""{$""{0}""}""""""}""; - } -}") + case (0): break; + case (-1): break; + case (+2): break; + case (~3): break; +} +") }; - + yield return new object[] { - new CSharpSyntaxFragment("RawInterpolatedStringLiteralParsingTests.OuterNormalMiddleRawInnerVerbatim",@" + new SourceTestCase("RawInterpolatedStringLiteralParsingTests.SingleLine1",@" class C { void M() { - var v = $""{$""""""{@$""{0}""}""""""}""; + var v = $"""""" """"""; } }") }; - + yield return new object[] { - new CSharpSyntaxFragment("RawInterpolatedStringLiteralParsingTests.OuterNormalMiddleRawInnerRaw",@" + new SourceTestCase("RawInterpolatedStringLiteralParsingTests.SingleLineSingleQuoteInside",@" class C { void M() { - var v = $""{$""""""{$""""""{0}""""""}""""""}""; + var v = $"""""" "" """"""; } }") }; - + yield return new object[] { - new CSharpSyntaxFragment("RawInterpolatedStringLiteralParsingTests.OuterVerbatimMiddleNormalInnerNormal",@" + new SourceTestCase("RawInterpolatedStringLiteralParsingTests.SingleLineDoubleQuoteInside",@" class C { void M() { - var v = $@""{$""{$""{0}""}""}""; + var v = $"""""" """" """"""; } }") }; - + yield return new object[] { - new CSharpSyntaxFragment("RawInterpolatedStringLiteralParsingTests.OuterVerbatimMiddleNormalInnerVerbatim",@" + new SourceTestCase("RawInterpolatedStringLiteralParsingTests.SingleLineInterpolationInside",@" class C { void M() { - var v = $@""{$""{$@""{0}""}""}""; + var v = $""""""{0}""""""; } }") }; - + yield return new object[] { - new CSharpSyntaxFragment("RawInterpolatedStringLiteralParsingTests.OuterVerbatimMiddleNormalInnerRaw",@" + new SourceTestCase("RawInterpolatedStringLiteralParsingTests.SingleLineInterpolationInsideSpacesOutside",@" class C { void M() { - var v = $@""{$""{$""""""{0}""""""}""}""; + var v = $"""""" {0} """"""; } }") }; - + yield return new object[] { - new CSharpSyntaxFragment("RawInterpolatedStringLiteralParsingTests.OuterVerbatimMiddleVerbatimInnerNormal",@" + new SourceTestCase("RawInterpolatedStringLiteralParsingTests.SingleLineInterpolationInsideSpacesInside",@" class C { void M() { - var v = $@""{@$""{$""{0}""}""}""; + var v = $""""""{ 0 }""""""; } }") }; - + yield return new object[] { - new CSharpSyntaxFragment("RawInterpolatedStringLiteralParsingTests.OuterVerbatimMiddleVerbatimInnerVerbatim",@" + new SourceTestCase("RawInterpolatedStringLiteralParsingTests.SingleLineInterpolationInsideSpacesInsideAndOutside",@" class C { void M() { - var v = $@""{@$""{@$""{0}""}""}""; + var v = $"""""" { 0 } """"""; } }") }; - + yield return new object[] { - new CSharpSyntaxFragment("RawInterpolatedStringLiteralParsingTests.OuterVerbatimMiddleVerbatimInnerRaw",@" + new SourceTestCase("RawInterpolatedStringLiteralParsingTests.SingleLineInterpolationMultipleCurliesAllowed1",@" class C { void M() { - var v = $@""{@$""{$""""""{0}""""""}""}""; + var v = $$""""""{{0}}""""""; } }") }; - + yield return new object[] { - new CSharpSyntaxFragment("RawInterpolatedStringLiteralParsingTests.OuterVerbatimMiddleRawInnerNormal",@" + new SourceTestCase("RawInterpolatedStringLiteralParsingTests.SingleLineInterpolationMultipleCurliesAllowed2",@" class C { void M() { - var v = $@""{$""""""{$""{0}""}""""""}""; + var v = $$""""""{{{0}}}""""""; } }") }; - + yield return new object[] { - new CSharpSyntaxFragment("RawInterpolatedStringLiteralParsingTests.OuterVerbatimMiddleRawInnerVerbatim",@" + new SourceTestCase("RawInterpolatedStringLiteralParsingTests.SingleLineInterpolationMultipleCurliesAllowed4",@" class C { void M() { - var v = $@""{$""""""{@$""{0}""}""""""}""; + var v = $$""""""{{{0}}""""""; } }") }; - + yield return new object[] { - new CSharpSyntaxFragment("RawInterpolatedStringLiteralParsingTests.OuterVerbatimMiddleRawInnerRaw",@" + new SourceTestCase("RawInterpolatedStringLiteralParsingTests.SingleLineInterpolationContainingNormalString",@" class C { void M() { - var v = $@""{$""""""{$""""""{0}""""""}""""""}""; + var v = $""""""{""a""}""""""; } }") }; - + yield return new object[] { - new CSharpSyntaxFragment("RawInterpolatedStringLiteralParsingTests.OuterRawMiddleNormalInnerNormal",@" + new SourceTestCase("RawInterpolatedStringLiteralParsingTests.SingleLineInterpolationContainingVerbatimString1",@" class C { void M() { - var v = $""""""{$""{$""{0}""}""}""""""; + var v = $""""""{@""a""}""""""; } }") }; - + yield return new object[] { - new CSharpSyntaxFragment("RawInterpolatedStringLiteralParsingTests.OuterRawMiddleNormalInnerVerbatim",@" + new SourceTestCase("RawInterpolatedStringLiteralParsingTests.SingleLineInterpolationContainingVerbatimString2",@" class C { void M() { - var v = $""""""{$""{$@""{0}""}""}""""""; + var v = $""""""{@"" +a""}""""""; } }") }; - + yield return new object[] { - new CSharpSyntaxFragment("RawInterpolatedStringLiteralParsingTests.OuterRawMiddleNormalInnerRaw",@" + new SourceTestCase("RawInterpolatedStringLiteralParsingTests.SingleLineInterpolationContainingInterpolatedString1",@" class C { void M() { - var v = $""""""{$""{$""""""{0}""""""}""}""""""; + var v = $""""""{$""a""}""""""; } }") }; - + yield return new object[] { - new CSharpSyntaxFragment("RawInterpolatedStringLiteralParsingTests.OuterRawMiddleVerbatimInnerNormal",@" + new SourceTestCase("RawInterpolatedStringLiteralParsingTests.SingleLineInterpolationContainingInterpolatedString2",@" class C { void M() { - var v = $""""""{@$""{$""{0}""}""}""""""; + var v = $""""""{$""{0}""}""""""; } }") }; - + yield return new object[] { - new CSharpSyntaxFragment("RawInterpolatedStringLiteralParsingTests.OuterRawMiddleVerbatimInnerVerbatim",@" + new SourceTestCase("RawInterpolatedStringLiteralParsingTests.SingleLineInterpolationContainingVerbatimInterpolatedString1",@" class C { void M() { - var v = $""""""{@$""{@$""{0}""}""}""""""; + var v = $""""""{$@""{0}""}""""""; } }") }; - + yield return new object[] { - new CSharpSyntaxFragment("RawInterpolatedStringLiteralParsingTests.OuterRawMiddleVerbatimInnerRaw",@" + new SourceTestCase("RawInterpolatedStringLiteralParsingTests.SingleLineInterpolationContainingVerbatimInterpolatedString2",@" class C { void M() { - var v = $""""""{@$""{$""""""{0}""""""}""}""""""; + var v = $""""""{@$""{0}""}""""""; } }") }; - + yield return new object[] { - new CSharpSyntaxFragment("RawInterpolatedStringLiteralParsingTests.OuterRawMiddleRawInnerNormal",@" + new SourceTestCase("RawInterpolatedStringLiteralParsingTests.SingleLineInterpolationContainingVerbatimInterpolatedString3",@" class C { void M() { - var v = $""""""{$""""""{$""{0}""}""""""}""""""; + var v = $""""""{$@""{ +0}""}""""""; } }") }; - + yield return new object[] { - new CSharpSyntaxFragment("RawInterpolatedStringLiteralParsingTests.OuterRawMiddleRawInnerVerbatim",@" + new SourceTestCase("RawInterpolatedStringLiteralParsingTests.SingleLineInterpolationContainingVerbatimInterpolatedString4",@" class C { void M() { - var v = $""""""{$""""""{@$""{0}""}""""""}""""""; + var v = $""""""{ +$@""{ +0}""}""""""; } }") }; - + yield return new object[] { - new CSharpSyntaxFragment("RawInterpolatedStringLiteralParsingTests.OuterRawMiddleRawInnerRaw",@" + new SourceTestCase("RawInterpolatedStringLiteralParsingTests.SingleLineInterpolationContainingRawStringLiteral1",@" class C { void M() { - var v = $""""""{$""""""{$""""""{0}""""""}""""""}""""""; + var v = $""""""{""""""a""""""}""""""; } }") }; - + yield return new object[] { - new CSharpSyntaxFragment("RawInterpolatedStringLiteralParsingTests.MultipleAtSigns1",@" + new SourceTestCase("RawInterpolatedStringLiteralParsingTests.SingleLineInterpolationContainingRawStringLiteral2",@" class C { void M() { - var v = @@; + var v = $""""""{"""""" + a + """"""}""""""; } }") }; - + yield return new object[] { - new CSharpSyntaxFragment("RawInterpolatedStringLiteralParsingTests.MultipleAtSigns2",@" + new SourceTestCase("RawInterpolatedStringLiteralParsingTests.SingleLineInterpolationContainingRawInterpolatedStringLiteral1",@" class C { void M() { - var v = @@""; + var v = $""""""{$"""""" """"""}""""""; } }") }; - + yield return new object[] { - new CSharpSyntaxFragment("RawInterpolatedStringLiteralParsingTests.MultipleAtSigns3",@" + new SourceTestCase("RawInterpolatedStringLiteralParsingTests.SingleLineInterpolationContainingRawInterpolatedStringLiteral2",@" class C { void M() { - var v = @@"" ""; + var v = $""""""{$"""""""" """"""""}""""""; } }") }; - + yield return new object[] { - new CSharpSyntaxFragment("RawInterpolatedStringLiteralParsingTests.MultipleAtSigns4",@" + new SourceTestCase("RawInterpolatedStringLiteralParsingTests.SingleLineInterpolationContainingRawInterpolatedStringLiteral3",@" class C { void M() { - var v = @@"""""" """"""; + var v = $""""""{$""""""{0}""""""}""""""; } }") }; - + yield return new object[] { - new CSharpSyntaxFragment("RawInterpolatedStringLiteralParsingTests.MultipleAtSigns5",@" + new SourceTestCase("RawInterpolatedStringLiteralParsingTests.SingleLineInterpolationContainingRawInterpolatedStringLiteral4",@" class C { void M() { - var v = @@@; + var v = $""""""{$""""""{ +0}""""""}""""""; } }") }; - + yield return new object[] { - new CSharpSyntaxFragment("RawInterpolatedStringLiteralParsingTests.MultipleAtSigns6",@" + new SourceTestCase("RawInterpolatedStringLiteralParsingTests.SingleLineInterpolationContainingRawInterpolatedStringLiteral5",@" class C { void M() { - var v = @@@""; + var v = $""""""{ +$""""""{ +0}""""""}""""""; } }") }; - + yield return new object[] { - new CSharpSyntaxFragment("RawInterpolatedStringLiteralParsingTests.MultipleAtSigns7",@" + new SourceTestCase("RawInterpolatedStringLiteralParsingTests.SingleLineInterpolationContainingRawInterpolatedStringLiteral6",@" class C { void M() { - var v = @@@"" ""; + var v = $""""""{$$""""""{{0}}""""""}""""""; } }") }; - + yield return new object[] { - new CSharpSyntaxFragment("RawInterpolatedStringLiteralParsingTests.MultipleAtSigns8",@" + new SourceTestCase("RawInterpolatedStringLiteralParsingTests.SingleLineInterpolationContainingRawInterpolatedStringLiteral7",@" class C { void M() { - var v = @@@"""""" """"""; + var v = $""""""{$$""""""{{{0}}}""""""}""""""; } }") }; - + yield return new object[] { - new CSharpSyntaxFragment("RawInterpolatedStringLiteralParsingTests.DollarThenAt1",@" + new SourceTestCase("RawInterpolatedStringLiteralParsingTests.SingleLineInterpolationContainingRawInterpolatedStringLiteral8",@" class C { void M() { - var v = $@@; + var v = $$""""""{{{$""""""{0}""""""}}}""""""; } }") }; - + yield return new object[] { - new CSharpSyntaxFragment("RawInterpolatedStringLiteralParsingTests.DollarThenAt2",@" + new SourceTestCase("RawInterpolatedStringLiteralParsingTests.SingleLineInterpolationContainingClosingBraceAsCharacterLiteral",@" class C { void M() { - var v = $@@""; + var v = $""""""{'}'}""""""; } }") }; - + yield return new object[] { - new CSharpSyntaxFragment("RawInterpolatedStringLiteralParsingTests.DollarThenAt3",@" + new SourceTestCase("RawInterpolatedStringLiteralParsingTests.SingleLineInterpolationContainingClosingBraceAsRegularStringLiteral",@" class C { void M() { - var v = $@@"" ""; + var v = $""""""{""}""}""""""; } }") }; - + yield return new object[] { - new CSharpSyntaxFragment("RawInterpolatedStringLiteralParsingTests.DollarThenAt4",@" + new SourceTestCase("RawInterpolatedStringLiteralParsingTests.SingleLineInterpolationContainingClosingBraceAsVerbatimStringLiteral",@" class C { void M() { - var v = $@@"""""" """"""; + var v = $""""""{@""}""}""""""; } }") }; - + yield return new object[] { - new CSharpSyntaxFragment("RawInterpolatedStringLiteralParsingTests.DollarThenAt5",@" + new SourceTestCase("RawInterpolatedStringLiteralParsingTests.SingleLineInterpolationContainingClosingBraceAsRawStringLiteral",@" class C { void M() { - var v = $@@@; + var v = $""""""{""""""}""""""}""""""; } }") }; - + yield return new object[] { - new CSharpSyntaxFragment("RawInterpolatedStringLiteralParsingTests.DollarThenAt6",@" + new SourceTestCase("RawInterpolatedStringLiteralParsingTests.OuterNormalMiddleNormalInnerNormal",@" class C { void M() { - var v = $@@@""; + var v = $""{$""{$""{0}""}""}""; } }") }; - + yield return new object[] { - new CSharpSyntaxFragment("RawInterpolatedStringLiteralParsingTests.DollarThenAt7",@" + new SourceTestCase("RawInterpolatedStringLiteralParsingTests.OuterNormalMiddleNormalInnerVerbatim",@" class C { void M() { - var v = $@@@"" ""; + var v = $""{$""{$@""{0}""}""}""; } }") }; - + yield return new object[] { - new CSharpSyntaxFragment("RawInterpolatedStringLiteralParsingTests.DollarThenAt8",@" + new SourceTestCase("RawInterpolatedStringLiteralParsingTests.OuterNormalMiddleNormalInnerRaw",@" class C { void M() { - var v = $@@@"""""" """"""; + var v = $""{$""{$""""""{0}""""""}""}""; } }") }; - + yield return new object[] { - new CSharpSyntaxFragment("RawInterpolatedStringLiteralParsingTests.AtThenDollar1",@" + new SourceTestCase("RawInterpolatedStringLiteralParsingTests.OuterNormalMiddleVerbatimInnerNormal",@" class C { void M() { - var v = @@$; + var v = $""{@$""{$""{0}""}""}""; } }") }; - + yield return new object[] { - new CSharpSyntaxFragment("RawInterpolatedStringLiteralParsingTests.AtThenDollar2",@" + new SourceTestCase("RawInterpolatedStringLiteralParsingTests.OuterNormalMiddleVerbatimInnerVerbatim",@" class C { void M() { - var v = @@$""; + var v = $""{@$""{@$""{0}""}""}""; } }") }; - + yield return new object[] { - new CSharpSyntaxFragment("RawInterpolatedStringLiteralParsingTests.AtThenDollar3",@" + new SourceTestCase("RawInterpolatedStringLiteralParsingTests.OuterNormalMiddleVerbatimInnerRaw",@" class C { void M() { - var v = @@$"" ""; + var v = $""{@$""{$""""""{0}""""""}""}""; } }") }; - + yield return new object[] { - new CSharpSyntaxFragment("RawInterpolatedStringLiteralParsingTests.AtThenDollar4",@" + new SourceTestCase("RawInterpolatedStringLiteralParsingTests.OuterNormalMiddleRawInnerNormal",@" class C { void M() { - var v = @@$"""""" """"""; + var v = $""{$""""""{$""{0}""}""""""}""; } }") }; - + yield return new object[] { - new CSharpSyntaxFragment("RawInterpolatedStringLiteralParsingTests.AtThenDollar5",@" + new SourceTestCase("RawInterpolatedStringLiteralParsingTests.OuterNormalMiddleRawInnerVerbatim",@" class C { void M() { - var v = @@$$; + var v = $""{$""""""{@$""{0}""}""""""}""; } }") }; - + yield return new object[] { - new CSharpSyntaxFragment("RawInterpolatedStringLiteralParsingTests.AtThenDollar6",@" + new SourceTestCase("RawInterpolatedStringLiteralParsingTests.OuterNormalMiddleRawInnerRaw",@" class C { void M() { - var v = @@$$""; + var v = $""{$""""""{$""""""{0}""""""}""""""}""; } }") }; - + yield return new object[] { - new CSharpSyntaxFragment("RawInterpolatedStringLiteralParsingTests.AtThenDollar7",@" + new SourceTestCase("RawInterpolatedStringLiteralParsingTests.OuterVerbatimMiddleNormalInnerNormal",@" class C { void M() { - var v = @@$$"" ""; + var v = $@""{$""{$""{0}""}""}""; } }") }; - + yield return new object[] { - new CSharpSyntaxFragment("RawInterpolatedStringLiteralParsingTests.AtThenDollar8",@" + new SourceTestCase("RawInterpolatedStringLiteralParsingTests.OuterVerbatimMiddleNormalInnerVerbatim",@" class C { void M() { - var v = @@$$"""""" """"""; + var v = $@""{$""{$@""{0}""}""}""; } }") }; - + yield return new object[] { - new CSharpSyntaxFragment("RawInterpolatedStringLiteralParsingTests.AtThenDollarThenAt1",@" + new SourceTestCase("RawInterpolatedStringLiteralParsingTests.OuterVerbatimMiddleNormalInnerRaw",@" class C { void M() { - var v = @@$@; + var v = $@""{$""{$""""""{0}""""""}""}""; } }") }; - + yield return new object[] { - new CSharpSyntaxFragment("RawInterpolatedStringLiteralParsingTests.AtThenDollarThenAt2",@" + new SourceTestCase("RawInterpolatedStringLiteralParsingTests.OuterVerbatimMiddleVerbatimInnerNormal",@" class C { void M() { - var v = @@$@""; + var v = $@""{@$""{$""{0}""}""}""; } }") }; - + yield return new object[] { - new CSharpSyntaxFragment("RawInterpolatedStringLiteralParsingTests.AtThenDollarThenAt3",@" + new SourceTestCase("RawInterpolatedStringLiteralParsingTests.OuterVerbatimMiddleVerbatimInnerVerbatim",@" class C { void M() { - var v = @@$@"" ""; + var v = $@""{@$""{@$""{0}""}""}""; } }") }; - + yield return new object[] { - new CSharpSyntaxFragment("RawInterpolatedStringLiteralParsingTests.AtThenDollarThenAt4",@" + new SourceTestCase("RawInterpolatedStringLiteralParsingTests.OuterVerbatimMiddleVerbatimInnerRaw",@" class C { void M() { - var v = @@$@"""""" """"""; + var v = $@""{@$""{$""""""{0}""""""}""}""; } }") }; - + yield return new object[] { - new CSharpSyntaxFragment("RawInterpolatedStringLiteralParsingTests.AtThenDollarThenAt5",@" + new SourceTestCase("RawInterpolatedStringLiteralParsingTests.OuterVerbatimMiddleRawInnerNormal",@" class C { void M() { - var v = @@$$@; + var v = $@""{$""""""{$""{0}""}""""""}""; } }") }; - + yield return new object[] { - new CSharpSyntaxFragment("RawInterpolatedStringLiteralParsingTests.AtThenDollarThenAt6",@" + new SourceTestCase("RawInterpolatedStringLiteralParsingTests.OuterVerbatimMiddleRawInnerVerbatim",@" class C { void M() { - var v = @@$$@""; + var v = $@""{$""""""{@$""{0}""}""""""}""; } }") }; - + yield return new object[] { - new CSharpSyntaxFragment("RawInterpolatedStringLiteralParsingTests.AtThenDollarThenAt7",@" + new SourceTestCase("RawInterpolatedStringLiteralParsingTests.OuterVerbatimMiddleRawInnerRaw",@" class C { void M() { - var v = @@$$@"" ""; + var v = $@""{$""""""{$""""""{0}""""""}""""""}""; } }") }; - + yield return new object[] { - new CSharpSyntaxFragment("RawInterpolatedStringLiteralParsingTests.AtThenDollarThenAt8",@" + new SourceTestCase("RawInterpolatedStringLiteralParsingTests.OuterRawMiddleNormalInnerNormal",@" class C { void M() { - var v = @@$$@"""""" """"""; + var v = $""""""{$""{$""{0}""}""}""""""; } }") }; - + yield return new object[] { - new CSharpSyntaxFragment("RawInterpolatedStringLiteralParsingTests.DollarsWithoutQuotes0",@" + new SourceTestCase("RawInterpolatedStringLiteralParsingTests.OuterRawMiddleNormalInnerVerbatim",@" class C { void M() { - var v = $; + var v = $""""""{$""{$@""{0}""}""}""""""; } }") }; - + yield return new object[] { - new CSharpSyntaxFragment("RawInterpolatedStringLiteralParsingTests.DollarsWithoutQuotes1",@" + new SourceTestCase("RawInterpolatedStringLiteralParsingTests.OuterRawMiddleNormalInnerRaw",@" class C { void M() { - var v = $$; + var v = $""""""{$""{$""""""{0}""""""}""}""""""; } }") }; - + yield return new object[] { - new CSharpSyntaxFragment("RawInterpolatedStringLiteralParsingTests.DollarsWithoutQuotes2",@" + new SourceTestCase("RawInterpolatedStringLiteralParsingTests.OuterRawMiddleVerbatimInnerNormal",@" class C { void M() { - var v = $$$; + var v = $""""""{@$""{$""{0}""}""}""""""; } }") }; - + yield return new object[] { - new CSharpSyntaxFragment("RawInterpolatedStringLiteralParsingTests.DollarsWithQuotes1",@" + new SourceTestCase("RawInterpolatedStringLiteralParsingTests.OuterRawMiddleVerbatimInnerVerbatim",@" class C { void M() { - var v = $$""; + var v = $""""""{@$""{@$""{0}""}""}""""""; } }") }; - + yield return new object[] { - new CSharpSyntaxFragment("RawInterpolatedStringLiteralParsingTests.DollarsWithQuotes2",@" + new SourceTestCase("RawInterpolatedStringLiteralParsingTests.OuterRawMiddleVerbatimInnerRaw",@" class C { void M() { - var v = $$"" ""; + var v = $""""""{@$""{$""""""{0}""""""}""}""""""; } }") }; - + yield return new object[] { - new CSharpSyntaxFragment("RawInterpolatedStringLiteralParsingTests.DollarsWithQuotes3",@" + new SourceTestCase("RawInterpolatedStringLiteralParsingTests.OuterRawMiddleRawInnerNormal",@" class C { void M() { - var v = $$"""" """"; + var v = $""""""{$""""""{$""{0}""}""""""}""""""; } }") }; - + yield return new object[] { - new CSharpSyntaxFragment("RawInterpolatedStringLiteralParsingTests.DollarsWithQuotes2_MultiLine",@" + new SourceTestCase("RawInterpolatedStringLiteralParsingTests.OuterRawMiddleRawInnerVerbatim",@" class C { void M() { - var v = $$"" - -""; + var v = $""""""{$""""""{@$""{0}""}""""""}""""""; } }") }; - + yield return new object[] { - new CSharpSyntaxFragment("RawInterpolatedStringLiteralParsingTests.DollarsWithQuotes3_MultiLine",@" + new SourceTestCase("RawInterpolatedStringLiteralParsingTests.OuterRawMiddleRawInnerRaw",@" class C { void M() { - var v = $$"""" - -""""; + var v = $""""""{$""""""{$""""""{0}""""""}""""""}""""""; } }") }; - + yield return new object[] { - new CSharpSyntaxFragment("ReadOnlyStructs.ReadOnlyStructSimple",@" + new SourceTestCase("ReadOnlyStructs.ReadOnlyStructSimple",@" class Program { readonly struct S1{} @@ -4171,10 +2277,10 @@ readonly public struct S3{} } ") }; - + yield return new object[] { - new CSharpSyntaxFragment("ReadOnlyStructs.ReadOnlyStructSimpleLangVer",@" + new SourceTestCase("ReadOnlyStructs.ReadOnlyStructSimpleLangVer",@" class Program { readonly struct S1{} @@ -4185,10 +2291,10 @@ readonly public struct S3{} } ") }; - + yield return new object[] { - new CSharpSyntaxFragment("ReadOnlyStructs.ReadOnlyClassErr",@" + new SourceTestCase("ReadOnlyStructs.ReadOnlyClassErr",@" class Program { readonly class S1{} @@ -4199,10 +2305,10 @@ readonly public interface S3{} } ") }; - + yield return new object[] { - new CSharpSyntaxFragment("ReadOnlyStructs.ReadOnlyRefStruct",@" + new SourceTestCase("ReadOnlyStructs.ReadOnlyRefStruct",@" class Program { readonly ref struct S1{} @@ -4211,10 +2317,10 @@ unsafe readonly public ref struct S2{} } ") }; - + yield return new object[] { - new CSharpSyntaxFragment("ReadOnlyStructs.ReadOnlyStructPartialMatchingModifiers",@" + new SourceTestCase("ReadOnlyStructs.ReadOnlyStructPartialMatchingModifiers",@" class Program { readonly partial struct S1{} @@ -4227,10 +2333,10 @@ readonly ref partial struct S2{} } ") }; - + yield return new object[] { - new CSharpSyntaxFragment("ReadOnlyStructs.ReadOnlyStructPartialNotMatchingModifiers",@" + new SourceTestCase("ReadOnlyStructs.ReadOnlyStructPartialNotMatchingModifiers",@" class Program { readonly partial struct S1{} @@ -4247,86 +2353,63 @@ partial struct S3{} } ") }; - + yield return new object[] { - new CSharpSyntaxFragment("RecordParsingTests.FieldNamedData",@" + new SourceTestCase("RecordParsingTests.FieldNamedData",@" class C { int data; }") }; - - yield return new object[] - { - new CSharpSyntaxFragment("RecordParsingTests.RecordParsing01","record C(int X, int Y);") - }; - + yield return new object[] { - new CSharpSyntaxFragment("RecordParsingTests.RecordParsing02","record C(int X, int Y);") + new SourceTestCase("RecordParsingTests.RecordParsing01","record C(int X, int Y);") }; - + yield return new object[] { - new CSharpSyntaxFragment("RecordParsingTests.RecordParsing03","record C;") + new SourceTestCase("RecordParsingTests.RecordParsing02","record C(int X, int Y);") }; - + yield return new object[] { - new CSharpSyntaxFragment("RecordParsingTests.RecordParsing04","record C { public int record; }") + new SourceTestCase("RecordParsingTests.RecordParsing03","record C;") }; - + yield return new object[] { - new CSharpSyntaxFragment("RecordParsingTests.RecordParsing05","record Point;") + new SourceTestCase("RecordParsingTests.RecordParsing04","record C { public int record; }") }; - + yield return new object[] { - new CSharpSyntaxFragment("RecordParsingTests.RecordParsing07","interface P(int x, int y);") + new SourceTestCase("RecordParsingTests.RecordParsing05","record Point;") }; - + yield return new object[] { - new CSharpSyntaxFragment("RecordParsingTests.RecordParsingAmbiguities",@" -record R1() { return null; } -abstract record D -{ - record R2() { return null; } - abstract record R3(); -}") + new SourceTestCase("RecordParsingTests.RecordParsing07","interface P(int x, int y);") }; - + yield return new object[] { - new CSharpSyntaxFragment("RecordParsingTests.RecordParsing_BlockBodyAndSemiColon","record C { };") + new SourceTestCase("RecordParsingTests.RecordParsing_BlockBodyAndSemiColon","record C { };") }; - + yield return new object[] { - new CSharpSyntaxFragment("RecordParsingTests.WithParsingLangVer",@" + new SourceTestCase("RecordParsingTests.WithParsingLangVer",@" class C { int x = 0 with {}; }") }; - - yield return new object[] - { - new CSharpSyntaxFragment("RecordParsingTests.WithParsing1",@" -class C -{ - with { }; - x with { }; - int x = with { }; - int x = 0 with { }; -}") - }; - + yield return new object[] { - new CSharpSyntaxFragment("RecordParsingTests.WithParsing2",@" + new SourceTestCase("RecordParsingTests.WithParsing2",@" class C { int M() @@ -4335,255 +2418,115 @@ int M() } }") }; - - yield return new object[] - { - new CSharpSyntaxFragment("RecordParsingTests.WithParsing3","0 with {") - }; - - yield return new object[] - { - new CSharpSyntaxFragment("RecordParsingTests.WithParsing4","0 with { X") - }; - - yield return new object[] - { - new CSharpSyntaxFragment("RecordParsingTests.WithParsing5","0 with { X 3 =,") - }; - - yield return new object[] - { - new CSharpSyntaxFragment("RecordParsingTests.WithParsing6",@"M() with { } switch { }") - }; - - yield return new object[] - { - new CSharpSyntaxFragment("RecordParsingTests.WithParsing7",@"M() with { } + 3") - }; - - yield return new object[] - { - new CSharpSyntaxFragment("RecordParsingTests.WithParsing8",@"M() with { }.ToString()") - }; - - yield return new object[] - { - new CSharpSyntaxFragment("RecordParsingTests.WithParsing9",@"M() with { } with { }") - }; - - yield return new object[] - { - new CSharpSyntaxFragment("RecordParsingTests.WithParsing12",@"M() switch { } with { }") - }; - - yield return new object[] - { - new CSharpSyntaxFragment("RecordParsingTests.WithParsing13",@"M(out await with)") - }; - - yield return new object[] - { - new CSharpSyntaxFragment("RecordParsingTests.WithParsing14",@"x is int y with {}") - }; - - yield return new object[] - { - new CSharpSyntaxFragment("RecordParsingTests.WithParsing15",@"x with { X = ""2"" }") - }; - - yield return new object[] - { - new CSharpSyntaxFragment("RecordParsingTests.WithParsing16",@"x with { X = ""2"" };") - }; - - yield return new object[] - { - new CSharpSyntaxFragment("RecordParsingTests.WithParsing17",@"x = x with { X = ""2"" };") - }; - - yield return new object[] - { - new CSharpSyntaxFragment("RecordParsingTests.WithParsing18",@"x with { A = e is T y B = y }") - }; - - yield return new object[] - { - new CSharpSyntaxFragment("RecordParsingTests.WithParsingInConditionalExpression1","x is X ? record with { } : record with { }") - }; - - yield return new object[] - { - new CSharpSyntaxFragment("RecordParsingTests.WithParsingInConditionalExpression2","x is X.Y ? record with { } : record with { }") - }; - - yield return new object[] - { - new CSharpSyntaxFragment("RecordParsingTests.WithParsingInConditionalExpression_Incomplete","x is X ? record with") - }; - - yield return new object[] - { - new CSharpSyntaxFragment("RecordParsingTests.Base_03","interface C : B;") - }; - - yield return new object[] - { - new CSharpSyntaxFragment("RecordParsingTests.Base_04","interface C(int X, int Y) : B;") - }; - - yield return new object[] - { - new CSharpSyntaxFragment("RecordParsingTests.Base_05","interface C : B(X, Y);") - }; - - yield return new object[] - { - new CSharpSyntaxFragment("RecordParsingTests.RecordStructParsing_RecordNamedStruct","record struct(int X, int Y);") - }; - - yield return new object[] - { - new CSharpSyntaxFragment("RecordParsingTests.RecordStructParsing","record struct C(int X, int Y);") - }; - - yield return new object[] - { - new CSharpSyntaxFragment("RecordParsingTests.RecordStructParsing_WithBody","record struct C(int X, int Y) { }") - }; - - yield return new object[] - { - new CSharpSyntaxFragment("RecordParsingTests.RecordClassParsing","record class C(int X, int Y);") - }; - - yield return new object[] - { - new CSharpSyntaxFragment("RecordParsingTests.RecordInterfaceParsing","record interface C(int X, int Y);") - }; - - yield return new object[] - { - new CSharpSyntaxFragment("RecordParsingTests.RecordRecordParsing","record record C(int X, int Y);") - }; - - yield return new object[] - { - new CSharpSyntaxFragment("RecordParsingTests.RecordStructParsing_WrongOrder_CSharp10","struct record C(int X, int Y);") - }; - - yield return new object[] - { - new CSharpSyntaxFragment("RecordParsingTests.RecordStructParsing_WrongOrder_CSharp9","struct record C(int X, int Y);") - }; - + yield return new object[] { - new CSharpSyntaxFragment("RecordParsingTests.StructNamedRecord_CSharp8","struct record { }") + new SourceTestCase("RecordParsingTests.WithParsing17",@"x = x with { X = ""2"" };") }; - + yield return new object[] { - new CSharpSyntaxFragment("RecordParsingTests.StructNamedRecord_CSharp9","struct record { }") + new SourceTestCase("RecordParsingTests.Base_03","interface C : B;") }; - + yield return new object[] { - new CSharpSyntaxFragment("RecordParsingTests.StructNamedRecord_CSharp10","struct record { }") + new SourceTestCase("RecordParsingTests.Base_04","interface C(int X, int Y) : B;") }; - + yield return new object[] { - new CSharpSyntaxFragment("RecordParsingTests.RecordClassParsing_WrongOrder_CSharp10","class record C(int X, int Y);") + new SourceTestCase("RecordParsingTests.Base_05","interface C : B(X, Y);") }; - + yield return new object[] { - new CSharpSyntaxFragment("RecordParsingTests.RecordClassParsing_WrongOrder_CSharp9","class record C(int X, int Y);") + new SourceTestCase("RecordParsingTests.RecordStructParsing","record struct C(int X, int Y);") }; - + yield return new object[] { - new CSharpSyntaxFragment("RecordParsingTests.RecordInterfaceParsing_WrongOrder","interface record C(int X, int Y);") + new SourceTestCase("RecordParsingTests.RecordStructParsing_WithBody","record struct C(int X, int Y) { }") }; - + yield return new object[] { - new CSharpSyntaxFragment("RecordParsingTests.RecordStructParsing_Partial","partial record struct S;") + new SourceTestCase("RecordParsingTests.RecordClassParsing","record class C(int X, int Y);") }; - + yield return new object[] { - new CSharpSyntaxFragment("RecordParsingTests.RecordClassParsing_Partial","partial record class S;") + new SourceTestCase("RecordParsingTests.StructNamedRecord_CSharp8","struct record { }") }; - + yield return new object[] { - new CSharpSyntaxFragment("RecordParsingTests.RecordParsing_Partial","partial record S;") + new SourceTestCase("RecordParsingTests.StructNamedRecord_CSharp9","struct record { }") }; - + yield return new object[] { - new CSharpSyntaxFragment("RecordParsingTests.RecordStructParsing_Partial_WithParameterList","partial record struct S(int X);") + new SourceTestCase("RecordParsingTests.StructNamedRecord_CSharp10","struct record { }") }; - + yield return new object[] { - new CSharpSyntaxFragment("RecordParsingTests.RecordStructParsing_Partial_WithParameterList_AndMembers","partial record struct S(int X) { }") + new SourceTestCase("RecordParsingTests.RecordStructParsing_Partial","partial record struct S;") }; - + yield return new object[] { - new CSharpSyntaxFragment("RecordParsingTests.RecordStructParsing_Readonly","readonly record struct S;") + new SourceTestCase("RecordParsingTests.RecordClassParsing_Partial","partial record class S;") }; - + yield return new object[] { - new CSharpSyntaxFragment("RecordParsingTests.RecordStructParsing_ReadonlyPartial","readonly partial record struct S;") + new SourceTestCase("RecordParsingTests.RecordParsing_Partial","partial record S;") }; - + yield return new object[] { - new CSharpSyntaxFragment("RecordParsingTests.RecordStructParsing_PartialReadonly","partial readonly record struct S;") + new SourceTestCase("RecordParsingTests.RecordStructParsing_Partial_WithParameterList","partial record struct S(int X);") }; - + yield return new object[] { - new CSharpSyntaxFragment("RecordParsingTests.RecordStructParsing_New","new record struct S;") + new SourceTestCase("RecordParsingTests.RecordStructParsing_Partial_WithParameterList_AndMembers","partial record struct S(int X) { }") }; - + yield return new object[] { - new CSharpSyntaxFragment("RecordParsingTests.RecordStructParsing_Ref","ref record struct S;") + new SourceTestCase("RecordParsingTests.RecordStructParsing_Readonly","readonly record struct S;") }; - + yield return new object[] { - new CSharpSyntaxFragment("RecordParsingTests.RecordParsing_Ref","ref record R;") + new SourceTestCase("RecordParsingTests.RecordStructParsing_ReadonlyPartial","readonly partial record struct S;") }; - + yield return new object[] { - new CSharpSyntaxFragment("RecordParsingTests.RecordStructParsing_Const","const record struct S;") + new SourceTestCase("RecordParsingTests.RecordStructParsing_Ref","ref record struct S;") }; - + yield return new object[] { - new CSharpSyntaxFragment("RecordParsingTests.RecordStructParsing_Fixed","fixed record struct S;") + new SourceTestCase("RecordParsingTests.RecordParsing_Ref","ref record R;") }; - + yield return new object[] { - new CSharpSyntaxFragment("RecordParsingTests.RecordStructParsing_BaseListWithParens","record struct S : Base(1);") + new SourceTestCase("RecordParsingTests.RecordStructParsing_BaseListWithParens","record struct S : Base(1);") }; - + yield return new object[] { - new CSharpSyntaxFragment("RecordParsingTests.RecordStructParsing_BaseListWithParens_WithPositionalParameterList","record struct S(int X) : Base(1);") + new SourceTestCase("RecordParsingTests.RecordStructParsing_BaseListWithParens_WithPositionalParameterList","record struct S(int X) : Base(1);") }; - + yield return new object[] { - new CSharpSyntaxFragment("RefReadonlyTests.RefReadonlyReturn_CSharp7",@" + new SourceTestCase("RefReadonlyTests.RefReadonlyReturn_CSharp7",@" unsafe class Program { delegate ref readonly int D1(); @@ -4599,10 +2542,10 @@ static ref readonly T M() } ") }; - + yield return new object[] { - new CSharpSyntaxFragment("RefReadonlyTests.InArgs_CSharp7",@" + new SourceTestCase("RefReadonlyTests.InArgs_CSharp7",@" class Program { static void M(in int x) @@ -4625,716 +2568,566 @@ static void Test1() _ = (new Program())[in x]; } } -") - }; - - yield return new object[] - { - new CSharpSyntaxFragment("RefReadonlyTests.RefReadonlyReturn_Unexpected",@" - -class Program -{ - static void Main() - { - } - - ref readonly int Field; - - public static ref readonly Program operator +(Program x, Program y) - { - throw null; - } - - // this parses fine - static async ref readonly Task M() - { - throw null; - } - - public ref readonly virtual int* P1 => throw null; - -} -") - }; - - yield return new object[] - { - new CSharpSyntaxFragment("RefReadonlyTests.RefReadonlyReturn_UnexpectedBindTime",@" - -class Program -{ - static void Main() - { - ref readonly int local = ref (new int[1])[0]; - - (ref readonly int, ref readonly int Alice)? t = null; - - System.Collections.Generic.List x = null; - - Use(local); - Use(t); - Use(x); - } - - static void Use(T dummy) - { - } -} -") - }; - - yield return new object[] - { - new CSharpSyntaxFragment("RefStructs.RefStructSimple",@" -class Program -{ - ref struct S1{} - - public ref struct S2{} -} -") - }; - - yield return new object[] - { - new CSharpSyntaxFragment("RefStructs.RefStructSimpleLangVer",@" -class Program -{ - ref struct S1{} - - public ref struct S2{} -} -") - }; - - yield return new object[] - { - new CSharpSyntaxFragment("RefStructs.RefStructErr",@" -class Program -{ - ref class S1{} - - public ref unsafe struct S2{} - - ref interface I1{}; - - public ref delegate ref int D1(); -} -") - }; - - yield return new object[] - { - new CSharpSyntaxFragment("RefStructs.PartialRefStruct",@" -class Program -{ - partial ref struct S {} - partial ref struct S {} -} -") - }; - - yield return new object[] - { - new CSharpSyntaxFragment("SeparatedSyntaxListParsingTests.TypeArguments2WithCSharp6",@" -class C -{ - new C<>(); - new C<, >(); - C> a1; - C> a1; - object a1 = typeof(C, int>); - object a2 = Swap<>(1, 1); -} - -class M<,> { } -") - }; - - yield return new object[] - { - new CSharpSyntaxFragment("StatementParsingTests.TestDottedName","a.b();") - }; - - yield return new object[] - { - new CSharpSyntaxFragment("StatementParsingTests.TestGenericName","a();") - }; - - yield return new object[] - { - new CSharpSyntaxFragment("StatementParsingTests.TestGenericDotName","a.c();") - }; - - yield return new object[] - { - new CSharpSyntaxFragment("StatementParsingTests.TestDotGenericName","a.b();") - }; - - yield return new object[] - { - new CSharpSyntaxFragment("StatementParsingTests.TestLocalDeclarationStatement","T a;") - }; - - yield return new object[] - { - new CSharpSyntaxFragment("StatementParsingTests.TestLocalDeclarationStatementWithVar","var a;") - }; - - yield return new object[] - { - new CSharpSyntaxFragment("StatementParsingTests.TestLocalDeclarationStatementWithTuple","(int, int) a;") +") }; - + yield return new object[] { - new CSharpSyntaxFragment("StatementParsingTests.TestLocalDeclarationStatementWithNamedTuple","(T x, (U k, V l, W m) y) a;") + new SourceTestCase("RefReadonlyTests.RefReadonlyReturn_UnexpectedBindTime",@" + +class Program +{ + static void Main() + { + ref readonly int local = ref (new int[1])[0]; + + (ref readonly int, ref readonly int Alice)? t = null; + + System.Collections.Generic.List x = null; + + Use(local); + Use(t); + Use(x); + } + + static void Use(T dummy) + { + } +} +") }; - + yield return new object[] { - new CSharpSyntaxFragment("StatementParsingTests.TestLocalDeclarationStatementWithDynamic","dynamic a;") + new SourceTestCase("RefStructs.RefStructSimple",@" +class Program +{ + ref struct S1{} + + public ref struct S2{} +} +") }; - + yield return new object[] { - new CSharpSyntaxFragment("StatementParsingTests.TestLocalDeclarationStatementWithGenericType","T b;") + new SourceTestCase("RefStructs.RefStructSimpleLangVer",@" +class Program +{ + ref struct S1{} + + public ref struct S2{} +} +") }; - + yield return new object[] { - new CSharpSyntaxFragment("StatementParsingTests.TestLocalDeclarationStatementWithDottedType","T.X.Y a;") + new SourceTestCase("StatementParsingTests.TestDottedName","a.b();") }; - + yield return new object[] { - new CSharpSyntaxFragment("StatementParsingTests.TestLocalDeclarationStatementWithMixedType","T.X.Y a;") + new SourceTestCase("StatementParsingTests.TestGenericName","a();") }; - + yield return new object[] { - new CSharpSyntaxFragment("StatementParsingTests.TestLocalDeclarationStatementWithArrayType","T[][,][,,] a;") + new SourceTestCase("StatementParsingTests.TestGenericDotName","a.c();") }; - + yield return new object[] { - new CSharpSyntaxFragment("StatementParsingTests.TestLocalDeclarationStatementWithPointerType","T* a;") + new SourceTestCase("StatementParsingTests.TestDotGenericName","a.b();") }; - + yield return new object[] { - new CSharpSyntaxFragment("StatementParsingTests.TestLocalDeclarationStatementWithNullableType","T? a;") + new SourceTestCase("StatementParsingTests.TestLocalDeclarationStatement","T a;") }; - + yield return new object[] { - new CSharpSyntaxFragment("StatementParsingTests.TestLocalDeclarationStatementWithMultipleVariables","T a, b, c;") + new SourceTestCase("StatementParsingTests.TestLocalDeclarationStatementWithVar","var a;") }; - + yield return new object[] { - new CSharpSyntaxFragment("StatementParsingTests.TestLocalDeclarationStatementWithInitializer","T a = b;") + new SourceTestCase("StatementParsingTests.TestLocalDeclarationStatementWithTuple","(int, int) a;") }; - + yield return new object[] { - new CSharpSyntaxFragment("StatementParsingTests.TestLocalDeclarationStatementWithMultipleVariablesAndInitializers","T a = va, b = vb, c = vc;") + new SourceTestCase("StatementParsingTests.TestLocalDeclarationStatementWithNamedTuple","(T x, (U k, V l, W m) y) a;") }; - + yield return new object[] { - new CSharpSyntaxFragment("StatementParsingTests.TestLocalDeclarationStatementWithArrayInitializer","T a = {b, c};") + new SourceTestCase("StatementParsingTests.TestLocalDeclarationStatementWithDynamic","dynamic a;") }; - + yield return new object[] { - new CSharpSyntaxFragment("StatementParsingTests.TestConstLocalDeclarationStatement","const T a = b;") + new SourceTestCase("StatementParsingTests.TestLocalDeclarationStatementWithGenericType","T b;") }; - + yield return new object[] { - new CSharpSyntaxFragment("StatementParsingTests.TestStaticLocalDeclarationStatement","static T a = b;") + new SourceTestCase("StatementParsingTests.TestLocalDeclarationStatementWithDottedType","T.X.Y a;") }; - + yield return new object[] { - new CSharpSyntaxFragment("StatementParsingTests.TestReadOnlyLocalDeclarationStatement","readonly T a = b;") + new SourceTestCase("StatementParsingTests.TestLocalDeclarationStatementWithMixedType","T.X.Y a;") }; - + yield return new object[] { - new CSharpSyntaxFragment("StatementParsingTests.TestVolatileLocalDeclarationStatement","volatile T a = b;") + new SourceTestCase("StatementParsingTests.TestLocalDeclarationStatementWithArrayType","T[][,][,,] a;") }; - + yield return new object[] { - new CSharpSyntaxFragment("StatementParsingTests.TestRefLocalDeclarationStatement","ref T a;") + new SourceTestCase("StatementParsingTests.TestLocalDeclarationStatementWithPointerType","T* a;") }; - + yield return new object[] { - new CSharpSyntaxFragment("StatementParsingTests.TestRefLocalDeclarationStatementWithInitializer","ref T a = ref b;") + new SourceTestCase("StatementParsingTests.TestLocalDeclarationStatementWithNullableType","T? a;") }; - + yield return new object[] { - new CSharpSyntaxFragment("StatementParsingTests.TestRefLocalDeclarationStatementWithMultipleInitializers","ref T a = ref b, c = ref d;") + new SourceTestCase("StatementParsingTests.TestLocalDeclarationStatementWithMultipleVariables","T a, b, c;") }; - + yield return new object[] { - new CSharpSyntaxFragment("StatementParsingTests.TestFixedStatement","fixed(T a = b) { }") + new SourceTestCase("StatementParsingTests.TestLocalDeclarationStatementWithInitializer","T a = b;") }; - + yield return new object[] { - new CSharpSyntaxFragment("StatementParsingTests.TestFixedVarStatement","fixed(var a = b) { }") + new SourceTestCase("StatementParsingTests.TestLocalDeclarationStatementWithMultipleVariablesAndInitializers","T a = va, b = vb, c = vc;") }; - + yield return new object[] { - new CSharpSyntaxFragment("StatementParsingTests.TestFixedStatementWithMultipleVariables","fixed(T a = b, c = d) { }") + new SourceTestCase("StatementParsingTests.TestLocalDeclarationStatementWithArrayInitializer","T a = {b, c};") }; - + yield return new object[] { - new CSharpSyntaxFragment("StatementParsingTests.TestEmptyStatement",";") + new SourceTestCase("StatementParsingTests.TestConstLocalDeclarationStatement","const T a = b;") }; - + yield return new object[] { - new CSharpSyntaxFragment("StatementParsingTests.TestLabeledStatement","label: ;") + new SourceTestCase("StatementParsingTests.TestRefLocalDeclarationStatement","ref T a;") }; - + yield return new object[] { - new CSharpSyntaxFragment("StatementParsingTests.TestBreakStatement","break;") + new SourceTestCase("StatementParsingTests.TestRefLocalDeclarationStatementWithInitializer","ref T a = ref b;") }; - + yield return new object[] { - new CSharpSyntaxFragment("StatementParsingTests.TestContinueStatement","continue;") + new SourceTestCase("StatementParsingTests.TestRefLocalDeclarationStatementWithMultipleInitializers","ref T a = ref b, c = ref d;") }; - + yield return new object[] { - new CSharpSyntaxFragment("StatementParsingTests.TestGotoStatement","goto label;") + new SourceTestCase("StatementParsingTests.TestFixedStatement","fixed(T a = b) { }") }; - + yield return new object[] { - new CSharpSyntaxFragment("StatementParsingTests.TestGotoCaseStatement","goto case label;") + new SourceTestCase("StatementParsingTests.TestFixedVarStatement","fixed(var a = b) { }") }; - + yield return new object[] { - new CSharpSyntaxFragment("StatementParsingTests.TestGotoDefault","goto default;") + new SourceTestCase("StatementParsingTests.TestFixedStatementWithMultipleVariables","fixed(T a = b, c = d) { }") }; - + yield return new object[] { - new CSharpSyntaxFragment("StatementParsingTests.TestReturn","return;") + new SourceTestCase("StatementParsingTests.TestEmptyStatement",";") }; - + yield return new object[] { - new CSharpSyntaxFragment("StatementParsingTests.TestReturnExpression","return a;") + new SourceTestCase("StatementParsingTests.TestLabeledStatement","label: ;") }; - + yield return new object[] { - new CSharpSyntaxFragment("StatementParsingTests.TestYieldReturnExpression","yield return a;") + new SourceTestCase("StatementParsingTests.TestBreakStatement","break;") }; - + yield return new object[] { - new CSharpSyntaxFragment("StatementParsingTests.TestYieldBreakExpression","yield break;") + new SourceTestCase("StatementParsingTests.TestContinueStatement","continue;") }; - + yield return new object[] { - new CSharpSyntaxFragment("StatementParsingTests.TestThrow","throw;") + new SourceTestCase("StatementParsingTests.TestGotoStatement","goto label;") }; - + yield return new object[] { - new CSharpSyntaxFragment("StatementParsingTests.TestThrowExpression","throw a;") + new SourceTestCase("StatementParsingTests.TestGotoCaseStatement","goto case label;") }; - + yield return new object[] { - new CSharpSyntaxFragment("StatementParsingTests.TestTryCatch","try { } catch(T e) { }") + new SourceTestCase("StatementParsingTests.TestGotoDefault","goto default;") }; - + yield return new object[] { - new CSharpSyntaxFragment("StatementParsingTests.TestTryCatchWithNoExceptionName","try { } catch(T) { }") + new SourceTestCase("StatementParsingTests.TestReturn","return;") }; - + yield return new object[] { - new CSharpSyntaxFragment("StatementParsingTests.TestTryCatchWithNoExceptionDeclaration","try { } catch { }") + new SourceTestCase("StatementParsingTests.TestReturnExpression","return a;") }; - + yield return new object[] { - new CSharpSyntaxFragment("StatementParsingTests.TestTryCatchWithMultipleCatches","try { } catch(T e) { } catch(T2) { } catch { }") + new SourceTestCase("StatementParsingTests.TestYieldReturnExpression","yield return a;") }; - + yield return new object[] { - new CSharpSyntaxFragment("StatementParsingTests.TestTryFinally","try { } finally { }") + new SourceTestCase("StatementParsingTests.TestYieldBreakExpression","yield break;") }; - + yield return new object[] { - new CSharpSyntaxFragment("StatementParsingTests.TestTryCatchWithMultipleCatchesAndFinally","try { } catch(T e) { } catch(T2) { } catch { } finally { }") + new SourceTestCase("StatementParsingTests.TestThrow","throw;") }; - + yield return new object[] { - new CSharpSyntaxFragment("StatementParsingTests.TestChecked","checked { }") + new SourceTestCase("StatementParsingTests.TestThrowExpression","throw a;") }; - + yield return new object[] { - new CSharpSyntaxFragment("StatementParsingTests.TestUnchecked","unchecked { }") + new SourceTestCase("StatementParsingTests.TestTryCatch","try { } catch(T e) { }") }; - + yield return new object[] { - new CSharpSyntaxFragment("StatementParsingTests.TestUnsafe","unsafe { }") + new SourceTestCase("StatementParsingTests.TestTryCatchWithNoExceptionName","try { } catch(T) { }") }; - + yield return new object[] { - new CSharpSyntaxFragment("StatementParsingTests.TestWhile","while(a) { }") + new SourceTestCase("StatementParsingTests.TestTryCatchWithNoExceptionDeclaration","try { } catch { }") }; - + yield return new object[] { - new CSharpSyntaxFragment("StatementParsingTests.TestDoWhile","do { } while (a);") + new SourceTestCase("StatementParsingTests.TestTryCatchWithMultipleCatches","try { } catch(T e) { } catch(T2) { } catch { }") }; - + yield return new object[] { - new CSharpSyntaxFragment("StatementParsingTests.TestFor","for(;;) { }") + new SourceTestCase("StatementParsingTests.TestTryFinally","try { } finally { }") }; - + yield return new object[] { - new CSharpSyntaxFragment("StatementParsingTests.TestForWithVariableDeclaration","for(T a = 0;;) { }") + new SourceTestCase("StatementParsingTests.TestTryCatchWithMultipleCatchesAndFinally","try { } catch(T e) { } catch(T2) { } catch { } finally { }") }; - + yield return new object[] { - new CSharpSyntaxFragment("StatementParsingTests.TestForWithVarDeclaration","for(var a = 0;;) { }") + new SourceTestCase("StatementParsingTests.TestChecked","checked { }") }; - + yield return new object[] { - new CSharpSyntaxFragment("StatementParsingTests.TestForWithMultipleVariableDeclarations","for(T a = 0, b = 1;;) { }") + new SourceTestCase("StatementParsingTests.TestUnchecked","unchecked { }") }; - + yield return new object[] { - new CSharpSyntaxFragment("StatementParsingTests.TestForWithRefVariableDeclaration","for(ref T a = ref b, c = ref d;;) { }") + new SourceTestCase("StatementParsingTests.TestUnsafe","unsafe { }") }; - + yield return new object[] { - new CSharpSyntaxFragment("StatementParsingTests.TestForWithVariableInitializer","for(a = 0;;) { }") + new SourceTestCase("StatementParsingTests.TestWhile","while(a) { }") }; - + yield return new object[] { - new CSharpSyntaxFragment("StatementParsingTests.TestForWithMultipleVariableInitializers","for(a = 0, b = 1;;) { }") + new SourceTestCase("StatementParsingTests.TestDoWhile","do { } while (a);") }; - + yield return new object[] { - new CSharpSyntaxFragment("StatementParsingTests.TestForWithCondition","for(; a;) { }") + new SourceTestCase("StatementParsingTests.TestFor","for(;;) { }") }; - + yield return new object[] { - new CSharpSyntaxFragment("StatementParsingTests.TestForWithIncrementor","for(; ; a++) { }") + new SourceTestCase("StatementParsingTests.TestForWithVariableDeclaration","for(T a = 0;;) { }") }; - + yield return new object[] { - new CSharpSyntaxFragment("StatementParsingTests.TestForWithMultipleIncrementors","for(; ; a++, b++) { }") + new SourceTestCase("StatementParsingTests.TestForWithVarDeclaration","for(var a = 0;;) { }") }; - + yield return new object[] { - new CSharpSyntaxFragment("StatementParsingTests.TestForWithDeclarationConditionAndIncrementor","for(T a = 0; a < 10; a++) { }") + new SourceTestCase("StatementParsingTests.TestForWithMultipleVariableDeclarations","for(T a = 0, b = 1;;) { }") }; - + yield return new object[] { - new CSharpSyntaxFragment("StatementParsingTests.TestForEach","foreach(T a in b) { }") + new SourceTestCase("StatementParsingTests.TestForWithRefVariableDeclaration","for(ref T a = ref b, c = ref d;;) { }") }; - + yield return new object[] { - new CSharpSyntaxFragment("StatementParsingTests.TestForAsForEach","for(T a in b) { }") + new SourceTestCase("StatementParsingTests.TestForWithVariableInitializer","for(a = 0;;) { }") }; - + yield return new object[] { - new CSharpSyntaxFragment("StatementParsingTests.TestForEachWithVar","foreach(var a in b) { }") + new SourceTestCase("StatementParsingTests.TestForWithMultipleVariableInitializers","for(a = 0, b = 1;;) { }") }; - + yield return new object[] { - new CSharpSyntaxFragment("StatementParsingTests.TestIf","if (a) { }") + new SourceTestCase("StatementParsingTests.TestForWithCondition","for(; a;) { }") }; - + yield return new object[] { - new CSharpSyntaxFragment("StatementParsingTests.TestIfElse","if (a) { } else { }") + new SourceTestCase("StatementParsingTests.TestForWithIncrementor","for(; ; a++) { }") }; - + yield return new object[] { - new CSharpSyntaxFragment("StatementParsingTests.TestIfElseIf","if (a) { } else if (b) { }") + new SourceTestCase("StatementParsingTests.TestForWithMultipleIncrementors","for(; ; a++, b++) { }") }; - + yield return new object[] { - new CSharpSyntaxFragment("StatementParsingTests.TestLock","lock (a) { }") + new SourceTestCase("StatementParsingTests.TestForWithDeclarationConditionAndIncrementor","for(T a = 0; a < 10; a++) { }") }; - + yield return new object[] { - new CSharpSyntaxFragment("StatementParsingTests.TestSwitch","switch (a) { }") + new SourceTestCase("StatementParsingTests.TestForEach","foreach(T a in b) { }") }; - + yield return new object[] { - new CSharpSyntaxFragment("StatementParsingTests.TestSwitchWithCase","switch (a) { case b:; }") + new SourceTestCase("StatementParsingTests.TestForEachWithVar","foreach(var a in b) { }") }; - + yield return new object[] { - new CSharpSyntaxFragment("StatementParsingTests.TestSwitchWithMultipleCases","switch (a) { case b:; case c:; }") + new SourceTestCase("StatementParsingTests.TestIf","if (a) { }") }; - + yield return new object[] { - new CSharpSyntaxFragment("StatementParsingTests.TestSwitchWithDefaultCase","switch (a) { default:; }") + new SourceTestCase("StatementParsingTests.TestIfElse","if (a) { } else { }") }; - + yield return new object[] { - new CSharpSyntaxFragment("StatementParsingTests.TestSwitchWithMultipleLabelsOnOneCase","switch (a) { case b: case c:; }") + new SourceTestCase("StatementParsingTests.TestIfElseIf","if (a) { } else if (b) { }") }; - + yield return new object[] { - new CSharpSyntaxFragment("StatementParsingTests.TestSwitchWithMultipleStatementsOnOneCase","switch (a) { case b: s1(); s2(); }") + new SourceTestCase("StatementParsingTests.TestLock","lock (a) { }") }; - + yield return new object[] { - new CSharpSyntaxFragment("StatementParsingTests.TestUsingWithExpression","using (a) { }") + new SourceTestCase("StatementParsingTests.TestSwitch","switch (a) { }") }; - + yield return new object[] { - new CSharpSyntaxFragment("StatementParsingTests.TestUsingWithDeclaration","using (T a = b) { }") + new SourceTestCase("StatementParsingTests.TestSwitchWithCase","switch (a) { case b:; }") }; - + yield return new object[] { - new CSharpSyntaxFragment("StatementParsingTests.TestUsingVarWithDeclaration","using T a = b;") + new SourceTestCase("StatementParsingTests.TestSwitchWithMultipleCases","switch (a) { case b:; case c:; }") }; - + yield return new object[] { - new CSharpSyntaxFragment("StatementParsingTests.TestUsingWithVarDeclaration","using (var a = b) { }") + new SourceTestCase("StatementParsingTests.TestSwitchWithDefaultCase","switch (a) { default:; }") }; - + yield return new object[] { - new CSharpSyntaxFragment("StatementParsingTests.TestUsingVarWithVarDeclaration","using var a = b;") + new SourceTestCase("StatementParsingTests.TestSwitchWithMultipleLabelsOnOneCase","switch (a) { case b: case c:; }") }; - + yield return new object[] { - new CSharpSyntaxFragment("StatementParsingTests.TestAwaitUsingWithVarDeclaration","await using var a = b;") + new SourceTestCase("StatementParsingTests.TestSwitchWithMultipleStatementsOnOneCase","switch (a) { case b: s1(); s2(); }") }; - + yield return new object[] { - new CSharpSyntaxFragment("StatementParsingTests.TestUsingWithDeclarationWithMultipleVariables","using (T a = b, c = d) { }") + new SourceTestCase("StatementParsingTests.TestUsingWithExpression","using (a) { }") }; - + yield return new object[] { - new CSharpSyntaxFragment("StatementParsingTests.TestUsingVarWithDeclarationWithMultipleVariables","using T a = b, c = d;") + new SourceTestCase("StatementParsingTests.TestUsingWithDeclaration","using (T a = b) { }") }; - + yield return new object[] { - new CSharpSyntaxFragment("StatementParsingTests.TestUsingSpecialCase1","using (f ? x = a : x = b) { }") + new SourceTestCase("StatementParsingTests.TestUsingVarWithDeclaration","using T a = b;") }; - + yield return new object[] { - new CSharpSyntaxFragment("StatementParsingTests.TestUsingVarSpecialCase1","using var x = f ? a : b;") + new SourceTestCase("StatementParsingTests.TestUsingWithVarDeclaration","using (var a = b) { }") }; - + yield return new object[] { - new CSharpSyntaxFragment("StatementParsingTests.TestUsingSpecialCase2","using (f ? x = a) { }") + new SourceTestCase("StatementParsingTests.TestUsingVarWithVarDeclaration","using var a = b;") }; - + yield return new object[] { - new CSharpSyntaxFragment("StatementParsingTests.TestUsingVarSpecialCase2","using f ? x = a;") + new SourceTestCase("StatementParsingTests.TestAwaitUsingWithVarDeclaration","await using var a = b;") }; - + yield return new object[] { - new CSharpSyntaxFragment("StatementParsingTests.TestUsingSpecialCase3","using (f ? x, y) { }") + new SourceTestCase("StatementParsingTests.TestUsingWithDeclarationWithMultipleVariables","using (T a = b, c = d) { }") }; - + yield return new object[] { - new CSharpSyntaxFragment("StatementParsingTests.TestUsingVarSpecialCase3","using f ? x, y;") + new SourceTestCase("StatementParsingTests.TestUsingVarWithDeclarationWithMultipleVariables","using T a = b, c = d;") }; - + yield return new object[] { - new CSharpSyntaxFragment("StatementParsingTests.Bug862649",@"static char[] delimiter;") + new SourceTestCase("StatementParsingTests.TestUsingSpecialCase1","using (f ? x = a : x = b) { }") }; - + yield return new object[] { - new CSharpSyntaxFragment("StatementParsingTests.TestRunEmbeddedStatementNotFollowedBySemicolon",@"if (true) -System.Console.WriteLine(true)") + new SourceTestCase("StatementParsingTests.TestUsingVarSpecialCase1","using var x = f ? a : b;") }; - + yield return new object[] { - new CSharpSyntaxFragment("SuppressNullableWarningExpressionParsingTests.ConditionalAccess_Suppression_LangVersion","x?.y!.z") + new SourceTestCase("StatementParsingTests.TestUsingSpecialCase2","using (f ? x = a) { }") }; - - yield return new object[] - { - new CSharpSyntaxFragment("TopLevelStatementsParsingTests.TestIncompleteGlobalMembers",@" -asas] -extern alias A; -asas -using System; -sadasdasd] - -[assembly: goo] - -class C -{ -} - -[a]fod; -[b") - }; - yield return new object[] { - new CSharpSyntaxFragment("TopLevelStatementsParsingTests.IncompleteTopLevelOperator",@" -fg implicit// -class C { } -") + new SourceTestCase("StatementParsingTests.TestUsingVarSpecialCase2","using f ? x = a;") }; - + yield return new object[] { - new CSharpSyntaxFragment("TopLevelStatementsParsingTests.TestGlobalNamespaceWithOpenBraceBeforeNamespace","{ namespace n { }") + new SourceTestCase("StatementParsingTests.TestUsingSpecialCase3","using (f ? x, y) { }") }; - + yield return new object[] { - new CSharpSyntaxFragment("TopLevelStatementsParsingTests.EmptyLocalDeclaration",""" -struct S { } -partial ext X -""") + new SourceTestCase("StatementParsingTests.TestUsingVarSpecialCase3","using f ? x, y;") }; - + yield return new object[] { - new CSharpSyntaxFragment("UsingDirectiveParsingTests.StaticUsingDirectiveRefType",@"using static x = ref int;") + new SourceTestCase("UsingDirectiveParsingTests.StaticUsingDirectiveRefType",@"using static x = ref int;") }; - + yield return new object[] { - new CSharpSyntaxFragment("UsingDirectiveParsingTests.AliasUsingDirectiveNamePointer1",@"using x = A*; + new SourceTestCase("UsingDirectiveParsingTests.AliasUsingDirectiveNamePointer1",@"using x = A*; struct A { }") }; - + yield return new object[] { - new CSharpSyntaxFragment("UsingDirectiveParsingTests.AliasUsingDirectiveNamePointer2",@"using unsafe x = A*; + new SourceTestCase("UsingDirectiveParsingTests.AliasUsingDirectiveNamePointer2",@"using unsafe x = A*; struct A { }") }; - + yield return new object[] { - new CSharpSyntaxFragment("UsingDirectiveParsingTests.AliasUsingDirectiveFunctionPointer1",@"using x = delegate*;") + new SourceTestCase("UsingDirectiveParsingTests.AliasUsingDirectiveFunctionPointer1",@"using x = delegate*;") }; - + yield return new object[] { - new CSharpSyntaxFragment("UsingDirectiveParsingTests.AliasUsingDirectiveFunctionPointer2",@"using unsafe x = delegate*;") + new SourceTestCase("UsingDirectiveParsingTests.AliasUsingDirectiveFunctionPointer2",@"using unsafe x = delegate*;") }; - + yield return new object[] { - new CSharpSyntaxFragment("UsingDirectiveParsingTests.UsingUnsafeNonAlias",@"using unsafe System;") + new SourceTestCase("UsingDirectiveParsingTests.UsingUnsafeNonAlias",@"using unsafe System;") }; - + yield return new object[] { - new CSharpSyntaxFragment("UsingDirectiveParsingTests.AliasUsingDirectivePredefinedType_CSharp11",@"using x = int;") + new SourceTestCase("UsingDirectiveParsingTests.AliasUsingDirectivePredefinedType_CSharp11",@"using x = int;") }; - + yield return new object[] { - new CSharpSyntaxFragment("UsingDirectiveParsingTests.AliasUsingDirectivePredefinedType_CSharp12",@"using x = int;") + new SourceTestCase("UsingDirectiveParsingTests.AliasUsingDirectivePredefinedType_CSharp12",@"using x = int;") }; - + yield return new object[] { - new CSharpSyntaxFragment("UsingDirectiveParsingTests.AliasUsingDirectivePredefinedType_Preview",@"using x = int;") + new SourceTestCase("UsingDirectiveParsingTests.AliasUsingDirectivePredefinedType_Preview",@"using x = int;") }; - + yield return new object[] { - new CSharpSyntaxFragment("UsingDirectiveParsingTests.AliasUsingDirectiveRefType",@"using x = ref int;") + new SourceTestCase("UsingDirectiveParsingTests.AliasUsingDirectiveRefType",@"using x = ref int;") }; - + yield return new object[] { - new CSharpSyntaxFragment("UsingDirectiveParsingTests.AliasUsingDirectiveRefReadonlyType",@"using x = ref readonly int;") + new SourceTestCase("UsingDirectiveParsingTests.AliasUsingDirectiveRefReadonlyType",@"using x = ref readonly int;") }; - + yield return new object[] { - new CSharpSyntaxFragment("UsingDirectiveParsingTests.AliasUsingDirectivePredefinedTypePointer1",@"using x = int*;") + new SourceTestCase("UsingDirectiveParsingTests.AliasUsingDirectivePredefinedTypePointer1",@"using x = int*;") }; - + yield return new object[] { - new CSharpSyntaxFragment("UsingDirectiveParsingTests.AliasUsingDirectivePredefinedTypePointer2",@"using unsafe x = int*;") + new SourceTestCase("UsingDirectiveParsingTests.AliasUsingDirectivePredefinedTypePointer2",@"using unsafe x = int*;") }; - + yield return new object[] { - new CSharpSyntaxFragment("UsingDirectiveParsingTests.AliasUsingDirectivePredefinedTypePointer3",@" + new SourceTestCase("UsingDirectiveParsingTests.AliasUsingDirectivePredefinedTypePointer3",@" using unsafe X = int*; namespace N @@ -5342,10 +3135,10 @@ namespace N using Y = X; }") }; - + yield return new object[] { - new CSharpSyntaxFragment("UsingDirectiveParsingTests.AliasUsingDirectivePredefinedTypePointer4",@" + new SourceTestCase("UsingDirectiveParsingTests.AliasUsingDirectivePredefinedTypePointer4",@" using unsafe X = int*; namespace N @@ -5353,10 +3146,10 @@ namespace N using unsafe Y = X; }") }; - + yield return new object[] { - new CSharpSyntaxFragment("UsingDirectiveParsingTests.AliasUsingDirectivePredefinedTypePointer5",@" + new SourceTestCase("UsingDirectiveParsingTests.AliasUsingDirectivePredefinedTypePointer5",@" using X = int*; namespace N @@ -5364,10 +3157,10 @@ namespace N using unsafe Y = X; }") }; - + yield return new object[] { - new CSharpSyntaxFragment("UsingDirectiveParsingTests.AliasUsingDirectivePredefinedTypePointer6",@" + new SourceTestCase("UsingDirectiveParsingTests.AliasUsingDirectivePredefinedTypePointer6",@" using unsafe X = int*; namespace N @@ -5375,10 +3168,10 @@ namespace N using Y = X[]; }") }; - + yield return new object[] { - new CSharpSyntaxFragment("UsingDirectiveParsingTests.AliasUsingDirectivePredefinedTypePointer7",@" + new SourceTestCase("UsingDirectiveParsingTests.AliasUsingDirectivePredefinedTypePointer7",@" using unsafe X = int*; namespace N @@ -5386,15 +3179,15 @@ namespace N using unsafe Y = X[]; }") }; - + yield return new object[] { - new CSharpSyntaxFragment("UsingDirectiveParsingTests.AliasUsingDirectiveTuple1",@"using x = (int, int);") + new SourceTestCase("UsingDirectiveParsingTests.AliasUsingDirectiveTuple1",@"using x = (int, int);") }; - + yield return new object[] { - new CSharpSyntaxFragment("UsingDirectiveParsingTests.AliasUsingDirectiveTuple2",""" + new SourceTestCase("UsingDirectiveParsingTests.AliasUsingDirectiveTuple2",""" using X = (int, int); class C @@ -5403,10 +3196,10 @@ class C } """) }; - + yield return new object[] { - new CSharpSyntaxFragment("UsingDirectiveParsingTests.AliasUsingDirectiveTuple3",""" + new SourceTestCase("UsingDirectiveParsingTests.AliasUsingDirectiveTuple3",""" using X = (int, int); class C @@ -5415,28 +3208,28 @@ class C } """) }; - + yield return new object[] { - new CSharpSyntaxFragment("UsingDirectiveParsingTests.AliasUsingNullableValueType",@"using x = int?;") + new SourceTestCase("UsingDirectiveParsingTests.AliasUsingNullableValueType",@"using x = int?;") }; - + yield return new object[] { - new CSharpSyntaxFragment("UsingDirectiveParsingTests.AliasUsingNullableReferenceType1",@"using x = string?;") + new SourceTestCase("UsingDirectiveParsingTests.AliasUsingNullableReferenceType1",@"using x = string?;") }; - + yield return new object[] { - new CSharpSyntaxFragment("UsingDirectiveParsingTests.AliasUsingNullableReferenceType2",""" + new SourceTestCase("UsingDirectiveParsingTests.AliasUsingNullableReferenceType2",""" #nullable enable using X = string?; """) }; - + yield return new object[] { - new CSharpSyntaxFragment("UsingDirectiveParsingTests.AliasUsingNullableReferenceType3",""" + new SourceTestCase("UsingDirectiveParsingTests.AliasUsingNullableReferenceType3",""" using X = string; namespace N { @@ -5444,10 +3237,10 @@ namespace N } """) }; - + yield return new object[] { - new CSharpSyntaxFragment("UsingDirectiveParsingTests.AliasUsingNullableReferenceType4",""" + new SourceTestCase("UsingDirectiveParsingTests.AliasUsingNullableReferenceType4",""" #nullable enable using X = string; namespace N @@ -5456,76 +3249,46 @@ namespace N } """) }; - + yield return new object[] { - new CSharpSyntaxFragment("UsingDirectiveParsingTests.AliasUsingVoidPointer1",@"using unsafe VP = void*; + new SourceTestCase("UsingDirectiveParsingTests.AliasUsingVoidPointer1",@"using unsafe VP = void*; class C { void M(VP vp) { } }") }; - - yield return new object[] - { - new CSharpSyntaxFragment("UsingDirectiveParsingTests.AliasUsingVoidPointer2",@"using unsafe VP = void*; -class C -{ - unsafe void M(VP vp) { } -}") - }; - yield return new object[] { - new CSharpSyntaxFragment("UsingDirectiveParsingTests.AliasUsingVoidPointer3",@"using VP = void*; + new SourceTestCase("UsingDirectiveParsingTests.AliasUsingVoidPointer2",@"using unsafe VP = void*; class C { unsafe void M(VP vp) { } }") }; - - yield return new object[] - { - new CSharpSyntaxFragment("UsingDirectiveParsingTests.AliasUsingVoid1",@"using V = void; -class C -{ - void M(V v) { } -}") - }; - yield return new object[] { - new CSharpSyntaxFragment("UsingDirectiveParsingTests.AliasUsingVoid2",@"using V = void; + new SourceTestCase("UsingDirectiveParsingTests.AliasUsingVoidPointer3",@"using VP = void*; class C { - V M() { } + unsafe void M(VP vp) { } }") }; - - yield return new object[] - { - new CSharpSyntaxFragment("UsingDirectiveParsingTests.AliasUsingVoid3",@"using V = void[]; -class C -{ - V M() { } -}") - }; - yield return new object[] { - new CSharpSyntaxFragment("UsingDirectiveParsingTests.UsingDirectiveDynamic1",@" + new SourceTestCase("UsingDirectiveParsingTests.UsingDirectiveDynamic1",@" using dynamic;") }; - + yield return new object[] { - new CSharpSyntaxFragment("UsingDirectiveParsingTests.AliasUsingDirectiveDynamic1",@" + new SourceTestCase("UsingDirectiveParsingTests.AliasUsingDirectiveDynamic1",@" using D = dynamic; class C @@ -5536,10 +3299,10 @@ void M(D d) } }") }; - + yield return new object[] { - new CSharpSyntaxFragment("UsingDirectiveParsingTests.AliasUsingDirectiveDynamic2",@" + new SourceTestCase("UsingDirectiveParsingTests.AliasUsingDirectiveDynamic2",@" using D = System.Collections.Generic.List; class C @@ -5550,10 +3313,10 @@ void M(D d) } }") }; - + yield return new object[] { - new CSharpSyntaxFragment("UsingDirectiveParsingTests.AliasUsingDirectiveDynamic3",@" + new SourceTestCase("UsingDirectiveParsingTests.AliasUsingDirectiveDynamic3",@" using D = dynamic[]; class C @@ -5564,10 +3327,10 @@ void M(D d) } }") }; - + yield return new object[] { - new CSharpSyntaxFragment("UsingDirectiveParsingTests.AliasUsingDirectiveDynamic4",@" + new SourceTestCase("UsingDirectiveParsingTests.AliasUsingDirectiveDynamic4",@" using D = dynamic; class dynamic @@ -5578,10 +3341,10 @@ void M(D d) } }") }; - + yield return new object[] { - new CSharpSyntaxFragment("UsingDirectiveParsingTests.AliasUsingDirectiveDynamic5",@" + new SourceTestCase("UsingDirectiveParsingTests.AliasUsingDirectiveDynamic5",@" // Note: this is weird, but is supported by language. It checks just that the ValueText is `dynamic`, not the raw text. using D = @dynamic; @@ -5593,71 +3356,43 @@ void M(D d) } }") }; - + yield return new object[] { - new CSharpSyntaxFragment("UsingDirectiveParsingTests.AliasUsingDuplicate1",""" + new SourceTestCase("UsingDirectiveParsingTests.AliasUsingDuplicate1",""" using X = int?; using X = System; """) }; - + yield return new object[] { - new CSharpSyntaxFragment("UsingDirectiveParsingTests.AliasUsingDuplicate2",""" + new SourceTestCase("UsingDirectiveParsingTests.AliasUsingDuplicate2",""" using X = int?; using X = int; """) }; - + yield return new object[] { - new CSharpSyntaxFragment("UsingDirectiveParsingTests.AliasUsingDuplicate3",""" + new SourceTestCase("UsingDirectiveParsingTests.AliasUsingDuplicate3",""" using X = int?; using X = System.Int32; """) }; - + yield return new object[] { - new CSharpSyntaxFragment("UsingDirectiveParsingTests.AliasUsingNotDuplicate1",""" + new SourceTestCase("UsingDirectiveParsingTests.AliasUsingNotDuplicate1",""" using X = int?; namespace N; using X = int; """) }; - - yield return new object[] - { - new CSharpSyntaxFragment("UsingDirectiveParsingTests.TestScopedType1",@" -using scoped int; -") - }; - - yield return new object[] - { - new CSharpSyntaxFragment("UsingDirectiveParsingTests.TestScopedType2",@" -using X = scoped int; -") - }; - - yield return new object[] - { - new CSharpSyntaxFragment("UsingDirectiveParsingTests.TestScopedType3",@" -using X = scoped System; -") - }; - - yield return new object[] - { - new CSharpSyntaxFragment("UsingDirectiveParsingTests.TestScopedType4",@" -using X = scoped System.AppDomain; -") - }; - + yield return new object[] { - new CSharpSyntaxFragment("UsingDirectiveParsingTests.TestObsolete1",""" + new SourceTestCase("UsingDirectiveParsingTests.TestObsolete1",""" using System; using X = C; @@ -5673,10 +3408,10 @@ class D } """) }; - + yield return new object[] { - new CSharpSyntaxFragment("UsingDirectiveParsingTests.TestObsolete2",""" + new SourceTestCase("UsingDirectiveParsingTests.TestObsolete2",""" using System; using X = C[]; @@ -5692,125 +3427,71 @@ class D } """) }; - - yield return new object[] - { - new CSharpSyntaxFragment("UsingDirectiveParsingTests.TestArgList",@" -using X = __arglist; -") - }; - - yield return new object[] - { - new CSharpSyntaxFragment("UsingDirectiveParsingTests.TestMakeref",@" -using X = __makeref; -") - }; - - yield return new object[] - { - new CSharpSyntaxFragment("UsingDirectiveParsingTests.TestUnsafeStatic1_CSharp11_NoUnsafeFlag",@"using unsafe static System.Console;") - }; - - yield return new object[] - { - new CSharpSyntaxFragment("UsingDirectiveParsingTests.TestUnsafeStatic1_CSharp11_UnsafeFlag",@"using unsafe static System.Console;") - }; - - yield return new object[] - { - new CSharpSyntaxFragment("UsingDirectiveParsingTests.TestUnsafeStatic1_CSharp12_NoUnsafeFlag",@"using unsafe static System.Console;") - }; - - yield return new object[] - { - new CSharpSyntaxFragment("UsingDirectiveParsingTests.TestUnsafeStatic1_CSharp12_UnsafeFlag",@"using unsafe static System.Console;") - }; - - yield return new object[] - { - new CSharpSyntaxFragment("UsingDirectiveParsingTests.TestUnsafeStatic2_CSharp11_NoUnsafeFlag",@"using unsafe static X = System.Console;") - }; - - yield return new object[] - { - new CSharpSyntaxFragment("UsingDirectiveParsingTests.TestUnsafeStatic2_CSharp11_UnsafeFlag",@"using unsafe static X = System.Console;") - }; - - yield return new object[] - { - new CSharpSyntaxFragment("UsingDirectiveParsingTests.TestUnsafeStatic2_CSharp12_NoUnsafeFlag",@"using unsafe static X = System.Console;") - }; - - yield return new object[] - { - new CSharpSyntaxFragment("UsingDirectiveParsingTests.TestUnsafeStatic2_CSharp12_UnsafeFlag",@"using unsafe static X = System.Console;") - }; - + yield return new object[] { - new CSharpSyntaxFragment("UsingDirectiveParsingTests.UsingStaticUnsafe_SafeType_CSharp11_NoUnsafeFlag",@"using static unsafe System.Console;") + new SourceTestCase("UsingDirectiveParsingTests.UsingStaticUnsafe_SafeType_CSharp11_NoUnsafeFlag",@"using static unsafe System.Console;") }; - + yield return new object[] { - new CSharpSyntaxFragment("UsingDirectiveParsingTests.UsingStaticUnsafe_SafeType_CSharp11_UnsafeFlag",@"using static unsafe System.Console;") + new SourceTestCase("UsingDirectiveParsingTests.UsingStaticUnsafe_SafeType_CSharp11_UnsafeFlag",@"using static unsafe System.Console;") }; - + yield return new object[] { - new CSharpSyntaxFragment("UsingDirectiveParsingTests.UsingStaticUnsafe_SafeType_CSharp12_NoUnsafeFlag",@"using static unsafe System.Console;") + new SourceTestCase("UsingDirectiveParsingTests.UsingStaticUnsafe_SafeType_CSharp12_NoUnsafeFlag",@"using static unsafe System.Console;") }; - + yield return new object[] { - new CSharpSyntaxFragment("UsingDirectiveParsingTests.UsingStaticUnsafe_SafeType_CSharp12_UnsafeFlag",@"using static unsafe System.Console;") + new SourceTestCase("UsingDirectiveParsingTests.UsingStaticUnsafe_SafeType_CSharp12_UnsafeFlag",@"using static unsafe System.Console;") }; - + yield return new object[] { - new CSharpSyntaxFragment("UsingDirectiveParsingTests.UsingStaticUnsafe_UnsafeType_CSharp11_NoUnsafeFlag",@"using static unsafe System.Collections.Generic.List;") + new SourceTestCase("UsingDirectiveParsingTests.UsingStaticUnsafe_UnsafeType_CSharp11_NoUnsafeFlag",@"using static unsafe System.Collections.Generic.List;") }; - + yield return new object[] { - new CSharpSyntaxFragment("UsingDirectiveParsingTests.UsingStaticUnsafe_UnsafeType_CSharp11_UnsafeFlag",@"using static unsafe System.Collections.Generic.List;") + new SourceTestCase("UsingDirectiveParsingTests.UsingStaticUnsafe_UnsafeType_CSharp11_UnsafeFlag",@"using static unsafe System.Collections.Generic.List;") }; - + yield return new object[] { - new CSharpSyntaxFragment("UsingDirectiveParsingTests.UsingStaticUnsafe_UnsafeType_CSharp12_NoUnsafeFlag",@"using static unsafe System.Collections.Generic.List;") + new SourceTestCase("UsingDirectiveParsingTests.UsingStaticUnsafe_UnsafeType_CSharp12_NoUnsafeFlag",@"using static unsafe System.Collections.Generic.List;") }; - + yield return new object[] { - new CSharpSyntaxFragment("UsingDirectiveParsingTests.UsingStaticUnsafe_UnsafeType_CSharp12_UnsafeFlag",@"using static unsafe System.Collections.Generic.List;") + new SourceTestCase("UsingDirectiveParsingTests.UsingStaticUnsafe_UnsafeType_CSharp12_UnsafeFlag",@"using static unsafe System.Collections.Generic.List;") }; - + yield return new object[] { - new CSharpSyntaxFragment("UsingDirectiveParsingTests.UsingStatic_UnsafeType_CSharp11_NoUnsafeFlag",@"using static System.Collections.Generic.List;") + new SourceTestCase("UsingDirectiveParsingTests.UsingStatic_UnsafeType_CSharp11_NoUnsafeFlag",@"using static System.Collections.Generic.List;") }; - + yield return new object[] { - new CSharpSyntaxFragment("UsingDirectiveParsingTests.UsingStatic_UnsafeType_CSharp11_UnsafeFlag",@"using static System.Collections.Generic.List;") + new SourceTestCase("UsingDirectiveParsingTests.UsingStatic_UnsafeType_CSharp11_UnsafeFlag",@"using static System.Collections.Generic.List;") }; - + yield return new object[] { - new CSharpSyntaxFragment("UsingDirectiveParsingTests.UsingStatic_UnsafeType_CSharp12_NoUnsafeFlag",@"using static System.Collections.Generic.List;") + new SourceTestCase("UsingDirectiveParsingTests.UsingStatic_UnsafeType_CSharp12_NoUnsafeFlag",@"using static System.Collections.Generic.List;") }; - + yield return new object[] { - new CSharpSyntaxFragment("UsingDirectiveParsingTests.UsingStatic_UnsafeType_CSharp12_UnsafeFlag",@"using static System.Collections.Generic.List;") + new SourceTestCase("UsingDirectiveParsingTests.UsingStatic_UnsafeType_CSharp12_UnsafeFlag",@"using static System.Collections.Generic.List;") }; - + } IEnumerator IEnumerable.GetEnumerator() { return GetEnumerator(); } -} \ No newline at end of file +} diff --git a/Rewrite/tests/Rewrite.CSharp.Tests/RoslynTestCases/SourceTestCase.cs b/Rewrite/tests/Rewrite.CSharp.Tests/RoslynTestCases/SourceTestCase.cs new file mode 100644 index 00000000..cd663cda --- /dev/null +++ b/Rewrite/tests/Rewrite.CSharp.Tests/RoslynTestCases/SourceTestCase.cs @@ -0,0 +1,6 @@ +namespace Rewrite.CSharp.Tests.RoslynTestCases; + +public record SourceTestCase(string Name, string SourceText) +{ + public override string ToString() => Name; +} diff --git a/Rewrite/tests/Rewrite.CSharp.Tests/StringAssertionExtensions.cs b/Rewrite/tests/Rewrite.CSharp.Tests/StringAssertionExtensions.cs new file mode 100644 index 00000000..ba680738 --- /dev/null +++ b/Rewrite/tests/Rewrite.CSharp.Tests/StringAssertionExtensions.cs @@ -0,0 +1,90 @@ +using System.Text; +using DiffPlex; +using DiffPlex.Chunkers; +using DiffPlex.DiffBuilder.Model; +using Socolin.ANSITerminalColor; + +namespace Rewrite.CSharp.Tests; + +public static class StringAssertionExtensions +{ + + public static void ShouldBeSameAs(this string newText, string oldText) + { + var result = GetDifferences(oldText, newText); + if (result != null) + { + Assert.Fail($"Expected string to be the same but are different\n{result}"); + } + } + public static string? GetDifferences(string oldText, string newText) + { + + var differ = new Differ(); + var diff = DiffPlex.DiffBuilder.SideBySideDiffBuilder.Diff(differ, oldText, newText, wordChunker: new CharacterChunker()); + if (!diff.NewText.HasDifferences) + return null; + int padSize = diff.OldText.Lines.Count > 0 ? (int)Math.Log10(diff.OldText.Lines.Count) : 0; + + var result = new StringBuilder(); + + for (int i = 0; i < diff.OldText.Lines.Count ; i++) + { + var leftLine = diff.OldText.Lines[i]; + var rightLine = diff.NewText.Lines[i]; + var lineChange = diff.NewText.Lines[i].Type; + if (lineChange == ChangeType.Unchanged) + continue; + result.AppendLine("-------------------"); + string leftRender = AnsiColor.ColorizeText(leftLine.Text, AnsiColor.Background(Terminal256ColorCodes.BlackC0))!; + string rightRender = AnsiColor.ColorizeText(rightLine.Text, AnsiColor.Background(Terminal256ColorCodes.BlackC0))!; + if (lineChange == ChangeType.Modified) + { + var leftChanges = diff.OldText.Lines[i].SubPieces; + var rightChanges = diff.NewText.Lines[i].SubPieces; + leftRender = GetDiffText(leftChanges); + rightRender = GetDiffText(rightChanges); + } + + var lineNum = i + 1; + // var right = GetDiffText); + var leftLineNum = $"{lineNum.ToString()!.PadRight(padSize)}" ; + var rightLineNum = leftLineNum; + + leftLineNum = AnsiColor.ColorizeText(leftLineNum, GetStyle(leftLine.Type)) + "|"; + rightLineNum = AnsiColor.ColorizeText(rightLineNum, GetStyle(rightLine.Type)) + "|"; + + + result.AppendLine($"{leftLineNum}{leftRender}"); + result.AppendLine($"{rightLineNum}{rightRender}"); + } + + return result.ToString(); + } + + static string GetDiffText(List current) + { + var sb = new StringBuilder(); + foreach (var charDelta in current) + { + var text = charDelta.Text; + var style = AnsiColor.Composite(GetStyle(charDelta.Type), + AnsiColor.Background(Terminal256ColorCodes.BlackC0)); + sb.Append(AnsiColor.ColorizeText(text, style)); + } + + return sb.ToString(); + } + + static AnsiColor GetStyle(ChangeType type) + { + return type switch + { + ChangeType.Deleted => AnsiColor.Foreground(Terminal256ColorCodes.Red1C196), + ChangeType.Inserted => AnsiColor.Foreground(Terminal256ColorCodes.Green1C46), + ChangeType.Modified => AnsiColor.Background(Terminal256ColorCodes.Blue1C21), + ChangeType.Imaginary => AnsiColor.Composite(AnsiColor.Background(Terminal256ColorCodes.GreyC8), AnsiColor.Foreground(Terminal256ColorCodes.SeaGreen3C78)), + _ => AnsiColor.Reset + }; + } +} From 043eb94fd3186fb58af4598031d91491668f30f4 Mon Sep 17 00:00:00 2001 From: Andrew Stakhov Date: Sun, 13 Oct 2024 01:41:04 -0400 Subject: [PATCH 3/5] Readd source based solution --- Rewrite/Directory.Build.props | 1 + Rewrite/Rewrite.Sources.sln | 130 ++++++++++++++++++++++++++++++++++ 2 files changed, 131 insertions(+) create mode 100644 Rewrite/Rewrite.Sources.sln diff --git a/Rewrite/Directory.Build.props b/Rewrite/Directory.Build.props index ee663f6a..e9143bfc 100644 --- a/Rewrite/Directory.Build.props +++ b/Rewrite/Directory.Build.props @@ -10,6 +10,7 @@ openrewrite.png Apache-2.0 0.9.1 + ..\..\..\..\..\moderneinc\rewrite-remote\Rewrite.Remote True False True diff --git a/Rewrite/Rewrite.Sources.sln b/Rewrite/Rewrite.Sources.sln new file mode 100644 index 00000000..855a5d32 --- /dev/null +++ b/Rewrite/Rewrite.Sources.sln @@ -0,0 +1,130 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Rewrite.Core", "src\Rewrite.Core\Rewrite.Core.csproj", "{FB30394C-7930-4BFF-97E2-400CFADE92C2}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Rewrite.Properties", "src\Rewrite.Properties\Rewrite.Properties.csproj", "{C7E280C5-E841-4690-8AA3-653ECBC7C78B}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Rewrite.Yaml", "src\Rewrite.Yaml\Rewrite.Yaml.csproj", "{F7F4F27F-2CAE-422B-B6CE-25A88C3603A1}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Rewrite.Xml", "src\Rewrite.Xml\Rewrite.Xml.csproj", "{D38BB305-3276-4AE1-87B1-C19C7A9F3840}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Rewrite.Json", "src\Rewrite.Json\Rewrite.Json.csproj", "{5DD7D88A-5A10-457D-B1A2-30F7CF67AD9F}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Rewrite.Java", "src\Rewrite.Java\Rewrite.Java.csproj", "{06BCC1C7-9D8C-4D3B-934D-072C35A5C984}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Rewrite.CSharp", "src\Rewrite.CSharp\Rewrite.CSharp.csproj", "{25208A27-E598-4BE3-9CD9-0618A6B9598F}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Rewrite.CSharp.Tests", "tests\Rewrite.CSharp.Tests\Rewrite.CSharp.Tests.csproj", "{25EEACCB-9BAE-4361-A980-9E9CDA37602E}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Rewrite.Test", "src\Rewrite.Test\Rewrite.Test.csproj", "{D3F48947-C702-4D1A-B6EE-96B89D13953D}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{C7A4A8F9-0343-4A3E-AB77-101C458C23B5}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "tests", "tests", "{7B268266-B9CD-4D85-ABC5-3B2C4611FD74}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "_solution", "_solution", "{B5C675AF-506B-47E6-AB10-4E7BC36531D2}" + ProjectSection(SolutionItems) = preProject + .gitignore = .gitignore + Directory.Build.props = Directory.Build.props + Directory.Build.targets = Directory.Build.targets + README.md = README.md + Directory.Build.props.user = Directory.Build.props.user + EndProjectSection +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "commercial", "commercial", "{45B6292D-DC7E-46A7-A86E-7455BBEAED70}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Rewrite.Remote", "..\..\..\moderneinc\rewrite-remote\Rewrite.Remote\src\Rewrite.Remote\Rewrite.Remote.csproj", "{0E364862-1ACA-4C94-8EA0-23724FF67AA2}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Rewrite.MSBuild", "..\..\..\moderneinc\rewrite-remote\Rewrite.Remote\src\Rewrite.MSBuild\Rewrite.MSBuild.csproj", "{DE03049F-95A3-483F-939C-C2325548D590}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "_build", "..\_build\_build.csproj", "{C714F4F1-E2DF-4B29-A277-9B40BD7DE406}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Rewrite.Remote.Codec", "src\Rewrite.Remote.Codec\Rewrite.Remote.Codec.csproj", "{40C71491-3CCC-40A0-8F01-3EC7204CF85F}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Rewrite.Test.CSharp", "src\Rewrite.Test.CSharp\Rewrite.Test.CSharp.csproj", "{5C70ACE0-BE37-4D67-A67F-EE69767994D2}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Rewrite.Test.Engine.Remote", "src\Rewrite.Test.Engine.Remote\Rewrite.Test.Engine.Remote.csproj", "{C04C7CA4-69C3-444F-A654-6C722A0FC3BE}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {C714F4F1-E2DF-4B29-A277-9B40BD7DE406}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {C714F4F1-E2DF-4B29-A277-9B40BD7DE406}.Release|Any CPU.ActiveCfg = Release|Any CPU + {FB30394C-7930-4BFF-97E2-400CFADE92C2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {FB30394C-7930-4BFF-97E2-400CFADE92C2}.Debug|Any CPU.Build.0 = Debug|Any CPU + {FB30394C-7930-4BFF-97E2-400CFADE92C2}.Release|Any CPU.ActiveCfg = Release|Any CPU + {FB30394C-7930-4BFF-97E2-400CFADE92C2}.Release|Any CPU.Build.0 = Release|Any CPU + {C7E280C5-E841-4690-8AA3-653ECBC7C78B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {C7E280C5-E841-4690-8AA3-653ECBC7C78B}.Debug|Any CPU.Build.0 = Debug|Any CPU + {C7E280C5-E841-4690-8AA3-653ECBC7C78B}.Release|Any CPU.ActiveCfg = Release|Any CPU + {C7E280C5-E841-4690-8AA3-653ECBC7C78B}.Release|Any CPU.Build.0 = Release|Any CPU + {F7F4F27F-2CAE-422B-B6CE-25A88C3603A1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {F7F4F27F-2CAE-422B-B6CE-25A88C3603A1}.Debug|Any CPU.Build.0 = Debug|Any CPU + {F7F4F27F-2CAE-422B-B6CE-25A88C3603A1}.Release|Any CPU.ActiveCfg = Release|Any CPU + {F7F4F27F-2CAE-422B-B6CE-25A88C3603A1}.Release|Any CPU.Build.0 = Release|Any CPU + {D38BB305-3276-4AE1-87B1-C19C7A9F3840}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {D38BB305-3276-4AE1-87B1-C19C7A9F3840}.Debug|Any CPU.Build.0 = Debug|Any CPU + {D38BB305-3276-4AE1-87B1-C19C7A9F3840}.Release|Any CPU.ActiveCfg = Release|Any CPU + {D38BB305-3276-4AE1-87B1-C19C7A9F3840}.Release|Any CPU.Build.0 = Release|Any CPU + {5DD7D88A-5A10-457D-B1A2-30F7CF67AD9F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {5DD7D88A-5A10-457D-B1A2-30F7CF67AD9F}.Debug|Any CPU.Build.0 = Debug|Any CPU + {5DD7D88A-5A10-457D-B1A2-30F7CF67AD9F}.Release|Any CPU.ActiveCfg = Release|Any CPU + {5DD7D88A-5A10-457D-B1A2-30F7CF67AD9F}.Release|Any CPU.Build.0 = Release|Any CPU + {06BCC1C7-9D8C-4D3B-934D-072C35A5C984}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {06BCC1C7-9D8C-4D3B-934D-072C35A5C984}.Debug|Any CPU.Build.0 = Debug|Any CPU + {06BCC1C7-9D8C-4D3B-934D-072C35A5C984}.Release|Any CPU.ActiveCfg = Release|Any CPU + {06BCC1C7-9D8C-4D3B-934D-072C35A5C984}.Release|Any CPU.Build.0 = Release|Any CPU + {25208A27-E598-4BE3-9CD9-0618A6B9598F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {25208A27-E598-4BE3-9CD9-0618A6B9598F}.Debug|Any CPU.Build.0 = Debug|Any CPU + {25208A27-E598-4BE3-9CD9-0618A6B9598F}.Release|Any CPU.ActiveCfg = Release|Any CPU + {25208A27-E598-4BE3-9CD9-0618A6B9598F}.Release|Any CPU.Build.0 = Release|Any CPU + {25EEACCB-9BAE-4361-A980-9E9CDA37602E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {25EEACCB-9BAE-4361-A980-9E9CDA37602E}.Debug|Any CPU.Build.0 = Debug|Any CPU + {25EEACCB-9BAE-4361-A980-9E9CDA37602E}.Release|Any CPU.ActiveCfg = Release|Any CPU + {25EEACCB-9BAE-4361-A980-9E9CDA37602E}.Release|Any CPU.Build.0 = Release|Any CPU + {D3F48947-C702-4D1A-B6EE-96B89D13953D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {D3F48947-C702-4D1A-B6EE-96B89D13953D}.Debug|Any CPU.Build.0 = Debug|Any CPU + {D3F48947-C702-4D1A-B6EE-96B89D13953D}.Release|Any CPU.ActiveCfg = Release|Any CPU + {D3F48947-C702-4D1A-B6EE-96B89D13953D}.Release|Any CPU.Build.0 = Release|Any CPU + {0E364862-1ACA-4C94-8EA0-23724FF67AA2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {0E364862-1ACA-4C94-8EA0-23724FF67AA2}.Debug|Any CPU.Build.0 = Debug|Any CPU + {0E364862-1ACA-4C94-8EA0-23724FF67AA2}.Release|Any CPU.ActiveCfg = Release|Any CPU + {0E364862-1ACA-4C94-8EA0-23724FF67AA2}.Release|Any CPU.Build.0 = Release|Any CPU + {DE03049F-95A3-483F-939C-C2325548D590}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {DE03049F-95A3-483F-939C-C2325548D590}.Debug|Any CPU.Build.0 = Debug|Any CPU + {DE03049F-95A3-483F-939C-C2325548D590}.Release|Any CPU.ActiveCfg = Release|Any CPU + {DE03049F-95A3-483F-939C-C2325548D590}.Release|Any CPU.Build.0 = Release|Any CPU + {40C71491-3CCC-40A0-8F01-3EC7204CF85F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {40C71491-3CCC-40A0-8F01-3EC7204CF85F}.Debug|Any CPU.Build.0 = Debug|Any CPU + {40C71491-3CCC-40A0-8F01-3EC7204CF85F}.Release|Any CPU.ActiveCfg = Release|Any CPU + {40C71491-3CCC-40A0-8F01-3EC7204CF85F}.Release|Any CPU.Build.0 = Release|Any CPU + {5C70ACE0-BE37-4D67-A67F-EE69767994D2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {5C70ACE0-BE37-4D67-A67F-EE69767994D2}.Debug|Any CPU.Build.0 = Debug|Any CPU + {5C70ACE0-BE37-4D67-A67F-EE69767994D2}.Release|Any CPU.ActiveCfg = Release|Any CPU + {5C70ACE0-BE37-4D67-A67F-EE69767994D2}.Release|Any CPU.Build.0 = Release|Any CPU + {C04C7CA4-69C3-444F-A654-6C722A0FC3BE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {C04C7CA4-69C3-444F-A654-6C722A0FC3BE}.Debug|Any CPU.Build.0 = Debug|Any CPU + {C04C7CA4-69C3-444F-A654-6C722A0FC3BE}.Release|Any CPU.ActiveCfg = Release|Any CPU + {C04C7CA4-69C3-444F-A654-6C722A0FC3BE}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(NestedProjects) = preSolution + {25EEACCB-9BAE-4361-A980-9E9CDA37602E} = {7B268266-B9CD-4D85-ABC5-3B2C4611FD74} + {FB30394C-7930-4BFF-97E2-400CFADE92C2} = {C7A4A8F9-0343-4A3E-AB77-101C458C23B5} + {25208A27-E598-4BE3-9CD9-0618A6B9598F} = {C7A4A8F9-0343-4A3E-AB77-101C458C23B5} + {06BCC1C7-9D8C-4D3B-934D-072C35A5C984} = {C7A4A8F9-0343-4A3E-AB77-101C458C23B5} + {5DD7D88A-5A10-457D-B1A2-30F7CF67AD9F} = {C7A4A8F9-0343-4A3E-AB77-101C458C23B5} + {C7E280C5-E841-4690-8AA3-653ECBC7C78B} = {C7A4A8F9-0343-4A3E-AB77-101C458C23B5} + {D3F48947-C702-4D1A-B6EE-96B89D13953D} = {C7A4A8F9-0343-4A3E-AB77-101C458C23B5} + {D38BB305-3276-4AE1-87B1-C19C7A9F3840} = {C7A4A8F9-0343-4A3E-AB77-101C458C23B5} + {F7F4F27F-2CAE-422B-B6CE-25A88C3603A1} = {C7A4A8F9-0343-4A3E-AB77-101C458C23B5} + {0E364862-1ACA-4C94-8EA0-23724FF67AA2} = {45B6292D-DC7E-46A7-A86E-7455BBEAED70} + {DE03049F-95A3-483F-939C-C2325548D590} = {45B6292D-DC7E-46A7-A86E-7455BBEAED70} + {C714F4F1-E2DF-4B29-A277-9B40BD7DE406} = {B5C675AF-506B-47E6-AB10-4E7BC36531D2} + {40C71491-3CCC-40A0-8F01-3EC7204CF85F} = {C7A4A8F9-0343-4A3E-AB77-101C458C23B5} + {5C70ACE0-BE37-4D67-A67F-EE69767994D2} = {C7A4A8F9-0343-4A3E-AB77-101C458C23B5} + {C04C7CA4-69C3-444F-A654-6C722A0FC3BE} = {C7A4A8F9-0343-4A3E-AB77-101C458C23B5} + EndGlobalSection +EndGlobal From 9da3574220185c5090b4a000c06eeed0275a3335 Mon Sep 17 00:00:00 2001 From: Andrew Stakhov Date: Sun, 13 Oct 2024 01:41:26 -0400 Subject: [PATCH 4/5] Improved string delta rendering for tests --- .../RoslynTestCases/ParseTests.cs | 41 ++++---- .../StringAssertionExtensions.cs | 95 ++++++++++++++----- 2 files changed, 88 insertions(+), 48 deletions(-) diff --git a/Rewrite/tests/Rewrite.CSharp.Tests/RoslynTestCases/ParseTests.cs b/Rewrite/tests/Rewrite.CSharp.Tests/RoslynTestCases/ParseTests.cs index fdbcbce2..8b0cac92 100644 --- a/Rewrite/tests/Rewrite.CSharp.Tests/RoslynTestCases/ParseTests.cs +++ b/Rewrite/tests/Rewrite.CSharp.Tests/RoslynTestCases/ParseTests.cs @@ -22,30 +22,27 @@ public ParseTests(ITestOutputHelper output) _parser = new CSharpParser.Builder().Build(); } - [Fact] + [Theory] [Exploratory] - public void Delta() + [InlineData("abc\n123","abc123")] + [InlineData("abc123","abc134")] + [InlineData(""" + one + two + three + four + NOT five + """, + """ + one + two + four + five + six + """)] + public void Delta(string before, string after) { - string before = @" - one two three - same - 123 - def - another - same - diff1 - @"; - - string after = @" - two two - same - 13 - another - added - same - diff2 - @"; - before.ShouldBeSameAs(after); + after.ShouldBeSameAs(before); } [Fact] diff --git a/Rewrite/tests/Rewrite.CSharp.Tests/StringAssertionExtensions.cs b/Rewrite/tests/Rewrite.CSharp.Tests/StringAssertionExtensions.cs index ba680738..e4dee25b 100644 --- a/Rewrite/tests/Rewrite.CSharp.Tests/StringAssertionExtensions.cs +++ b/Rewrite/tests/Rewrite.CSharp.Tests/StringAssertionExtensions.cs @@ -1,4 +1,5 @@ using System.Text; +using System.Text.RegularExpressions; using DiffPlex; using DiffPlex.Chunkers; using DiffPlex.DiffBuilder.Model; @@ -19,44 +20,82 @@ public static void ShouldBeSameAs(this string newText, string oldText) } public static string? GetDifferences(string oldText, string newText) { + string AddVisibleCrLf(string str) => + Regex.Replace(str.Replace("\r", "\u240D").Replace("\n", "\u2424"), "([\u240D\u2424]+)", "$1\n");// + (AnsiColor.ColorizeText("<-EOF", AnsiColor.Foreground(Terminal256ColorCodes.Yellow1C226))); + oldText = AddVisibleCrLf(oldText); + newText = AddVisibleCrLf(newText); var differ = new Differ(); - var diff = DiffPlex.DiffBuilder.SideBySideDiffBuilder.Diff(differ, oldText, newText, wordChunker: new CharacterChunker()); + var diff = DiffPlex.DiffBuilder.SideBySideDiffBuilder.Diff(differ, oldText, newText, ignoreWhiteSpace: false, wordChunker: new CharacterChunker()); if (!diff.NewText.HasDifferences) return null; - int padSize = diff.OldText.Lines.Count > 0 ? (int)Math.Log10(diff.OldText.Lines.Count) : 0; + int padSize = diff.OldText.Lines.Count > 0 ? (int)Math.Log10(diff.OldText.Lines.Count) + 1 : 1; var result = new StringBuilder(); - + var oldLastLineIndex = diff.OldText.Lines.Last(x => x.Type != ChangeType.Imaginary).Position; + var newLastLineIndex = diff.NewText.Lines.Last(x => x.Type != ChangeType.Imaginary).Position; for (int i = 0; i < diff.OldText.Lines.Count ; i++) { - var leftLine = diff.OldText.Lines[i]; - var rightLine = diff.NewText.Lines[i]; + var oldLine = diff.OldText.Lines[i]; + var newLine = diff.NewText.Lines[i]; var lineChange = diff.NewText.Lines[i].Type; if (lineChange == ChangeType.Unchanged) continue; result.AppendLine("-------------------"); - string leftRender = AnsiColor.ColorizeText(leftLine.Text, AnsiColor.Background(Terminal256ColorCodes.BlackC0))!; - string rightRender = AnsiColor.ColorizeText(rightLine.Text, AnsiColor.Background(Terminal256ColorCodes.BlackC0))!; + string oldRender = AnsiColor.ColorizeText(oldLine.Text, AnsiColor.Background(Terminal256ColorCodes.BlackC0))!; + string newRender = AnsiColor.ColorizeText(newLine.Text, AnsiColor.Background(Terminal256ColorCodes.BlackC0))!; + if (oldLine.Text != null && newLine.Text != null) + { + // check if this is a pure linebreak issue. if it is, collapse diffs for this line and next, into a single diff rendering (we just need to highlight the missing line break characters) + var oldThisAndNextLine = diff.OldText.Lines.Count > i + 1 ? oldLine.Text + diff.OldText.Lines[i+1].Text : oldLine.Text; + var newThisAndNextLine = diff.NewText.Lines.Count > i + 1 ? newLine.Text + diff.NewText.Lines[i+1].Text : newLine.Text; + string StripWhitespace(string str) => Regex.Replace(str,"[\u240D\u2424\n]",""); + if(StripWhitespace(oldThisAndNextLine) == StripWhitespace(newThisAndNextLine)) + { + var twoLineDiff = DiffPlex.DiffBuilder.SideBySideDiffBuilder.Diff(differ, oldThisAndNextLine, newThisAndNextLine, ignoreWhiteSpace: false, wordChunker: new CharacterChunker()); + oldLine = twoLineDiff.OldText.Lines[0]; + newLine = twoLineDiff.NewText.Lines[0]; + i++; + } + } + + if (lineChange == ChangeType.Modified) { - var leftChanges = diff.OldText.Lines[i].SubPieces; - var rightChanges = diff.NewText.Lines[i].SubPieces; - leftRender = GetDiffText(leftChanges); - rightRender = GetDiffText(rightChanges); + oldRender = GetDiffText(oldLine.SubPieces); + newRender = GetDiffText(newLine.SubPieces); } - var lineNum = i + 1; - // var right = GetDiffText); - var leftLineNum = $"{lineNum.ToString()!.PadRight(padSize)}" ; - var rightLineNum = leftLineNum; + var oldLineNum = oldLine.Position?.ToString(); + var newLineNum = newLine.Position?.ToString(); + + oldLineNum = $"{AnsiColor.ColorizeText(oldLineNum, GetStyle(oldLine.Type))}|".PadLeft(padSize); + newLineNum = $"{AnsiColor.ColorizeText(newLineNum, GetStyle(newLine.Type))}|".PadLeft(padSize); - leftLineNum = AnsiColor.ColorizeText(leftLineNum, GetStyle(leftLine.Type)) + "|"; - rightLineNum = AnsiColor.ColorizeText(rightLineNum, GetStyle(rightLine.Type)) + "|"; + // if whole line is different, then make every character take line colour + if (oldLine.Type is not ChangeType.Modified) + { + oldRender = AnsiColor.ColorizeText(oldLine.Text, GetStyle(oldLine.Type))!; + } + if (newLine.Type is not ChangeType.Modified) + { + newRender = AnsiColor.ColorizeText(newLine.Text!, GetStyle(newLine.Type))!; + } + // append EOF character + if (oldLine.Position == oldLastLineIndex) + { + oldRender += AnsiColor.ColorizeText("\u2403", AnsiColor.Foreground(Terminal256ColorCodes.YellowC11)); + } + if (newLine.Position == oldLastLineIndex) + { + newRender += AnsiColor.ColorizeText("\u2403", AnsiColor.Foreground(Terminal256ColorCodes.YellowC11)); + } + if (oldLine.Type is not ChangeType.Imaginary) + result.AppendLine($"{oldLineNum}{oldRender}"); - result.AppendLine($"{leftLineNum}{leftRender}"); - result.AppendLine($"{rightLineNum}{rightRender}"); + if (newLine.Type is not ChangeType.Imaginary) + result.AppendLine($"{newLineNum}{newRender}"); } return result.ToString(); @@ -68,8 +107,11 @@ static string GetDiffText(List current) foreach (var charDelta in current) { var text = charDelta.Text; - var style = AnsiColor.Composite(GetStyle(charDelta.Type), - AnsiColor.Background(Terminal256ColorCodes.BlackC0)); + if (charDelta.Type == ChangeType.Imaginary) + { + text = " "; + } + var style = GetStyle(charDelta.Type); sb.Append(AnsiColor.ColorizeText(text, style)); } @@ -80,11 +122,12 @@ static AnsiColor GetStyle(ChangeType type) { return type switch { - ChangeType.Deleted => AnsiColor.Foreground(Terminal256ColorCodes.Red1C196), - ChangeType.Inserted => AnsiColor.Foreground(Terminal256ColorCodes.Green1C46), - ChangeType.Modified => AnsiColor.Background(Terminal256ColorCodes.Blue1C21), - ChangeType.Imaginary => AnsiColor.Composite(AnsiColor.Background(Terminal256ColorCodes.GreyC8), AnsiColor.Foreground(Terminal256ColorCodes.SeaGreen3C78)), - _ => AnsiColor.Reset + ChangeType.Deleted => AnsiColor.Composite(AnsiColor.Foreground(Terminal256ColorCodes.Red1C196), AnsiColor.Background(Terminal256ColorCodes.BlackC0)), + ChangeType.Inserted => AnsiColor.Composite(AnsiColor.Foreground(Terminal256ColorCodes.Green1C46), AnsiColor.Background(Terminal256ColorCodes.BlackC0)), + ChangeType.Modified => AnsiColor.Composite(AnsiColor.Background(Terminal256ColorCodes.Blue1C21)), + ChangeType.Imaginary => AnsiColor.Reset, // AnsiColor.Background(Terminal256ColorCodes.GreyC8), + // ChangeType.Imaginary => AnsiColor.Composite(AnsiColor.Background(Terminal256ColorCodes.GreyC8), AnsiColor.Foreground(Terminal256ColorCodes.SeaGreen3C78)), + _ => AnsiColor.Background(Terminal256ColorCodes.BlackC0) }; } } From 5bcd8f83b8a710713514d372bdbefc2dffe0ba85 Mon Sep 17 00:00:00 2001 From: Andrew Stakhov Date: Tue, 15 Oct 2024 12:57:22 -0400 Subject: [PATCH 5/5] Remove CSharpSyntaxFragment class --- .../RoslynTestCases/CSharpSyntaxFragment.cs | 6 ------ 1 file changed, 6 deletions(-) delete mode 100644 Rewrite/tests/Rewrite.CSharp.Tests/RoslynTestCases/CSharpSyntaxFragment.cs diff --git a/Rewrite/tests/Rewrite.CSharp.Tests/RoslynTestCases/CSharpSyntaxFragment.cs b/Rewrite/tests/Rewrite.CSharp.Tests/RoslynTestCases/CSharpSyntaxFragment.cs deleted file mode 100644 index 182fd7c6..00000000 --- a/Rewrite/tests/Rewrite.CSharp.Tests/RoslynTestCases/CSharpSyntaxFragment.cs +++ /dev/null @@ -1,6 +0,0 @@ -namespace Rewrite.CSharp.Tests.RoslynTestCases; - -public record CSharpSyntaxFragment(string Name, string Content) -{ - public override string ToString() => Name; -}