diff --git a/.editorconfig b/.editorconfig
index 644e20256c84ee8e309bfe7ce47399572e2b39f5..c5a66e7c61d8f256d6444d8dc742916e3c496ca9 100644
--- a/.editorconfig
+++ b/.editorconfig
@@ -25,7 +25,7 @@ indent_size = 2
indent_size = 2
# Dotnet code style settings:
-[*.{cs, vb}]
+[*.{cs,vb}]
# Sort using and Import directives with System.* appearing first
dotnet_sort_system_directives_first = true
# Avoid "this." and "Me." if not necessary
diff --git a/build/Targets/Versions.props b/build/Targets/Versions.props
index d249f7429ac0a19ff67a095183406bff32089410..8079a38d6f19c50c72fbc5776479d45a325148fb 100644
--- a/build/Targets/Versions.props
+++ b/build/Targets/Versions.props
@@ -14,7 +14,7 @@
dev
- rc4
+ rc5
$(RoslynFileVersionBase)-$(RoslynNuGetMoniker)
diff --git a/build/config/RepoUtilData.json b/build/config/RepoUtilData.json
index dcbdf2f025bd4e33f1a510e21224247b497027ef..09dc0b881849647049809bf73f84c848db1d2fef 100644
--- a/build/config/RepoUtilData.json
+++ b/build/config/RepoUtilData.json
@@ -1,6 +1,14 @@
{
"fixedPackages": {
"Microsoft.VSSDK.BuildTools": [ "14.3.25420" ],
+ "Microsoft.VisualStudio.CoreUtility": [ "[14.0.23205]" ],
+ "Microsoft.VisualStudio.Editor": [ "[14.0.23205]" ],
+ "Microsoft.VisualStudio.Text.Data": [ "[14.0.23205]" ],
+ "Microsoft.VisualStudio.Text.Logic": [ "[14.0.23205]" ],
+ "Microsoft.VisualStudio.Text.UI": [ "[14.0.23205]" ],
+ "Microsoft.VisualStudio.Text.UI.Wpf": [ "[14.0.23205]" ],
+ "Microsoft.VisualStudio.Utilities": [ "[14.0.23205]" ],
+ "Microsoft.VisualStudio.Shell.14.0": [ "[14.0.23205]" ],
"Newtonsoft.Json": "9.0.1",
"System.Reflection.Metadata": "1.0.21",
"System.Collections.Immutable": "1.1.36",
diff --git a/src/Compilers/CSharp/Test/Semantic/Semantics/PatternMatchingTestBase.cs b/src/Compilers/CSharp/Test/Semantic/Semantics/PatternMatchingTestBase.cs
index 31191778c323da176af0492e4d234e9c5759629c..12761cc5835f339602c9cf268765e5f633fa2377 100644
--- a/src/Compilers/CSharp/Test/Semantic/Semantics/PatternMatchingTestBase.cs
+++ b/src/Compilers/CSharp/Test/Semantic/Semantics/PatternMatchingTestBase.cs
@@ -51,6 +51,11 @@ protected static void VerifyModelForDeclarationPattern(SemanticModel model, Sing
VerifyModelForDeclarationPattern(model, decl, false, references);
}
+ protected static void VerifyModelForDeclarationPatternWithoutDataFlow(SemanticModel model, SingleVariableDesignationSyntax decl, params IdentifierNameSyntax[] references)
+ {
+ VerifyModelForDeclarationPattern(model, decl, false, references);
+ }
+
protected static void VerifyModelForDeclarationPattern(
SemanticModel model,
SingleVariableDesignationSyntax designation,
diff --git a/src/Compilers/CSharp/Test/Semantic/Semantics/PatternMatchingTests_Scope.cs b/src/Compilers/CSharp/Test/Semantic/Semantics/PatternMatchingTests_Scope.cs
index efdbf2d261140d5149e4c33859fc5a183cac0d58..0bd137b2a25d34a2da2da6c499fe4f1f52c8ee39 100644
--- a/src/Compilers/CSharp/Test/Semantic/Semantics/PatternMatchingTests_Scope.cs
+++ b/src/Compilers/CSharp/Test/Semantic/Semantics/PatternMatchingTests_Scope.cs
@@ -11766,6 +11766,2011 @@ static bool Dummy(params object[] data)
Assert.Equal("System.Boolean", compilation.GetSemanticModel(tree).GetTypeInfo(z2Ref).Type.ToTestDisplayString());
}
+ [Fact]
+ public void Scope_DeclaratorArguments_01()
+ {
+ var source =
+@"
+public class X
+{
+ public static void Main()
+ {
+ }
+
+ object Dummy(params object[] x) {return null;}
+
+ void Test1()
+ {
+ int d,e(Dummy(true is var x1, x1));
+ }
+ void Test4()
+ {
+ var x4 = 11;
+ Dummy(x4);
+
+ int d,e(Dummy(true is var x4, x4));
+ }
+
+ void Test6()
+ {
+ int d,e(Dummy(x6 && true is var x6));
+ }
+
+ void Test8()
+ {
+ int d,e(Dummy(true is var x8, x8));
+ System.Console.WriteLine(x8);
+ }
+
+ void Test14()
+ {
+ int d,e(Dummy(1 is var x14,
+ 2 is var x14,
+ x14));
+ }
+}
+";
+ var compilation = CreateCompilationWithMscorlib45(source, options: TestOptions.DebugExe, parseOptions: TestOptions.Regular);
+ int[] exclude = new int[] { (int)ErrorCode.ERR_BadVarDecl,
+ (int)ErrorCode.ERR_SyntaxError,
+ (int)ErrorCode.WRN_UnreferencedVar
+ };
+
+ compilation.GetDiagnostics().Where(d => !exclude.Contains(d.Code)).Verify(
+ // (19,35): error CS0128: A local variable or function named 'x4' is already defined in this scope
+ // int d,e(Dummy(true is var x4, x4));
+ Diagnostic(ErrorCode.ERR_LocalDuplicate, "x4").WithArguments("x4").WithLocation(19, 35),
+ // (24,23): error CS0841: Cannot use local variable 'x6' before it is declared
+ // int d,e(Dummy(x6 && true is var x6));
+ Diagnostic(ErrorCode.ERR_VariableUsedBeforeDeclaration, "x6").WithArguments("x6").WithLocation(24, 23),
+ // (30,34): error CS0165: Use of unassigned local variable 'x8'
+ // System.Console.WriteLine(x8);
+ Diagnostic(ErrorCode.ERR_UseDefViolation, "x8").WithArguments("x8").WithLocation(30, 34),
+ // (36,32): error CS0128: A local variable or function named 'x14' is already defined in this scope
+ // 2 is var x14,
+ Diagnostic(ErrorCode.ERR_LocalDuplicate, "x14").WithArguments("x14").WithLocation(36, 32)
+ );
+
+ var tree = compilation.SyntaxTrees.Single();
+ var model = compilation.GetSemanticModel(tree);
+
+ var x1Decl = GetPatternDeclarations(tree, "x1").Single();
+ var x1Ref = GetReferences(tree, "x1").Single();
+ AssertContainedInDeclaratorArguments(x1Decl);
+ VerifyModelForDeclarationPatternWithoutDataFlow(model, x1Decl, x1Ref);
+
+ var x4Decl = GetPatternDeclarations(tree, "x4").Single();
+ var x4Ref = GetReferences(tree, "x4").ToArray();
+ Assert.Equal(2, x4Ref.Length);
+ AssertContainedInDeclaratorArguments(x4Decl);
+ VerifyNotAPatternLocal(model, x4Ref[0]);
+ VerifyNotAPatternLocal(model, x4Ref[1]);
+ VerifyModelForDeclarationPatternDuplicateInSameScope(model, x4Decl);
+
+ var x6Decl = GetPatternDeclarations(tree, "x6").Single();
+ var x6Ref = GetReferences(tree, "x6").Single();
+ AssertContainedInDeclaratorArguments(x6Decl);
+ VerifyModelForDeclarationPatternWithoutDataFlow(model, x6Decl, x6Ref);
+
+ var x8Decl = GetPatternDeclarations(tree, "x8").Single();
+ var x8Ref = GetReferences(tree, "x8").ToArray();
+ Assert.Equal(2, x8Ref.Length);
+ AssertContainedInDeclaratorArguments(x8Decl);
+ VerifyModelForDeclarationPatternWithoutDataFlow(model, x8Decl, x8Ref);
+
+ var x14Decl = GetPatternDeclarations(tree, "x14").ToArray();
+ var x14Ref = GetReferences(tree, "x14").Single();
+ Assert.Equal(2, x14Decl.Length);
+ AssertContainedInDeclaratorArguments(x14Decl);
+ VerifyModelForDeclarationPatternWithoutDataFlow(model, x14Decl[0], x14Ref);
+ VerifyModelForDeclarationPatternDuplicateInSameScope(model, x14Decl[1]);
+ }
+
+ [Fact]
+ public void Scope_DeclaratorArguments_02()
+ {
+ var source =
+@"
+public class X
+{
+ public static void Main()
+ {
+ }
+
+ object Dummy(params object[] x) {return null;}
+
+ void Test1()
+ {
+ var d, x1(
+ Dummy(true is var x1, x1));
+ Dummy(x1);
+ }
+
+ void Test2()
+ {
+ object d, x2(
+ Dummy(true is var x2, x2));
+ Dummy(x2);
+ }
+
+ void Test3()
+ {
+ object x3, d(
+ Dummy(true is var x3, x3));
+ Dummy(x3);
+ }
+}
+";
+ var compilation = CreateCompilationWithMscorlib45(source, options: TestOptions.DebugExe, parseOptions: TestOptions.Regular);
+ int[] exclude = new int[] { (int)ErrorCode.ERR_BadVarDecl,
+ (int)ErrorCode.ERR_SyntaxError,
+ (int)ErrorCode.WRN_UnreferencedVar
+ };
+
+ compilation.GetDiagnostics().Where(d => !exclude.Contains(d.Code)).Verify(
+ // (12,13): error CS0818: Implicitly-typed variables must be initialized
+ // var d, x1(
+ Diagnostic(ErrorCode.ERR_ImplicitlyTypedVariableWithNoInitializer, "d").WithLocation(12, 13),
+ // (13,36): error CS0128: A local variable or function named 'x1' is already defined in this scope
+ // Dummy(true is var x1, x1));
+ Diagnostic(ErrorCode.ERR_LocalDuplicate, "x1").WithArguments("x1").WithLocation(13, 36),
+ // (20,39): error CS0128: A local variable or function named 'x2' is already defined in this scope
+ // Dummy(true is var x2, x2));
+ Diagnostic(ErrorCode.ERR_LocalDuplicate, "x2").WithArguments("x2").WithLocation(20, 39),
+ // (21,15): error CS0165: Use of unassigned local variable 'x2'
+ // Dummy(x2);
+ Diagnostic(ErrorCode.ERR_UseDefViolation, "x2").WithArguments("x2").WithLocation(21, 15),
+ // (27,39): error CS0128: A local variable or function named 'x3' is already defined in this scope
+ // Dummy(true is var x3, x3));
+ Diagnostic(ErrorCode.ERR_LocalDuplicate, "x3").WithArguments("x3").WithLocation(27, 39),
+ // (28,15): error CS0165: Use of unassigned local variable 'x3'
+ // Dummy(x3);
+ Diagnostic(ErrorCode.ERR_UseDefViolation, "x3").WithArguments("x3").WithLocation(28, 15)
+ );
+
+ var tree = compilation.SyntaxTrees.Single();
+ var model = compilation.GetSemanticModel(tree);
+
+ var x1Decl = GetPatternDeclarations(tree, "x1").Single();
+ var x1Ref = GetReferences(tree, "x1").ToArray();
+ Assert.Equal(2, x1Ref.Length);
+ AssertContainedInDeclaratorArguments(x1Decl);
+ VerifyNotAPatternLocal(model, x1Ref[0]);
+ VerifyNotAPatternLocal(model, x1Ref[1]);
+ VerifyModelForDeclarationPatternDuplicateInSameScope(model, x1Decl);
+
+ var x2Decl = GetPatternDeclarations(tree, "x2").Single();
+ var x2Ref = GetReferences(tree, "x2").ToArray();
+ Assert.Equal(2, x2Ref.Length);
+ AssertContainedInDeclaratorArguments(x2Decl);
+ VerifyNotAPatternLocal(model, x2Ref[0]);
+ VerifyNotAPatternLocal(model, x2Ref[1]);
+ VerifyModelForDeclarationPatternDuplicateInSameScope(model, x2Decl);
+
+ var x3Decl = GetPatternDeclarations(tree, "x3").Single();
+ var x3Ref = GetReferences(tree, "x3").ToArray();
+ Assert.Equal(2, x2Ref.Length);
+ AssertContainedInDeclaratorArguments(x3Decl);
+ VerifyNotAPatternLocal(model, x3Ref[0]);
+ VerifyNotAPatternLocal(model, x3Ref[1]);
+ VerifyModelForDeclarationPatternDuplicateInSameScope(model, x3Decl);
+ }
+
+ [Fact]
+ public void Scope_DeclaratorArguments_03()
+ {
+ var source =
+@"
+public class X
+{
+ public static void Main()
+ {
+ }
+
+ object Dummy(params object[] x) {return null;}
+
+ void Test1()
+ {
+ object d,e(Dummy(true is var x1, x1)],
+ x1( Dummy(x1));
+ Dummy(x1);
+ }
+
+ void Test2()
+ {
+ object d1,e(Dummy(true is var x2, x2)],
+ d2(Dummy(true is var x2, x2));
+ }
+
+ void Test3()
+ {
+ object d1,e(Dummy(true is var x3, x3)],
+ d2(Dummy(x3));
+ }
+
+ void Test4()
+ {
+ object d1,e(Dummy(x4)],
+ d2(Dummy(true is var x4, x4));
+ }
+}
+";
+ var compilation = CreateCompilationWithMscorlib45(source, options: TestOptions.DebugExe, parseOptions: TestOptions.Regular);
+ int[] exclude = new int[] { (int)ErrorCode.ERR_BadVarDecl,
+ (int)ErrorCode.ERR_SyntaxError,
+ (int)ErrorCode.WRN_UnreferencedVar,
+ (int)ErrorCode.ERR_CloseParenExpected
+ };
+
+ compilation.GetDiagnostics().Where(d => !exclude.Contains(d.Code)).Verify(
+ // (13,16): error CS0128: A local variable or function named 'x1' is already defined in this scope
+ // x1( Dummy(x1));
+ Diagnostic(ErrorCode.ERR_LocalDuplicate, "x1").WithArguments("x1").WithLocation(13, 16),
+ // (14,15): error CS0165: Use of unassigned local variable 'x1'
+ // Dummy(x1);
+ Diagnostic(ErrorCode.ERR_UseDefViolation, "x1").WithArguments("x1").WithLocation(14, 15),
+ // (20,39): error CS0128: A local variable or function named 'x2' is already defined in this scope
+ // d2(Dummy(true is var x2, x2));
+ Diagnostic(ErrorCode.ERR_LocalDuplicate, "x2").WithArguments("x2").WithLocation(20, 39),
+ // (31,27): error CS0841: Cannot use local variable 'x4' before it is declared
+ // object d1,e(Dummy(x4)],
+ Diagnostic(ErrorCode.ERR_VariableUsedBeforeDeclaration, "x4").WithArguments("x4").WithLocation(31, 27)
+ );
+
+ var tree = compilation.SyntaxTrees.Single();
+ var model = compilation.GetSemanticModel(tree);
+
+ var x1Decl = GetPatternDeclarations(tree, "x1").Single();
+ var x1Ref = GetReferences(tree, "x1").ToArray();
+ Assert.Equal(3, x1Ref.Length);
+ AssertContainedInDeclaratorArguments(x1Decl);
+ VerifyModelForDeclarationPatternWithoutDataFlow(model, x1Decl, x1Ref);
+
+ var x2Decl = GetPatternDeclarations(tree, "x2").ToArray();
+ var x2Ref = GetReferences(tree, "x2").ToArray();
+ Assert.Equal(2, x2Decl.Length);
+ Assert.Equal(2, x2Ref.Length);
+ AssertContainedInDeclaratorArguments(x2Decl);
+ VerifyModelForDeclarationPatternWithoutDataFlow(model, x2Decl[0], x2Ref);
+ VerifyModelForDeclarationPatternDuplicateInSameScope(model, x2Decl[1]);
+
+ var x3Decl = GetPatternDeclarations(tree, "x3").Single();
+ var x3Ref = GetReferences(tree, "x3").ToArray();
+ Assert.Equal(2, x3Ref.Length);
+ AssertContainedInDeclaratorArguments(x3Decl);
+ VerifyModelForDeclarationPatternWithoutDataFlow(model, x3Decl, x3Ref);
+
+ var x4Decl = GetPatternDeclarations(tree, "x4").Single();
+ var x4Ref = GetReferences(tree, "x4").ToArray();
+ Assert.Equal(2, x4Ref.Length);
+ AssertContainedInDeclaratorArguments(x4Decl);
+ VerifyModelForDeclarationPatternWithoutDataFlow(model, x4Decl, x4Ref);
+ }
+
+ [Fact]
+ public void Scope_DeclaratorArguments_04()
+ {
+ var source =
+@"
+public class X
+{
+ public static void Main()
+ {
+ }
+
+ object Dummy(params object[] x) {return null;}
+
+ void Test1()
+ {
+ object d,e(Dummy(true is var x1, x1)],
+ x1 = Dummy(x1);
+ Dummy(x1);
+ }
+
+ void Test2()
+ {
+ object d1,e(Dummy(true is var x2, x2)],
+ d2 = Dummy(true is var x2, x2);
+ }
+
+ void Test3()
+ {
+ object d1,e(Dummy(true is var x3, x3)],
+ d2 = Dummy(x3);
+ }
+
+ void Test4()
+ {
+ object d1 = Dummy(x4),
+ d2 (Dummy(true is var x4, x4));
+ }
+}
+";
+ var compilation = CreateCompilationWithMscorlib45(source, options: TestOptions.DebugExe, parseOptions: TestOptions.Regular);
+ int[] exclude = new int[] { (int)ErrorCode.ERR_BadVarDecl,
+ (int)ErrorCode.ERR_SyntaxError,
+ (int)ErrorCode.ERR_UnexpectedToken,
+ (int)ErrorCode.WRN_UnreferencedVar,
+ (int)ErrorCode.ERR_CloseParenExpected
+ };
+
+ compilation.GetDiagnostics().Where(d => !exclude.Contains(d.Code)).Verify(
+ // (13,16): error CS0128: A local variable or function named 'x1' is already defined in this scope
+ // x1 = Dummy(x1);
+ Diagnostic(ErrorCode.ERR_LocalDuplicate, "x1").WithArguments("x1").WithLocation(13, 16),
+ // (13,27): error CS0165: Use of unassigned local variable 'x1'
+ // x1 = Dummy(x1);
+ Diagnostic(ErrorCode.ERR_UseDefViolation, "x1").WithArguments("x1").WithLocation(13, 27),
+ // (20,39): error CS0128: A local variable or function named 'x2' is already defined in this scope
+ // d2 = Dummy(true is var x2, x2);
+ Diagnostic(ErrorCode.ERR_LocalDuplicate, "x2").WithArguments("x2").WithLocation(20, 39),
+ // (20,43): error CS0165: Use of unassigned local variable 'x2'
+ // d2 = Dummy(true is var x2, x2);
+ Diagnostic(ErrorCode.ERR_UseDefViolation, "x2").WithArguments("x2").WithLocation(20, 43),
+ // (26,27): error CS0165: Use of unassigned local variable 'x3'
+ // d2 = Dummy(x3);
+ Diagnostic(ErrorCode.ERR_UseDefViolation, "x3").WithArguments("x3").WithLocation(26, 27),
+ // (31,27): error CS0841: Cannot use local variable 'x4' before it is declared
+ // object d1 = Dummy(x4),
+ Diagnostic(ErrorCode.ERR_VariableUsedBeforeDeclaration, "x4").WithArguments("x4").WithLocation(31, 27)
+ );
+
+ var tree = compilation.SyntaxTrees.Single();
+ var model = compilation.GetSemanticModel(tree);
+
+ var x1Decl = GetPatternDeclarations(tree, "x1").Single();
+ var x1Ref = GetReferences(tree, "x1").ToArray();
+ Assert.Equal(3, x1Ref.Length);
+ AssertContainedInDeclaratorArguments(x1Decl);
+ VerifyModelForDeclarationPatternWithoutDataFlow(model, x1Decl, x1Ref);
+
+ var x2Decl = GetPatternDeclarations(tree, "x2").ToArray();
+ var x2Ref = GetReferences(tree, "x2").ToArray();
+ Assert.Equal(2, x2Decl.Length);
+ Assert.Equal(2, x2Ref.Length);
+ AssertContainedInDeclaratorArguments(x2Decl[0]);
+ VerifyModelForDeclarationPatternWithoutDataFlow(model, x2Decl[0], x2Ref);
+ VerifyModelForDeclarationPatternDuplicateInSameScope(model, x2Decl[1]);
+
+ var x3Decl = GetPatternDeclarations(tree, "x3").Single();
+ var x3Ref = GetReferences(tree, "x3").ToArray();
+ Assert.Equal(2, x3Ref.Length);
+ AssertContainedInDeclaratorArguments(x3Decl);
+ VerifyModelForDeclarationPatternWithoutDataFlow(model, x3Decl, x3Ref);
+
+ var x4Decl = GetPatternDeclarations(tree, "x4").Single();
+ var x4Ref = GetReferences(tree, "x4").ToArray();
+ Assert.Equal(2, x4Ref.Length);
+ AssertContainedInDeclaratorArguments(x4Decl);
+ VerifyModelForDeclarationPatternWithoutDataFlow(model, x4Decl, x4Ref);
+ }
+
+ [Fact]
+ public void Scope_DeclaratorArguments_05()
+ {
+ var source =
+@"
+public class X
+{
+ public static void Main()
+ {
+ }
+
+ long Dummy(params object[] x) {}
+
+ void Test1()
+ {
+ SpeculateHere();
+ }
+}
+";
+ var compilation = CreateCompilationWithMscorlib45(source, options: TestOptions.DebugExe, parseOptions: TestOptions.Regular);
+
+ var tree = compilation.SyntaxTrees.Single();
+ var model = compilation.GetSemanticModel(tree);
+
+ var statement = (LocalDeclarationStatementSyntax)SyntaxFactory.ParseStatement(@"
+var y, y1(Dummy(3 is var x1, x1));
+");
+
+ bool success = model.TryGetSpeculativeSemanticModel(GetReferences(tree, "SpeculateHere").Single().SpanStart, statement, out model);
+ Assert.True(success);
+ Assert.NotNull(model);
+ tree = statement.SyntaxTree;
+
+ var x1Decl = GetPatternDeclarations(tree, "x1").Single();
+ var x1Ref = GetReferences(tree, "x1").ToArray();
+ Assert.Equal(1, x1Ref.Length);
+ AssertContainedInDeclaratorArguments(x1Decl);
+ VerifyModelForDeclarationPatternWithoutDataFlow(model, x1Decl, x1Ref);
+ Assert.Equal("System.Int32", model.GetTypeInfo(x1Ref[0]).Type.ToTestDisplayString());
+
+ var y1 = model.LookupSymbols(x1Ref[0].SpanStart, name: "y1").Single();
+ Assert.Equal("var y1", y1.ToTestDisplayString());
+ Assert.True(((LocalSymbol)y1).Type.IsErrorType());
+ }
+
+ [Fact]
+ public void Scope_DeclaratorArguments_06()
+ {
+ var source =
+@"
+public class X
+{
+ public static void Main()
+ {
+ }
+
+ void Test1()
+ {
+ if (true)
+ var d,e(string.Empty is var x1 && x1 != null);
+
+ x1++;
+ }
+}
+";
+ var compilation = CreateCompilationWithMscorlib45(source, options: TestOptions.DebugExe, parseOptions: TestOptions.Regular);
+ int[] exclude = new int[] { (int)ErrorCode.ERR_BadVarDecl,
+ (int)ErrorCode.ERR_SyntaxError,
+ (int)ErrorCode.WRN_UnreferencedVar
+ };
+
+ compilation.GetDiagnostics().Where(d => !exclude.Contains(d.Code)).Verify(
+ // (11,13): error CS1023: Embedded statement cannot be a declaration or labeled statement
+ // var d,e(string.Empty is var x1 && x1 != null);
+ Diagnostic(ErrorCode.ERR_BadEmbeddedStmt, "var d,e(string.Empty is var x1 && x1 != null);").WithLocation(11, 13),
+ // (11,17): error CS0818: Implicitly-typed variables must be initialized
+ // var d,e(string.Empty is var x1 && x1 != null);
+ Diagnostic(ErrorCode.ERR_ImplicitlyTypedVariableWithNoInitializer, "d").WithLocation(11, 17),
+ // (13,9): error CS0103: The name 'x1' does not exist in the current context
+ // x1++;
+ Diagnostic(ErrorCode.ERR_NameNotInContext, "x1").WithArguments("x1").WithLocation(13, 9)
+ );
+
+ var tree = compilation.SyntaxTrees.Single();
+ var model = compilation.GetSemanticModel(tree);
+
+ var x1Decl = GetPatternDeclarations(tree, "x1").Single();
+ var x1Ref = GetReferences(tree, "x1").ToArray();
+ Assert.Equal(2, x1Ref.Length);
+ AssertContainedInDeclaratorArguments(x1Decl);
+ VerifyModelForDeclarationPatternWithoutDataFlow(model, x1Decl, x1Ref[0]);
+ VerifyNotInScope(model, x1Ref[1]);
+
+ var e = tree.GetRoot().DescendantNodes().OfType().Where(id => id.Identifier.ValueText == "e").Single();
+ var symbol = (LocalSymbol)model.GetDeclaredSymbol(e);
+ Assert.Equal("var e", symbol.ToTestDisplayString());
+ Assert.True(symbol.Type.IsErrorType());
+ }
+
+ [Fact]
+ [WorkItem(13460, "https://github.com/dotnet/roslyn/issues/13460")]
+ public void Scope_DeclaratorArguments_07()
+ {
+ var source =
+@"
+public class X
+{
+ public static void Main()
+ {
+ Test(1);
+ }
+
+ static void Test(int val)
+ {
+ switch (val)
+ {
+ case 1 when 123 is var x1:
+ var z, z1(x1, out var u1, x1 > 0 & x1 is var y1];
+ System.Console.WriteLine(y1);
+ System.Console.WriteLine(z1 ? 1 : 0);
+ break;
+ }
+ }
+}
+";
+ var compilation = CreateCompilationWithMscorlib45(source, options: TestOptions.DebugExe, parseOptions: TestOptions.Regular);
+
+ var tree = compilation.SyntaxTrees.Single();
+ var model = compilation.GetSemanticModel(tree);
+
+ var y1Decl = GetPatternDeclarations(tree, "y1").Single();
+ AssertContainedInDeclaratorArguments(y1Decl);
+
+ var yRef = GetReference(tree, "y1");
+ Assert.Equal("System.Int32", model.GetTypeInfo(yRef).Type.ToTestDisplayString());
+
+ model = compilation.GetSemanticModel(tree);
+ var zRef = GetReference(tree, "z1");
+ Assert.True(((TypeSymbol)model.GetTypeInfo(zRef).Type).IsErrorType());
+ }
+
+ [Fact]
+ [WorkItem(13459, "https://github.com/dotnet/roslyn/issues/13459")]
+ public void Scope_DeclaratorArguments_08()
+ {
+ var source =
+@"
+public class X
+{
+ public static void Main()
+ {
+ }
+
+ bool Dummy(params object[] x) {return true;}
+
+ void Test1()
+ {
+ for (bool a, b(
+ Dummy(true is var x1 && x1)
+ );;)
+ {
+ Dummy(x1);
+ }
+ }
+
+ void Test2()
+ {
+ for (bool a, b(
+ Dummy(true is var x2 && x2)
+ );;)
+ Dummy(x2);
+ }
+
+ void Test4()
+ {
+ var x4 = 11;
+ Dummy(x4);
+
+ for (bool a, b(
+ Dummy(true is var x4 && x4)
+ );;)
+ Dummy(x4);
+ }
+
+ void Test6()
+ {
+ for (bool a, b(
+ Dummy(x6 && true is var x6)
+ );;)
+ Dummy(x6);
+ }
+
+ void Test7()
+ {
+ for (bool a, b(
+ Dummy(true is var x7 && x7)
+ );;)
+ {
+ var x7 = 12;
+ Dummy(x7);
+ }
+ }
+
+ void Test8()
+ {
+ for (bool a, b(
+ Dummy(true is var x8 && x8)
+ );;)
+ Dummy(x8);
+
+ System.Console.WriteLine(x8);
+ }
+
+ void Test9()
+ {
+ for (bool a1, b1(
+ Dummy(true is var x9 && x9)
+ );;)
+ {
+ Dummy(x9);
+ for (bool a2, b2(
+ Dummy(true is var x9 && x9) // 2
+ );;)
+ Dummy(x9);
+ }
+ }
+
+ void Test10()
+ {
+ for (bool a, b(
+ Dummy(y10 is var x10)
+ );;)
+ {
+ var y10 = 12;
+ Dummy(y10);
+ }
+ }
+
+ //void Test11()
+ //{
+ // for (bool a, b(
+ // Dummy(y11 is var x11)
+ // );;)
+ // {
+ // let y11 = 12;
+ // Dummy(y11);
+ // }
+ //}
+
+ void Test12()
+ {
+ for (bool a, b(
+ Dummy(y12 is var x12)
+ );;)
+ var y12 = 12;
+ }
+
+ //void Test13()
+ //{
+ // for (bool a, b(
+ // Dummy(y13 is var x13)
+ // );;)
+ // let y13 = 12;
+ //}
+
+ void Test14()
+ {
+ for (bool a, b(
+ Dummy(1 is var x14,
+ 2 is var x14,
+ x14)
+ );;)
+ {
+ Dummy(x14);
+ }
+ }
+}
+";
+ var compilation = CreateCompilationWithMscorlib45(source, options: TestOptions.DebugExe, parseOptions: TestOptions.Regular);
+ int[] exclude = new int[] { (int)ErrorCode.ERR_BadVarDecl,
+ (int)ErrorCode.ERR_SyntaxError,
+ (int)ErrorCode.ERR_UnexpectedToken,
+ (int)ErrorCode.WRN_UnreferencedVar,
+ (int)ErrorCode.ERR_UseDefViolation
+ };
+
+ compilation.GetDiagnostics().Where(d => !exclude.Contains(d.Code)).Verify(
+ // (109,13): error CS1023: Embedded statement cannot be a declaration or labeled statement
+ // var y12 = 12;
+ Diagnostic(ErrorCode.ERR_BadEmbeddedStmt, "var y12 = 12;").WithLocation(109, 13),
+ // (34,32): error CS0136: A local or parameter named 'x4' cannot be declared in this scope because that name is used in an enclosing local scope to define a local or parameter
+ // Dummy(true is var x4 && x4)
+ Diagnostic(ErrorCode.ERR_LocalIllegallyOverrides, "x4").WithArguments("x4").WithLocation(34, 32),
+ // (42,20): error CS0841: Cannot use local variable 'x6' before it is declared
+ // Dummy(x6 && true is var x6)
+ Diagnostic(ErrorCode.ERR_VariableUsedBeforeDeclaration, "x6").WithArguments("x6").WithLocation(42, 20),
+ // (53,17): error CS0136: A local or parameter named 'x7' cannot be declared in this scope because that name is used in an enclosing local scope to define a local or parameter
+ // var x7 = 12;
+ Diagnostic(ErrorCode.ERR_LocalIllegallyOverrides, "x7").WithArguments("x7").WithLocation(53, 17),
+ // (65,34): error CS0103: The name 'x8' does not exist in the current context
+ // System.Console.WriteLine(x8);
+ Diagnostic(ErrorCode.ERR_NameNotInContext, "x8").WithArguments("x8").WithLocation(65, 34),
+ // (65,9): warning CS0162: Unreachable code detected
+ // System.Console.WriteLine(x8);
+ Diagnostic(ErrorCode.WRN_UnreachableCode, "System").WithLocation(65, 9),
+ // (76,36): error CS0136: A local or parameter named 'x9' cannot be declared in this scope because that name is used in an enclosing local scope to define a local or parameter
+ // Dummy(true is var x9 && x9) // 2
+ Diagnostic(ErrorCode.ERR_LocalIllegallyOverrides, "x9").WithArguments("x9").WithLocation(76, 36),
+ // (85,20): error CS0103: The name 'y10' does not exist in the current context
+ // Dummy(y10 is var x10)
+ Diagnostic(ErrorCode.ERR_NameNotInContext, "y10").WithArguments("y10").WithLocation(85, 20),
+ // (107,20): error CS0103: The name 'y12' does not exist in the current context
+ // Dummy(y12 is var x12)
+ Diagnostic(ErrorCode.ERR_NameNotInContext, "y12").WithArguments("y12").WithLocation(107, 20),
+ // (109,17): warning CS0219: The variable 'y12' is assigned but its value is never used
+ // var y12 = 12;
+ Diagnostic(ErrorCode.WRN_UnreferencedVarAssg, "y12").WithArguments("y12").WithLocation(109, 17),
+ // (124,29): error CS0128: A local variable or function named 'x14' is already defined in this scope
+ // 2 is var x14,
+ Diagnostic(ErrorCode.ERR_LocalDuplicate, "x14").WithArguments("x14").WithLocation(124, 29)
+ );
+
+ var tree = compilation.SyntaxTrees.Single();
+ var model = compilation.GetSemanticModel(tree);
+
+ var x1Decl = GetPatternDeclarations(tree, "x1").Single();
+ var x1Ref = GetReferences(tree, "x1").ToArray();
+ Assert.Equal(2, x1Ref.Length);
+ AssertContainedInDeclaratorArguments(x1Decl);
+ VerifyModelForDeclarationPatternWithoutDataFlow(model, x1Decl, x1Ref);
+
+ var x2Decl = GetPatternDeclarations(tree, "x2").Single();
+ var x2Ref = GetReferences(tree, "x2").ToArray();
+ Assert.Equal(2, x2Ref.Length);
+ AssertContainedInDeclaratorArguments(x2Decl);
+ VerifyModelForDeclarationPatternWithoutDataFlow(model, x2Decl, x2Ref);
+
+ var x4Decl = GetPatternDeclarations(tree, "x4").Single();
+ var x4Ref = GetReferences(tree, "x4").ToArray();
+ Assert.Equal(3, x4Ref.Length);
+ AssertContainedInDeclaratorArguments(x4Decl);
+ VerifyNotAPatternLocal(model, x4Ref[0]);
+ VerifyModelForDeclarationPatternWithoutDataFlow(model, x4Decl, x4Ref[1], x4Ref[2]);
+
+ var x6Decl = GetPatternDeclarations(tree, "x6").Single();
+ var x6Ref = GetReferences(tree, "x6").ToArray();
+ Assert.Equal(2, x6Ref.Length);
+ AssertContainedInDeclaratorArguments(x6Decl);
+ VerifyModelForDeclarationPatternWithoutDataFlow(model, x6Decl, x6Ref);
+
+ var x7Decl = GetPatternDeclarations(tree, "x7").Single();
+ var x7Ref = GetReferences(tree, "x7").ToArray();
+ Assert.Equal(2, x7Ref.Length);
+ AssertContainedInDeclaratorArguments(x7Decl);
+ VerifyModelForDeclarationPatternWithoutDataFlow(model, x7Decl, x7Ref[0]);
+ VerifyNotAPatternLocal(model, x7Ref[1]);
+
+ var x8Decl = GetPatternDeclarations(tree, "x8").Single();
+ var x8Ref = GetReferences(tree, "x8").ToArray();
+ Assert.Equal(3, x8Ref.Length);
+ AssertContainedInDeclaratorArguments(x8Decl);
+ VerifyModelForDeclarationPatternWithoutDataFlow(model, x8Decl, x8Ref[0], x8Ref[1]);
+ VerifyNotInScope(model, x8Ref[2]);
+
+ var x9Decl = GetPatternDeclarations(tree, "x9").ToArray();
+ var x9Ref = GetReferences(tree, "x9").ToArray();
+ Assert.Equal(2, x9Decl.Length);
+ Assert.Equal(4, x9Ref.Length);
+ AssertContainedInDeclaratorArguments(x9Decl);
+ VerifyModelForDeclarationPatternWithoutDataFlow(model, x9Decl[0], x9Ref[0], x9Ref[1]);
+ VerifyModelForDeclarationPatternWithoutDataFlow(model, x9Decl[1], x9Ref[2], x9Ref[3]);
+
+ var y10Ref = GetReferences(tree, "y10").ToArray();
+ Assert.Equal(2, y10Ref.Length);
+ VerifyNotInScope(model, y10Ref[0]);
+ VerifyNotAPatternLocal(model, y10Ref[1]);
+
+ var y12Ref = GetReferences(tree, "y12").Single();
+ VerifyNotInScope(model, y12Ref);
+
+ var x14Decl = GetPatternDeclarations(tree, "x14").ToArray();
+ var x14Ref = GetReferences(tree, "x14").ToArray();
+ Assert.Equal(2, x14Decl.Length);
+ Assert.Equal(2, x14Ref.Length);
+ AssertContainedInDeclaratorArguments(x14Decl);
+ VerifyModelForDeclarationPatternWithoutDataFlow(model, x14Decl[0], x14Ref);
+ VerifyModelForDeclarationPatternDuplicateInSameScope(model, x14Decl[1]);
+ }
+
+ [Fact]
+ public void Scope_DeclaratorArguments_09()
+ {
+ var source =
+@"
+public class X
+{
+ public static void Main()
+ {
+ }
+
+ bool Dummy(params object[] x) {return true;}
+
+ void Test4()
+ {
+ for (bool d, x4(
+ Dummy(true is var x4 && x4)
+ );;)
+ {}
+ }
+
+ void Test7()
+ {
+ for (bool x7 = true, b(
+ Dummy(true is var x7 && x7)
+ );;)
+ {}
+ }
+
+ void Test8()
+ {
+ for (bool d,b1(Dummy(true is var x8 && x8)],
+ b2(Dummy(true is var x8 && x8));
+ Dummy(true is var x8 && x8);
+ Dummy(true is var x8 && x8))
+ {}
+ }
+
+ void Test9()
+ {
+ for (bool b = x9,
+ b2(Dummy(true is var x9 && x9));
+ Dummy(true is var x9 && x9);
+ Dummy(true is var x9 && x9))
+ {}
+ }
+}
+";
+ var compilation = CreateCompilationWithMscorlib45(source, options: TestOptions.DebugExe, parseOptions: TestOptions.Regular);
+ int[] exclude = new int[] { (int)ErrorCode.ERR_BadVarDecl,
+ (int)ErrorCode.ERR_SyntaxError,
+ (int)ErrorCode.ERR_UnexpectedToken,
+ (int)ErrorCode.WRN_UnreferencedVar,
+ (int)ErrorCode.ERR_CloseParenExpected
+ };
+
+ compilation.GetDiagnostics().Where(d => !exclude.Contains(d.Code)).Verify(
+ // (13,32): error CS0128: A local variable or function named 'x4' is already defined in this scope
+ // Dummy(true is var x4 && x4)
+ Diagnostic(ErrorCode.ERR_LocalDuplicate, "x4").WithArguments("x4").WithLocation(13, 32),
+ // (21,32): error CS0128: A local variable or function named 'x7' is already defined in this scope
+ // Dummy(true is var x7 && x7)
+ Diagnostic(ErrorCode.ERR_LocalDuplicate, "x7").WithArguments("x7").WithLocation(21, 32),
+ // (20,19): warning CS0219: The variable 'x7' is assigned but its value is never used
+ // for (bool x7 = true, b(
+ Diagnostic(ErrorCode.WRN_UnreferencedVarAssg, "x7").WithArguments("x7").WithLocation(20, 19),
+ // (29,37): error CS0128: A local variable or function named 'x8' is already defined in this scope
+ // b2(Dummy(true is var x8 && x8));
+ Diagnostic(ErrorCode.ERR_LocalDuplicate, "x8").WithArguments("x8").WithLocation(29, 37),
+ // (30,32): error CS0136: A local or parameter named 'x8' cannot be declared in this scope because that name is used in an enclosing local scope to define a local or parameter
+ // Dummy(true is var x8 && x8);
+ Diagnostic(ErrorCode.ERR_LocalIllegallyOverrides, "x8").WithArguments("x8").WithLocation(30, 32),
+ // (31,32): error CS0136: A local or parameter named 'x8' cannot be declared in this scope because that name is used in an enclosing local scope to define a local or parameter
+ // Dummy(true is var x8 && x8))
+ Diagnostic(ErrorCode.ERR_LocalIllegallyOverrides, "x8").WithArguments("x8").WithLocation(31, 32),
+ // (37,23): error CS0841: Cannot use local variable 'x9' before it is declared
+ // for (bool b = x9,
+ Diagnostic(ErrorCode.ERR_VariableUsedBeforeDeclaration, "x9").WithArguments("x9").WithLocation(37, 23),
+ // (39,32): error CS0136: A local or parameter named 'x9' cannot be declared in this scope because that name is used in an enclosing local scope to define a local or parameter
+ // Dummy(true is var x9 && x9);
+ Diagnostic(ErrorCode.ERR_LocalIllegallyOverrides, "x9").WithArguments("x9").WithLocation(39, 32),
+ // (40,32): error CS0136: A local or parameter named 'x9' cannot be declared in this scope because that name is used in an enclosing local scope to define a local or parameter
+ // Dummy(true is var x9 && x9))
+ Diagnostic(ErrorCode.ERR_LocalIllegallyOverrides, "x9").WithArguments("x9").WithLocation(40, 32)
+ );
+
+ var tree = compilation.SyntaxTrees.Single();
+ var model = compilation.GetSemanticModel(tree);
+
+ var x4Decl = GetPatternDeclarations(tree, "x4").Single();
+ var x4Ref = GetReferences(tree, "x4").Single();
+ AssertContainedInDeclaratorArguments(x4Decl);
+ VerifyModelForDeclarationPatternDuplicateInSameScope(model, x4Decl);
+ VerifyNotAPatternLocal(model, x4Ref);
+
+ var x7Decl = GetPatternDeclarations(tree, "x7").Single();
+ var x7Ref = GetReferences(tree, "x7").Single();
+ AssertContainedInDeclaratorArguments(x7Decl);
+ VerifyModelForDeclarationPatternDuplicateInSameScope(model, x7Decl);
+ VerifyNotAPatternLocal(model, x7Ref);
+
+ var x8Decl = GetPatternDeclarations(tree, "x8").ToArray();
+ var x8Ref = GetReferences(tree, "x8").ToArray();
+ Assert.Equal(4, x8Decl.Length);
+ Assert.Equal(4, x8Ref.Length);
+ AssertContainedInDeclaratorArguments(x8Decl[0]);
+ AssertContainedInDeclaratorArguments(x8Decl[1]);
+ VerifyModelForDeclarationPatternWithoutDataFlow(model, x8Decl[0], x8Ref[0], x8Ref[1]);
+ VerifyModelForDeclarationPatternDuplicateInSameScope(model, x8Decl[1]);
+ VerifyModelForDeclarationPattern(model, x8Decl[2], x8Ref[2]);
+ VerifyModelForDeclarationPattern(model, x8Decl[3], x8Ref[3]);
+
+ var x9Decl = GetPatternDeclarations(tree, "x9").ToArray();
+ var x9Ref = GetReferences(tree, "x9").ToArray();
+ Assert.Equal(3, x9Decl.Length);
+ Assert.Equal(4, x9Ref.Length);
+ AssertContainedInDeclaratorArguments(x9Decl[0]);
+ VerifyModelForDeclarationPatternWithoutDataFlow(model, x9Decl[0], x9Ref[0], x9Ref[1]);
+ VerifyModelForDeclarationPattern(model, x9Decl[1], x9Ref[2]);
+ VerifyModelForDeclarationPattern(model, x9Decl[2], x9Ref[3]);
+ }
+
+ [Fact]
+ public void Scope_DeclaratorArguments_10()
+ {
+ var source =
+@"
+public class X
+{
+ public static void Main()
+ {
+ }
+
+ System.IDisposable Dummy(params object[] x) {return null;}
+
+ void Test1()
+ {
+ using (var d,e(Dummy(true is var x1, x1)))
+ {
+ Dummy(x1);
+ }
+ }
+
+ void Test2()
+ {
+ using (var d,e(Dummy(true is var x2, x2)))
+ Dummy(x2);
+ }
+
+ void Test4()
+ {
+ var x4 = 11;
+ Dummy(x4);
+
+ using (var d,e(Dummy(true is var x4, x4)))
+ Dummy(x4);
+ }
+
+ void Test6()
+ {
+ using (var d,e(Dummy(x6 && true is var x6)))
+ Dummy(x6);
+ }
+
+ void Test7()
+ {
+ using (var d,e(Dummy(true is var x7 && x7)))
+ {
+ var x7 = 12;
+ Dummy(x7);
+ }
+ }
+
+ void Test8()
+ {
+ using (var d,e(Dummy(true is var x8, x8)))
+ Dummy(x8);
+
+ System.Console.WriteLine(x8);
+ }
+
+ void Test9()
+ {
+ using (var d,a(Dummy(true is var x9, x9)))
+ {
+ Dummy(x9);
+ using (var e,b(Dummy(true is var x9, x9))) // 2
+ Dummy(x9);
+ }
+ }
+
+ void Test10()
+ {
+ using (var d,e(Dummy(y10 is var x10, x10)))
+ {
+ var y10 = 12;
+ Dummy(y10);
+ }
+ }
+
+ //void Test11()
+ //{
+ // using (var d,e(Dummy(y11 is var x11, x11)))
+ // {
+ // let y11 = 12;
+ // Dummy(y11);
+ // }
+ //}
+
+ void Test12()
+ {
+ using (var d,e(Dummy(y12 is var x12, x12)))
+ var y12 = 12;
+ }
+
+ //void Test13()
+ //{
+ // using (var d,e(Dummy(y13 is var x13, x13)))
+ // let y13 = 12;
+ //}
+
+ void Test14()
+ {
+ using (var d,e(Dummy(1 is var x14,
+ 2 is var x14,
+ x14)))
+ {
+ Dummy(x14);
+ }
+ }
+}
+";
+ var compilation = CreateCompilationWithMscorlib45(source, options: TestOptions.DebugExe, parseOptions: TestOptions.Regular);
+ int[] exclude = new int[] { (int)ErrorCode.ERR_BadVarDecl,
+ (int)ErrorCode.ERR_SyntaxError,
+ (int)ErrorCode.ERR_UnexpectedToken,
+ (int)ErrorCode.WRN_UnreferencedVar,
+ (int)ErrorCode.ERR_ImplicitlyTypedVariableMultipleDeclarator,
+ (int)ErrorCode.ERR_FixedMustInit,
+ (int)ErrorCode.ERR_ImplicitlyTypedVariableWithNoInitializer,
+ (int)ErrorCode.ERR_UseDefViolation
+ };
+
+ compilation.GetDiagnostics().Where(d => !exclude.Contains(d.Code)).Verify(
+ // (87,13): error CS1023: Embedded statement cannot be a declaration or labeled statement
+ // var y12 = 12;
+ Diagnostic(ErrorCode.ERR_BadEmbeddedStmt, "var y12 = 12;").WithLocation(87, 13),
+ // (29,42): error CS0136: A local or parameter named 'x4' cannot be declared in this scope because that name is used in an enclosing local scope to define a local or parameter
+ // using (var d,e(Dummy(true is var x4, x4)))
+ Diagnostic(ErrorCode.ERR_LocalIllegallyOverrides, "x4").WithArguments("x4").WithLocation(29, 42),
+ // (35,30): error CS0841: Cannot use local variable 'x6' before it is declared
+ // using (var d,e(Dummy(x6 && true is var x6)))
+ Diagnostic(ErrorCode.ERR_VariableUsedBeforeDeclaration, "x6").WithArguments("x6").WithLocation(35, 30),
+ // (43,17): error CS0136: A local or parameter named 'x7' cannot be declared in this scope because that name is used in an enclosing local scope to define a local or parameter
+ // var x7 = 12;
+ Diagnostic(ErrorCode.ERR_LocalIllegallyOverrides, "x7").WithArguments("x7").WithLocation(43, 17),
+ // (53,34): error CS0103: The name 'x8' does not exist in the current context
+ // System.Console.WriteLine(x8);
+ Diagnostic(ErrorCode.ERR_NameNotInContext, "x8").WithArguments("x8").WithLocation(53, 34),
+ // (61,46): error CS0136: A local or parameter named 'x9' cannot be declared in this scope because that name is used in an enclosing local scope to define a local or parameter
+ // using (var e,b(Dummy(true is var x9, x9))) // 2
+ Diagnostic(ErrorCode.ERR_LocalIllegallyOverrides, "x9").WithArguments("x9").WithLocation(61, 46),
+ // (68,30): error CS0103: The name 'y10' does not exist in the current context
+ // using (var d,e(Dummy(y10 is var x10, x10)))
+ Diagnostic(ErrorCode.ERR_NameNotInContext, "y10").WithArguments("y10").WithLocation(68, 30),
+ // (86,30): error CS0103: The name 'y12' does not exist in the current context
+ // using (var d,e(Dummy(y12 is var x12, x12)))
+ Diagnostic(ErrorCode.ERR_NameNotInContext, "y12").WithArguments("y12").WithLocation(86, 30),
+ // (87,17): warning CS0219: The variable 'y12' is assigned but its value is never used
+ // var y12 = 12;
+ Diagnostic(ErrorCode.WRN_UnreferencedVarAssg, "y12").WithArguments("y12").WithLocation(87, 17),
+ // (99,39): error CS0128: A local variable or function named 'x14' is already defined in this scope
+ // 2 is var x14,
+ Diagnostic(ErrorCode.ERR_LocalDuplicate, "x14").WithArguments("x14").WithLocation(99, 39)
+ );
+
+ var tree = compilation.SyntaxTrees.Single();
+ var model = compilation.GetSemanticModel(tree);
+
+ var x1Decl = GetPatternDeclarations(tree, "x1").Single();
+ var x1Ref = GetReferences(tree, "x1").ToArray();
+ Assert.Equal(2, x1Ref.Length);
+ AssertContainedInDeclaratorArguments(x1Decl);
+ VerifyModelForDeclarationPatternWithoutDataFlow(model, x1Decl, x1Ref);
+
+ var x2Decl = GetPatternDeclarations(tree, "x2").Single();
+ var x2Ref = GetReferences(tree, "x2").ToArray();
+ Assert.Equal(2, x2Ref.Length);
+ AssertContainedInDeclaratorArguments(x2Decl);
+ VerifyModelForDeclarationPatternWithoutDataFlow(model, x2Decl, x2Ref);
+
+ var x4Decl = GetPatternDeclarations(tree, "x4").Single();
+ var x4Ref = GetReferences(tree, "x4").ToArray();
+ Assert.Equal(3, x4Ref.Length);
+ AssertContainedInDeclaratorArguments(x4Decl);
+ VerifyNotAPatternLocal(model, x4Ref[0]);
+ VerifyModelForDeclarationPatternWithoutDataFlow(model, x4Decl, x4Ref[1], x4Ref[2]);
+
+ var x6Decl = GetPatternDeclarations(tree, "x6").Single();
+ var x6Ref = GetReferences(tree, "x6").ToArray();
+ Assert.Equal(2, x6Ref.Length);
+ AssertContainedInDeclaratorArguments(x6Decl);
+ VerifyModelForDeclarationPatternWithoutDataFlow(model, x6Decl, x6Ref);
+
+ var x7Decl = GetPatternDeclarations(tree, "x7").Single();
+ var x7Ref = GetReferences(tree, "x7").ToArray();
+ Assert.Equal(2, x7Ref.Length);
+ AssertContainedInDeclaratorArguments(x7Decl);
+ VerifyModelForDeclarationPatternWithoutDataFlow(model, x7Decl, x7Ref[0]);
+ VerifyNotAPatternLocal(model, x7Ref[1]);
+
+ var x8Decl = GetPatternDeclarations(tree, "x8").Single();
+ var x8Ref = GetReferences(tree, "x8").ToArray();
+ Assert.Equal(3, x8Ref.Length);
+ AssertContainedInDeclaratorArguments(x8Decl);
+ VerifyModelForDeclarationPatternWithoutDataFlow(model, x8Decl, x8Ref[0], x8Ref[1]);
+ VerifyNotInScope(model, x8Ref[2]);
+
+ var x9Decl = GetPatternDeclarations(tree, "x9").ToArray();
+ var x9Ref = GetReferences(tree, "x9").ToArray();
+ Assert.Equal(2, x9Decl.Length);
+ Assert.Equal(4, x9Ref.Length);
+ AssertContainedInDeclaratorArguments(x9Decl);
+ VerifyModelForDeclarationPatternWithoutDataFlow(model, x9Decl[0], x9Ref[0], x9Ref[1]);
+ VerifyModelForDeclarationPatternWithoutDataFlow(model, x9Decl[1], x9Ref[2], x9Ref[3]);
+
+ var x10Decl = GetPatternDeclarations(tree, "x10").Single();
+ var x10Ref = GetReferences(tree, "x10").Single();
+ AssertContainedInDeclaratorArguments(x10Decl);
+ VerifyModelForDeclarationPatternWithoutDataFlow(model, x10Decl, x10Ref);
+
+ var y10Ref = GetReferences(tree, "y10").ToArray();
+ Assert.Equal(2, y10Ref.Length);
+ VerifyNotInScope(model, y10Ref[0]);
+ VerifyNotAPatternLocal(model, y10Ref[1]);
+
+ var y12Ref = GetReferences(tree, "y12").Single();
+ VerifyNotInScope(model, y12Ref);
+
+ var x14Decl = GetPatternDeclarations(tree, "x14").ToArray();
+ var x14Ref = GetReferences(tree, "x14").ToArray();
+ Assert.Equal(2, x14Decl.Length);
+ Assert.Equal(2, x14Ref.Length);
+ AssertContainedInDeclaratorArguments(x14Decl);
+ VerifyModelForDeclarationPatternWithoutDataFlow(model, x14Decl[0], x14Ref);
+ VerifyModelForDeclarationPatternDuplicateInSameScope(model, x14Decl[1]);
+ }
+
+ [Fact]
+ public void Scope_DeclaratorArguments_11()
+ {
+ var source =
+@"
+public class X
+{
+ public static void Main()
+ {
+ }
+
+ System.IDisposable Dummy(params object[] x) {return null;}
+
+ void Test1()
+ {
+ using (var d,x1(Dummy(true is var x1, x1)))
+ {
+ Dummy(x1);
+ }
+ }
+
+ void Test2()
+ {
+ using (System.IDisposable d,x2(Dummy(true is var x2, x2)))
+ {
+ Dummy(x2);
+ }
+ }
+}
+";
+ var compilation = CreateCompilationWithMscorlib45(source, options: TestOptions.DebugExe, parseOptions: TestOptions.Regular);
+ int[] exclude = new int[] { (int)ErrorCode.ERR_BadVarDecl,
+ (int)ErrorCode.ERR_SyntaxError,
+ (int)ErrorCode.WRN_UnreferencedVar,
+ (int)ErrorCode.ERR_ImplicitlyTypedVariableMultipleDeclarator,
+ (int)ErrorCode.ERR_FixedMustInit,
+ (int)ErrorCode.ERR_ImplicitlyTypedVariableWithNoInitializer,
+ (int)ErrorCode.ERR_UseDefViolation
+ };
+
+ compilation.GetDiagnostics().Where(d => !exclude.Contains(d.Code)).Verify(
+ // (12,43): error CS0128: A local variable or function named 'x1' is already defined in this scope
+ // using (var d,x1(Dummy(true is var x1, x1)))
+ Diagnostic(ErrorCode.ERR_LocalDuplicate, "x1").WithArguments("x1").WithLocation(12, 43),
+ // (20,58): error CS0128: A local variable or function named 'x2' is already defined in this scope
+ // using (System.IDisposable d,x2(Dummy(true is var x2, x2)))
+ Diagnostic(ErrorCode.ERR_LocalDuplicate, "x2").WithArguments("x2").WithLocation(20, 58)
+ );
+
+ var tree = compilation.SyntaxTrees.Single();
+ var model = compilation.GetSemanticModel(tree);
+
+ var x1Decl = GetPatternDeclarations(tree, "x1").Single();
+ var x1Ref = GetReferences(tree, "x1").ToArray();
+ Assert.Equal(2, x1Ref.Length);
+ AssertContainedInDeclaratorArguments(x1Decl);
+ VerifyModelForDeclarationPatternDuplicateInSameScope(model, x1Decl);
+ VerifyNotAPatternLocal(model, x1Ref[0]);
+ VerifyNotAPatternLocal(model, x1Ref[1]);
+
+ var x2Decl = GetPatternDeclarations(tree, "x2").Single();
+ var x2Ref = GetReferences(tree, "x2").ToArray();
+ AssertContainedInDeclaratorArguments(x2Decl);
+ Assert.Equal(2, x2Ref.Length);
+ VerifyModelForDeclarationPatternDuplicateInSameScope(model, x2Decl);
+ VerifyNotAPatternLocal(model, x2Ref[0]);
+ VerifyNotAPatternLocal(model, x2Ref[1]);
+ }
+
+ [Fact]
+ public void Scope_DeclaratorArguments_12()
+ {
+ var source =
+@"
+public class X
+{
+ public static void Main()
+ {
+ }
+
+ System.IDisposable Dummy(params object[] x) {return null;}
+
+ void Test1()
+ {
+ using (System.IDisposable d,e(Dummy(true is var x1, x1)],
+ x1 = Dummy(x1))
+ {
+ Dummy(x1);
+ }
+ }
+
+ void Test2()
+ {
+ using (System.IDisposable d1,e(Dummy(true is var x2, x2)],
+ d2(Dummy(true is var x2, x2)))
+ {
+ Dummy(x2);
+ }
+ }
+
+ void Test3()
+ {
+ using (System.IDisposable d1,e(Dummy(true is var x3, x3)],
+ d2 = Dummy(x3))
+ {
+ Dummy(x3);
+ }
+ }
+
+ void Test4()
+ {
+ using (System.IDisposable d1 = Dummy(x4),
+ d2(Dummy(true is var x4, x4)))
+ {
+ Dummy(x4);
+ }
+ }
+}
+";
+ var compilation = CreateCompilationWithMscorlib45(source, options: TestOptions.DebugExe, parseOptions: TestOptions.Regular);
+ int[] exclude = new int[] { (int)ErrorCode.ERR_BadVarDecl,
+ (int)ErrorCode.ERR_SyntaxError,
+ (int)ErrorCode.ERR_UnexpectedToken,
+ (int)ErrorCode.WRN_UnreferencedVar,
+ (int)ErrorCode.ERR_FixedMustInit,
+ (int)ErrorCode.ERR_UseDefViolation,
+ (int)ErrorCode.ERR_CloseParenExpected
+ };
+
+ compilation.GetDiagnostics().Where(d => !exclude.Contains(d.Code)).Verify(
+ // (13,35): error CS0128: A local variable or function named 'x1' is already defined in this scope
+ // x1 = Dummy(x1))
+ Diagnostic(ErrorCode.ERR_LocalDuplicate, "x1").WithArguments("x1").WithLocation(13, 35),
+ // (22,58): error CS0128: A local variable or function named 'x2' is already defined in this scope
+ // d2(Dummy(true is var x2, x2)))
+ Diagnostic(ErrorCode.ERR_LocalDuplicate, "x2").WithArguments("x2").WithLocation(22, 58),
+ // (39,46): error CS0841: Cannot use local variable 'x4' before it is declared
+ // using (System.IDisposable d1 = Dummy(x4),
+ Diagnostic(ErrorCode.ERR_VariableUsedBeforeDeclaration, "x4").WithArguments("x4").WithLocation(39, 46)
+ );
+
+ var tree = compilation.SyntaxTrees.Single();
+ var model = compilation.GetSemanticModel(tree);
+
+ var x1Decl = GetPatternDeclarations(tree, "x1").Single();
+ var x1Ref = GetReferences(tree, "x1").ToArray();
+ Assert.Equal(3, x1Ref.Length);
+ AssertContainedInDeclaratorArguments(x1Decl);
+ VerifyModelForDeclarationPatternWithoutDataFlow(model, x1Decl, x1Ref);
+
+ var x2Decl = GetPatternDeclarations(tree, "x2").ToArray();
+ var x2Ref = GetReferences(tree, "x2").ToArray();
+ Assert.Equal(2, x2Decl.Length);
+ Assert.Equal(3, x2Ref.Length);
+ AssertContainedInDeclaratorArguments(x2Decl);
+ VerifyModelForDeclarationPatternWithoutDataFlow(model, x2Decl[0], x2Ref);
+ VerifyModelForDeclarationPatternDuplicateInSameScope(model, x2Decl[1]);
+
+ var x3Decl = GetPatternDeclarations(tree, "x3").Single();
+ var x3Ref = GetReferences(tree, "x3").ToArray();
+ Assert.Equal(3, x3Ref.Length);
+ AssertContainedInDeclaratorArguments(x3Decl);
+ VerifyModelForDeclarationPatternWithoutDataFlow(model, x3Decl, x3Ref);
+
+ var x4Decl = GetPatternDeclarations(tree, "x4").Single();
+ var x4Ref = GetReferences(tree, "x4").ToArray();
+ Assert.Equal(3, x4Ref.Length);
+ AssertContainedInDeclaratorArguments(x4Decl);
+ VerifyModelForDeclarationPatternWithoutDataFlow(model, x4Decl, x4Ref);
+ }
+
+ [Fact]
+ public void Scope_DeclaratorArguments_13()
+ {
+ var source =
+@"
+public unsafe class X
+{
+ public static void Main()
+ {
+ }
+
+ int[] Dummy(params object[] x) {return null;}
+
+ void Test1()
+ {
+ fixed (int* p,e(Dummy(true is var x1 && x1)))
+ {
+ Dummy(x1);
+ }
+ }
+
+ void Test2()
+ {
+ fixed (int* p,e(Dummy(true is var x2 && x2)))
+ Dummy(x2);
+ }
+
+ void Test4()
+ {
+ var x4 = 11;
+ Dummy(x4);
+
+ fixed (int* p,e(Dummy(true is var x4 && x4)))
+ Dummy(x4);
+ }
+
+ void Test6()
+ {
+ fixed (int* p,e(Dummy(x6 && true is var x6)))
+ Dummy(x6);
+ }
+
+ void Test7()
+ {
+ fixed (int* p,e(Dummy(true is var x7 && x7)))
+ {
+ var x7 = 12;
+ Dummy(x7);
+ }
+ }
+
+ void Test8()
+ {
+ fixed (int* p,e(Dummy(true is var x8 && x8)))
+ Dummy(x8);
+
+ System.Console.WriteLine(x8);
+ }
+
+ void Test9()
+ {
+ fixed (int* p1,a(Dummy(true is var x9 && x9)))
+ {
+ Dummy(x9);
+ fixed (int* p2,b(Dummy(true is var x9 && x9))) // 2
+ Dummy(x9);
+ }
+ }
+
+ void Test10()
+ {
+ fixed (int* p,e(Dummy(y10 is var x10)))
+ {
+ var y10 = 12;
+ Dummy(y10);
+ }
+ }
+
+ //void Test11()
+ //{
+ // fixed (int* p,e(Dummy(y11 is var x11)))
+ // {
+ // let y11 = 12;
+ // Dummy(y11);
+ // }
+ //}
+
+ void Test12()
+ {
+ fixed (int* p,e(Dummy(y12 is var x12)))
+ var y12 = 12;
+ }
+
+ //void Test13()
+ //{
+ // fixed (int* p,e(Dummy(y13 is var x13)))
+ // let y13 = 12;
+ //}
+
+ void Test14()
+ {
+ fixed (int* p,e(Dummy(1 is var x14,
+ 2 is var x14,
+ x14)))
+ {
+ Dummy(x14);
+ }
+ }
+}
+";
+ var compilation = CreateCompilationWithMscorlib45(source, options: TestOptions.DebugExe.WithAllowUnsafe(true), parseOptions: TestOptions.Regular);
+ int[] exclude = new int[] { (int)ErrorCode.ERR_BadVarDecl,
+ (int)ErrorCode.ERR_SyntaxError,
+ (int)ErrorCode.ERR_UnexpectedToken,
+ (int)ErrorCode.WRN_UnreferencedVar,
+ (int)ErrorCode.ERR_FixedMustInit,
+ (int)ErrorCode.ERR_UseDefViolation
+ };
+
+ compilation.GetDiagnostics().Where(d => !exclude.Contains(d.Code)).Verify(
+ // (87,13): error CS1023: Embedded statement cannot be a declaration or labeled statement
+ // var y12 = 12;
+ Diagnostic(ErrorCode.ERR_BadEmbeddedStmt, "var y12 = 12;").WithLocation(87, 13),
+ // (29,43): error CS0136: A local or parameter named 'x4' cannot be declared in this scope because that name is used in an enclosing local scope to define a local or parameter
+ // fixed (int* p,e(Dummy(true is var x4 && x4)))
+ Diagnostic(ErrorCode.ERR_LocalIllegallyOverrides, "x4").WithArguments("x4").WithLocation(29, 43),
+ // (35,31): error CS0841: Cannot use local variable 'x6' before it is declared
+ // fixed (int* p,e(Dummy(x6 && true is var x6)))
+ Diagnostic(ErrorCode.ERR_VariableUsedBeforeDeclaration, "x6").WithArguments("x6").WithLocation(35, 31),
+ // (43,17): error CS0136: A local or parameter named 'x7' cannot be declared in this scope because that name is used in an enclosing local scope to define a local or parameter
+ // var x7 = 12;
+ Diagnostic(ErrorCode.ERR_LocalIllegallyOverrides, "x7").WithArguments("x7").WithLocation(43, 17),
+ // (53,34): error CS0103: The name 'x8' does not exist in the current context
+ // System.Console.WriteLine(x8);
+ Diagnostic(ErrorCode.ERR_NameNotInContext, "x8").WithArguments("x8").WithLocation(53, 34),
+ // (61,48): error CS0136: A local or parameter named 'x9' cannot be declared in this scope because that name is used in an enclosing local scope to define a local or parameter
+ // fixed (int* p2,b(Dummy(true is var x9 && x9))) // 2
+ Diagnostic(ErrorCode.ERR_LocalIllegallyOverrides, "x9").WithArguments("x9").WithLocation(61, 48),
+ // (68,31): error CS0103: The name 'y10' does not exist in the current context
+ // fixed (int* p,e(Dummy(y10 is var x10)))
+ Diagnostic(ErrorCode.ERR_NameNotInContext, "y10").WithArguments("y10").WithLocation(68, 31),
+ // (86,31): error CS0103: The name 'y12' does not exist in the current context
+ // fixed (int* p,e(Dummy(y12 is var x12)))
+ Diagnostic(ErrorCode.ERR_NameNotInContext, "y12").WithArguments("y12").WithLocation(86, 31),
+ // (87,17): warning CS0219: The variable 'y12' is assigned but its value is never used
+ // var y12 = 12;
+ Diagnostic(ErrorCode.WRN_UnreferencedVarAssg, "y12").WithArguments("y12").WithLocation(87, 17),
+ // (99,40): error CS0128: A local variable or function named 'x14' is already defined in this scope
+ // 2 is var x14,
+ Diagnostic(ErrorCode.ERR_LocalDuplicate, "x14").WithArguments("x14").WithLocation(99, 40)
+ );
+
+ var tree = compilation.SyntaxTrees.Single();
+ var model = compilation.GetSemanticModel(tree);
+
+ var x1Decl = GetPatternDeclarations(tree, "x1").Single();
+ var x1Ref = GetReferences(tree, "x1").ToArray();
+ Assert.Equal(2, x1Ref.Length);
+ AssertContainedInDeclaratorArguments(x1Decl);
+ VerifyModelForDeclarationPatternWithoutDataFlow(model, x1Decl, x1Ref);
+
+ var x2Decl = GetPatternDeclarations(tree, "x2").Single();
+ var x2Ref = GetReferences(tree, "x2").ToArray();
+ Assert.Equal(2, x2Ref.Length);
+ AssertContainedInDeclaratorArguments(x2Decl);
+ VerifyModelForDeclarationPatternWithoutDataFlow(model, x2Decl, x2Ref);
+
+ var x4Decl = GetPatternDeclarations(tree, "x4").Single();
+ var x4Ref = GetReferences(tree, "x4").ToArray();
+ Assert.Equal(3, x4Ref.Length);
+ AssertContainedInDeclaratorArguments(x4Decl);
+ VerifyNotAPatternLocal(model, x4Ref[0]);
+ VerifyModelForDeclarationPatternWithoutDataFlow(model, x4Decl, x4Ref[1], x4Ref[2]);
+
+ var x6Decl = GetPatternDeclarations(tree, "x6").Single();
+ var x6Ref = GetReferences(tree, "x6").ToArray();
+ Assert.Equal(2, x6Ref.Length);
+ AssertContainedInDeclaratorArguments(x6Decl);
+ VerifyModelForDeclarationPatternWithoutDataFlow(model, x6Decl, x6Ref);
+
+ var x7Decl = GetPatternDeclarations(tree, "x7").Single();
+ var x7Ref = GetReferences(tree, "x7").ToArray();
+ Assert.Equal(2, x7Ref.Length);
+ AssertContainedInDeclaratorArguments(x7Decl);
+ VerifyModelForDeclarationPatternWithoutDataFlow(model, x7Decl, x7Ref[0]);
+ VerifyNotAPatternLocal(model, x7Ref[1]);
+
+ var x8Decl = GetPatternDeclarations(tree, "x8").Single();
+ var x8Ref = GetReferences(tree, "x8").ToArray();
+ Assert.Equal(3, x8Ref.Length);
+ AssertContainedInDeclaratorArguments(x8Decl);
+ VerifyModelForDeclarationPatternWithoutDataFlow(model, x8Decl, x8Ref[0], x8Ref[1]);
+ VerifyNotInScope(model, x8Ref[2]);
+
+ var x9Decl = GetPatternDeclarations(tree, "x9").ToArray();
+ var x9Ref = GetReferences(tree, "x9").ToArray();
+ Assert.Equal(2, x9Decl.Length);
+ Assert.Equal(4, x9Ref.Length);
+ AssertContainedInDeclaratorArguments(x9Decl);
+ VerifyModelForDeclarationPatternWithoutDataFlow(model, x9Decl[0], x9Ref[0], x9Ref[1]);
+ VerifyModelForDeclarationPatternWithoutDataFlow(model, x9Decl[1], x9Ref[2], x9Ref[3]);
+
+ var y10Ref = GetReferences(tree, "y10").ToArray();
+ Assert.Equal(2, y10Ref.Length);
+ VerifyNotInScope(model, y10Ref[0]);
+ VerifyNotAPatternLocal(model, y10Ref[1]);
+
+ var y12Ref = GetReferences(tree, "y12").Single();
+ VerifyNotInScope(model, y12Ref);
+
+ var x14Decl = GetPatternDeclarations(tree, "x14").ToArray();
+ var x14Ref = GetReferences(tree, "x14").ToArray();
+ Assert.Equal(2, x14Decl.Length);
+ Assert.Equal(2, x14Ref.Length);
+ AssertContainedInDeclaratorArguments(x14Decl);
+ VerifyModelForDeclarationPatternWithoutDataFlow(model, x14Decl[0], x14Ref);
+ VerifyModelForDeclarationPatternDuplicateInSameScope(model, x14Decl[1]);
+ }
+
+ [Fact]
+ public void Scope_DeclaratorArguments_14()
+ {
+ var source =
+@"
+public unsafe class X
+{
+ public static void Main()
+ {
+ }
+
+ int[] Dummy(params object[] x) {return null;}
+ int[] Dummy(int* x) {return null;}
+
+ void Test1()
+ {
+ fixed (int* d,x1(
+ Dummy(true is var x1 && x1)))
+ {
+ Dummy(x1);
+ }
+ }
+
+ void Test2()
+ {
+ fixed (int* d,p(Dummy(true is var x2 && x2)],
+ x2 = Dummy())
+ {
+ Dummy(x2);
+ }
+ }
+
+ void Test3()
+ {
+ fixed (int* x3 = Dummy(),
+ p(Dummy(true is var x3 && x3)))
+ {
+ Dummy(x3);
+ }
+ }
+
+ void Test4()
+ {
+ fixed (int* d,p1(Dummy(true is var x4 && x4)],
+ p2(Dummy(true is var x4 && x4)))
+ {
+ Dummy(x4);
+ }
+ }
+}
+";
+ var compilation = CreateCompilationWithMscorlib45(source, options: TestOptions.DebugExe.WithAllowUnsafe(true), parseOptions: TestOptions.Regular);
+ int[] exclude = new int[] { (int)ErrorCode.ERR_BadVarDecl,
+ (int)ErrorCode.ERR_SyntaxError,
+ (int)ErrorCode.ERR_UnexpectedToken,
+ (int)ErrorCode.WRN_UnreferencedVar,
+ (int)ErrorCode.ERR_FixedMustInit,
+ (int)ErrorCode.ERR_UseDefViolation,
+ (int)ErrorCode.ERR_CloseParenExpected
+ };
+
+ compilation.GetDiagnostics().Where(d => !exclude.Contains(d.Code)).Verify(
+ // (14,44): error CS0128: A local variable or function named 'x1' is already defined in this scope
+ // Dummy(true is var x1 && x1)))
+ Diagnostic(ErrorCode.ERR_LocalDuplicate, "x1").WithArguments("x1").WithLocation(14, 44),
+ // (23,21): error CS0128: A local variable or function named 'x2' is already defined in this scope
+ // x2 = Dummy())
+ Diagnostic(ErrorCode.ERR_LocalDuplicate, "x2").WithArguments("x2").WithLocation(23, 21),
+ // (32,43): error CS0128: A local variable or function named 'x3' is already defined in this scope
+ // p(Dummy(true is var x3 && x3)))
+ Diagnostic(ErrorCode.ERR_LocalDuplicate, "x3").WithArguments("x3").WithLocation(32, 43),
+ // (41,44): error CS0128: A local variable or function named 'x4' is already defined in this scope
+ // p2(Dummy(true is var x4 && x4)))
+ Diagnostic(ErrorCode.ERR_LocalDuplicate, "x4").WithArguments("x4").WithLocation(41, 44)
+ );
+
+ var tree = compilation.SyntaxTrees.Single();
+ var model = compilation.GetSemanticModel(tree);
+
+ var x1Decl = GetPatternDeclarations(tree, "x1").Single();
+ var x1Ref = GetReferences(tree, "x1").ToArray();
+ Assert.Equal(2, x1Ref.Length);
+ AssertContainedInDeclaratorArguments(x1Decl);
+ VerifyModelForDeclarationPatternDuplicateInSameScope(model, x1Decl);
+ VerifyNotAPatternLocal(model, x1Ref[0]);
+ VerifyNotAPatternLocal(model, x1Ref[1]);
+
+ var x2Decl = GetPatternDeclarations(tree, "x2").Single();
+ var x2Ref = GetReferences(tree, "x2").ToArray();
+ Assert.Equal(2, x2Ref.Length);
+ AssertContainedInDeclaratorArguments(x2Decl);
+ VerifyModelForDeclarationPatternWithoutDataFlow(model, x2Decl, x2Ref);
+
+ var x3Decl = GetPatternDeclarations(tree, "x3").Single();
+ var x3Ref = GetReferences(tree, "x3").ToArray();
+ Assert.Equal(2, x3Ref.Length);
+ AssertContainedInDeclaratorArguments(x3Decl);
+ VerifyModelForDeclarationPatternDuplicateInSameScope(model, x3Decl);
+ VerifyNotAPatternLocal(model, x3Ref[0]);
+ VerifyNotAPatternLocal(model, x3Ref[1]);
+
+ var x4Decl = GetPatternDeclarations(tree, "x4").ToArray();
+ var x4Ref = GetReferences(tree, "x4").ToArray();
+ Assert.Equal(2, x4Decl.Length);
+ Assert.Equal(3, x4Ref.Length);
+ AssertContainedInDeclaratorArguments(x4Decl);
+ VerifyModelForDeclarationPatternWithoutDataFlow(model, x4Decl[0], x4Ref);
+ VerifyModelForDeclarationPatternDuplicateInSameScope(model, x4Decl[1]);
+ }
+
+ [Fact]
+ public void Scope_DeclaratorArguments_15()
+ {
+ var source =
+@"
+public class X
+{
+ public static void Main()
+ {
+ }
+
+ bool Test3 [3 is var x3 && x3 > 0];
+
+ bool Test4 [x4 && 4 is var x4];
+
+ bool Test5 [51 is var x5 &&
+ 52 is var x5 &&
+ x5 > 0];
+
+ bool Test61 [6 is var x6 && x6 > 0], Test62 [6 is var x6 && x6 > 0];
+
+ bool Test71 [7 is var x7 && x7 > 0];
+ bool Test72 [Dummy(x7, 2)];
+ void Test73() { Dummy(x7, 3); }
+
+ bool Dummy(params object[] x) {return true;}
+}
+";
+ var compilation = CreateCompilationWithMscorlib45(source, options: TestOptions.DebugExe, parseOptions: TestOptions.Regular);
+ int[] exclude = new int[] { (int)ErrorCode.ERR_CStyleArray,
+ (int)ErrorCode.ERR_ArraySizeInDeclaration,
+ (int)ErrorCode.WRN_UnreferencedField
+ };
+
+ compilation.GetDiagnostics().Where(d => !exclude.Contains(d.Code)).Verify(
+ // (20,27): error CS0103: The name 'x7' does not exist in the current context
+ // void Test73() { Dummy(x7, 3); }
+ Diagnostic(ErrorCode.ERR_NameNotInContext, "x7").WithArguments("x7").WithLocation(20, 27)
+ );
+
+ var tree = compilation.SyntaxTrees.Single();
+ var model = compilation.GetSemanticModel(tree);
+
+ var x3Decl = GetPatternDeclarations(tree, "x3").Single();
+ var x3Ref = GetReferences(tree, "x3").Single();
+ AssertContainedInDeclaratorArguments(x3Decl);
+ VerifyModelNotSupported(model, x3Decl, x3Ref);
+
+ var x4Decl = GetPatternDeclarations(tree, "x4").Single();
+ var x4Ref = GetReferences(tree, "x4").Single();
+ AssertContainedInDeclaratorArguments(x4Decl);
+ VerifyModelNotSupported(model, x4Decl, x4Ref);
+
+ var x5Decl = GetPatternDeclarations(tree, "x5").ToArray();
+ var x5Ref = GetReferences(tree, "x5").Single();
+ Assert.Equal(2, x5Decl.Length);
+ AssertContainedInDeclaratorArguments(x5Decl);
+ VerifyModelNotSupported(model, x5Decl[0], x5Ref);
+ VerifyModelNotSupported(model, x5Decl[1]);
+
+ var x6Decl = GetPatternDeclarations(tree, "x6").ToArray();
+ var x6Ref = GetReferences(tree, "x6").ToArray();
+ Assert.Equal(2, x6Decl.Length);
+ Assert.Equal(2, x6Ref.Length);
+ AssertContainedInDeclaratorArguments(x6Decl);
+ VerifyModelNotSupported(model, x6Decl[0], x6Ref[0]);
+ VerifyModelNotSupported(model, x6Decl[1], x6Ref[1]);
+
+ var x7Decl = GetPatternDeclarations(tree, "x7").Single();
+ var x7Ref = GetReferences(tree, "x7").ToArray();
+ Assert.Equal(3, x7Ref.Length);
+ AssertContainedInDeclaratorArguments(x7Decl);
+ VerifyModelNotSupported(model, x7Decl, x7Ref[0]);
+ VerifyNotInScope(model, x7Ref[1]);
+ VerifyNotInScope(model, x7Ref[2]);
+ }
+
+ [Fact]
+ public void Scope_DeclaratorArguments_16()
+ {
+ var source =
+@"
+public unsafe struct X
+{
+ public static void Main()
+ {
+ }
+ fixed
+ bool Test3 [3 is var x3 && x3 > 0];
+ fixed
+ bool Test4 [x4 && 4 is var x4];
+ fixed
+ bool Test5 [51 is var x5 &&
+ 52 is var x5 &&
+ x5 > 0];
+ fixed
+ bool Test61 [6 is var x6 && x6 > 0], Test62 [6 is var x6 && x6 > 0];
+ fixed
+ bool Test71 [7 is var x7 && x7 > 0];
+ fixed
+ bool Test72 [Dummy(x7, 2)];
+ void Test73() { Dummy(x7, 3); }
+
+ bool Dummy(params object[] x) {return true;}
+}
+";
+ var compilation = CreateCompilationWithMscorlib45(source, options: TestOptions.DebugExe.WithAllowUnsafe(true), parseOptions: TestOptions.Regular);
+ int[] exclude = new int[] { (int)ErrorCode.ERR_CStyleArray,
+ (int)ErrorCode.ERR_ArraySizeInDeclaration,
+ (int)ErrorCode.WRN_UnreferencedField,
+ (int)ErrorCode.ERR_NoImplicitConv
+ };
+
+ compilation.GetDiagnostics().Where(d => !exclude.Contains(d.Code)).Verify(
+ // (10,18): error CS0841: Cannot use local variable 'x4' before it is declared
+ // bool Test4 [x4 && 4 is var x4];
+ Diagnostic(ErrorCode.ERR_VariableUsedBeforeDeclaration, "x4").WithArguments("x4").WithLocation(10, 18),
+ // (13,28): error CS0128: A local variable or function named 'x5' is already defined in this scope
+ // 52 is var x5 &&
+ Diagnostic(ErrorCode.ERR_LocalDuplicate, "x5").WithArguments("x5").WithLocation(13, 28),
+ // (20,25): error CS0103: The name 'x7' does not exist in the current context
+ // bool Test72 [Dummy(x7, 2)];
+ Diagnostic(ErrorCode.ERR_NameNotInContext, "x7").WithArguments("x7").WithLocation(20, 25),
+ // (21,27): error CS0103: The name 'x7' does not exist in the current context
+ // void Test73() { Dummy(x7, 3); }
+ Diagnostic(ErrorCode.ERR_NameNotInContext, "x7").WithArguments("x7").WithLocation(21, 27)
+ );
+
+ var tree = compilation.SyntaxTrees.Single();
+ var model = compilation.GetSemanticModel(tree);
+
+ var x3Decl = GetPatternDeclarations(tree, "x3").Single();
+ var x3Ref = GetReferences(tree, "x3").Single();
+ AssertContainedInDeclaratorArguments(x3Decl);
+ VerifyModelNotSupported(model, x3Decl, x3Ref);
+
+ var x4Decl = GetPatternDeclarations(tree, "x4").Single();
+ var x4Ref = GetReferences(tree, "x4").Single();
+ AssertContainedInDeclaratorArguments(x4Decl);
+ VerifyModelNotSupported(model, x4Decl, x4Ref);
+
+ var x5Decl = GetPatternDeclarations(tree, "x5").ToArray();
+ var x5Ref = GetReferences(tree, "x5").Single();
+ Assert.Equal(2, x5Decl.Length);
+ AssertContainedInDeclaratorArguments(x5Decl);
+ VerifyModelNotSupported(model, x5Decl[0], x5Ref);
+ VerifyModelNotSupported(model, x5Decl[1]);
+
+ var x6Decl = GetPatternDeclarations(tree, "x6").ToArray();
+ var x6Ref = GetReferences(tree, "x6").ToArray();
+ Assert.Equal(2, x6Decl.Length);
+ Assert.Equal(2, x6Ref.Length);
+ AssertContainedInDeclaratorArguments(x6Decl);
+ VerifyModelNotSupported(model, x6Decl[0], x6Ref[0]);
+ VerifyModelNotSupported(model, x6Decl[1], x6Ref[1]);
+
+ var x7Decl = GetPatternDeclarations(tree, "x7").Single();
+ var x7Ref = GetReferences(tree, "x7").ToArray();
+ Assert.Equal(3, x7Ref.Length);
+ AssertContainedInDeclaratorArguments(x7Decl);
+ VerifyModelNotSupported(model, x7Decl, x7Ref[0]);
+ VerifyNotInScope(model, x7Ref[1]);
+ VerifyNotInScope(model, x7Ref[2]);
+ }
+
+ [Fact]
+ public void Scope_DeclaratorArguments_17()
+ {
+ var source =
+@"
+public class X
+{
+ public static void Main()
+ {
+ }
+ const
+ bool Test3 [3 is var x3 && x3 > 0];
+ const
+ bool Test4 [x4 && 4 is var x4];
+ const
+ bool Test5 [51 is var x5 &&
+ 52 is var x5 &&
+ x5 > 0];
+ const
+ bool Test61 [6 is var x6 && x6 > 0], Test62 [6 is var x6 && x6 > 0];
+ const
+ bool Test71 [7 is var x7 && x7 > 0];
+ const
+ bool Test72 [Dummy(x7, 2)];
+ void Test73() { Dummy(x7, 3); }
+
+ bool Dummy(params object[] x) {return true;}
+}
+";
+ var compilation = CreateCompilationWithMscorlib45(source, options: TestOptions.DebugExe, parseOptions: TestOptions.Regular);
+ int[] exclude = new int[] { (int)ErrorCode.ERR_CStyleArray,
+ (int)ErrorCode.ERR_ArraySizeInDeclaration
+ };
+
+ compilation.GetDiagnostics().Where(d => !exclude.Contains(d.Code)).Verify(
+ // (21,27): error CS0103: The name 'x7' does not exist in the current context
+ // void Test73() { Dummy(x7, 3); }
+ Diagnostic(ErrorCode.ERR_NameNotInContext, "x7").WithArguments("x7").WithLocation(21, 27)
+ );
+
+ var tree = compilation.SyntaxTrees.Single();
+ var model = compilation.GetSemanticModel(tree);
+
+ var x3Decl = GetPatternDeclarations(tree, "x3").Single();
+ var x3Ref = GetReferences(tree, "x3").Single();
+ AssertContainedInDeclaratorArguments(x3Decl);
+ VerifyModelNotSupported(model, x3Decl, x3Ref);
+
+ var x4Decl = GetPatternDeclarations(tree, "x4").Single();
+ var x4Ref = GetReferences(tree, "x4").Single();
+ AssertContainedInDeclaratorArguments(x4Decl);
+ VerifyModelNotSupported(model, x4Decl, x4Ref);
+
+ var x5Decl = GetPatternDeclarations(tree, "x5").ToArray();
+ var x5Ref = GetReferences(tree, "x5").Single();
+ Assert.Equal(2, x5Decl.Length);
+ AssertContainedInDeclaratorArguments(x5Decl);
+ VerifyModelNotSupported(model, x5Decl[0], x5Ref);
+ VerifyModelNotSupported(model, x5Decl[1]);
+
+ var x6Decl = GetPatternDeclarations(tree, "x6").ToArray();
+ var x6Ref = GetReferences(tree, "x6").ToArray();
+ Assert.Equal(2, x6Decl.Length);
+ Assert.Equal(2, x6Ref.Length);
+ AssertContainedInDeclaratorArguments(x6Decl);
+ VerifyModelNotSupported(model, x6Decl[0], x6Ref[0]);
+ VerifyModelNotSupported(model, x6Decl[1], x6Ref[1]);
+
+ var x7Decl = GetPatternDeclarations(tree, "x7").Single();
+ var x7Ref = GetReferences(tree, "x7").ToArray();
+ Assert.Equal(3, x7Ref.Length);
+ AssertContainedInDeclaratorArguments(x7Decl);
+ VerifyModelNotSupported(model, x7Decl, x7Ref[0]);
+ VerifyNotInScope(model, x7Ref[1]);
+ VerifyNotInScope(model, x7Ref[2]);
+ }
+
+ [Fact]
+ public void Scope_DeclaratorArguments_18()
+ {
+ var source =
+@"
+public class X
+{
+ public static void Main()
+ {
+ }
+ event
+ bool Test3 [3 is var x3 && x3 > 0];
+ event
+ bool Test4 [x4 && 4 is var x4];
+ event
+ bool Test5 [51 is var x5 &&
+ 52 is var x5 &&
+ x5 > 0];
+ event
+ bool Test61 [6 is var x6 && x6 > 0], Test62 [6 is var x6 && x6 > 0];
+ event
+ bool Test71 [7 is var x7 && x7 > 0];
+ event
+ bool Test72 [Dummy(x7, 2)];
+ void Test73() { Dummy(x7, 3); }
+
+ bool Dummy(params object[] x) {return true;}
+}
+";
+ var compilation = CreateCompilationWithMscorlib45(source, options: TestOptions.DebugExe, parseOptions: TestOptions.Regular);
+ int[] exclude = new int[] { (int)ErrorCode.ERR_CStyleArray,
+ (int)ErrorCode.ERR_ArraySizeInDeclaration,
+ (int)ErrorCode.ERR_EventNotDelegate,
+ (int)ErrorCode.WRN_UnreferencedEvent
+ };
+
+ compilation.GetDiagnostics().Where(d => !exclude.Contains(d.Code)).Verify(
+ // (21,27): error CS0103: The name 'x7' does not exist in the current context
+ // void Test73() { Dummy(x7, 3); }
+ Diagnostic(ErrorCode.ERR_NameNotInContext, "x7").WithArguments("x7").WithLocation(21, 27)
+ );
+
+ var tree = compilation.SyntaxTrees.Single();
+ var model = compilation.GetSemanticModel(tree);
+
+ var x3Decl = GetPatternDeclarations(tree, "x3").Single();
+ var x3Ref = GetReferences(tree, "x3").Single();
+ AssertContainedInDeclaratorArguments(x3Decl);
+ VerifyModelNotSupported(model, x3Decl, x3Ref);
+
+ var x4Decl = GetPatternDeclarations(tree, "x4").Single();
+ var x4Ref = GetReferences(tree, "x4").Single();
+ AssertContainedInDeclaratorArguments(x4Decl);
+ VerifyModelNotSupported(model, x4Decl, x4Ref);
+
+ var x5Decl = GetPatternDeclarations(tree, "x5").ToArray();
+ var x5Ref = GetReferences(tree, "x5").Single();
+ Assert.Equal(2, x5Decl.Length);
+ AssertContainedInDeclaratorArguments(x5Decl);
+ VerifyModelNotSupported(model, x5Decl[0], x5Ref);
+ VerifyModelNotSupported(model, x5Decl[1]);
+
+ var x6Decl = GetPatternDeclarations(tree, "x6").ToArray();
+ var x6Ref = GetReferences(tree, "x6").ToArray();
+ Assert.Equal(2, x6Decl.Length);
+ Assert.Equal(2, x6Ref.Length);
+ AssertContainedInDeclaratorArguments(x6Decl);
+ VerifyModelNotSupported(model, x6Decl[0], x6Ref[0]);
+ VerifyModelNotSupported(model, x6Decl[1], x6Ref[1]);
+
+ var x7Decl = GetPatternDeclarations(tree, "x7").Single();
+ var x7Ref = GetReferences(tree, "x7").ToArray();
+ Assert.Equal(3, x7Ref.Length);
+ AssertContainedInDeclaratorArguments(x7Decl);
+ VerifyModelNotSupported(model, x7Decl, x7Ref[0]);
+ VerifyNotInScope(model, x7Ref[1]);
+ VerifyNotInScope(model, x7Ref[2]);
+ }
+
+ [Fact]
+ public void Scope_DeclaratorArguments_19()
+ {
+ var source =
+@"
+public unsafe struct X
+{
+ public static void Main()
+ {
+ }
+
+ fixed bool d[2], Test3 (string.Empty is var x3);
+}
+";
+ var compilation = CreateCompilationWithMscorlib45(source, options: TestOptions.DebugExe.WithAllowUnsafe(true), parseOptions: TestOptions.Regular);
+ int[] exclude = new int[] { (int)ErrorCode.ERR_BadVarDecl,
+ };
+
+ compilation.GetDiagnostics().Where(d => !exclude.Contains(d.Code)).Verify(
+ // (8,28): error CS1003: Syntax error, '[' expected
+ // fixed bool d[2], Test3 (string.Empty is var x3);
+ Diagnostic(ErrorCode.ERR_SyntaxError, "(").WithArguments("[", "(").WithLocation(8, 28),
+ // (8,51): error CS1003: Syntax error, ']' expected
+ // fixed bool d[2], Test3 (string.Empty is var x3);
+ Diagnostic(ErrorCode.ERR_SyntaxError, ")").WithArguments("]", ")").WithLocation(8, 51),
+ // (8,29): error CS0029: Cannot implicitly convert type 'bool' to 'int'
+ // fixed bool d[2], Test3 (string.Empty is var x3);
+ Diagnostic(ErrorCode.ERR_NoImplicitConv, "string.Empty is var x3").WithArguments("bool", "int").WithLocation(8, 29)
+ );
+
+ var tree = compilation.SyntaxTrees.Single();
+ var model = compilation.GetSemanticModel(tree);
+
+ var x3Decl = GetPatternDeclarations(tree, "x3").Single();
+ AssertContainedInDeclaratorArguments(x3Decl);
+ VerifyModelNotSupported(model, x3Decl);
+ }
+
+ [Fact]
+ public void Scope_DeclaratorArguments_20()
+ {
+ var source =
+@"
+public unsafe struct X
+{
+ public static void Main()
+ {
+ }
+
+ fixed bool Test3[string.Empty is var x3];
+}
+";
+ var compilation = CreateCompilationWithMscorlib45(source, options: TestOptions.DebugExe.WithAllowUnsafe(true), parseOptions: TestOptions.Regular);
+
+ compilation.VerifyDiagnostics(
+ // (8,22): error CS0029: Cannot implicitly convert type 'bool' to 'int'
+ // fixed bool Test3[string.Empty is var x3];
+ Diagnostic(ErrorCode.ERR_NoImplicitConv, "string.Empty is var x3").WithArguments("bool", "int").WithLocation(8, 22)
+ );
+
+ var tree = compilation.SyntaxTrees.Single();
+ var model = compilation.GetSemanticModel(tree);
+
+ var x3Decl = GetPatternDeclarations(tree, "x3").Single();
+ AssertContainedInDeclaratorArguments(x3Decl);
+ VerifyModelNotSupported(model, x3Decl);
+ }
+
[Fact]
public void DeclarationInsideNameof()
{
diff --git a/src/Setup/Templates/source.extension.vsixmanifest b/src/Setup/Templates/source.extension.vsixmanifest
index 656ca313c373699d7479ded2c28feadb5e5daea5..6b0f95163a72fe850ef0656ce9502b09e9a0e811 100644
--- a/src/Setup/Templates/source.extension.vsixmanifest
+++ b/src/Setup/Templates/source.extension.vsixmanifest
@@ -32,5 +32,6 @@
+
diff --git a/src/Tools/Source/SyntaxVisualizer/SyntaxVisualizerExtension/SyntaxVisualizerContainer.xaml b/src/Tools/Source/SyntaxVisualizer/SyntaxVisualizerExtension/SyntaxVisualizerContainer.xaml
index 5f159701d8c2a4060fea766b788d257da8c649c4..525de2a4e2ab559aa187b8ecfce8ffcbec20cd87 100644
--- a/src/Tools/Source/SyntaxVisualizer/SyntaxVisualizerExtension/SyntaxVisualizerContainer.xaml
+++ b/src/Tools/Source/SyntaxVisualizer/SyntaxVisualizerExtension/SyntaxVisualizerContainer.xaml
@@ -4,7 +4,7 @@
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
- xmlns:vsfx="clr-namespace:Microsoft.VisualStudio.Shell;assembly=Microsoft.VisualStudio.Shell.15.0"
+ xmlns:vsfx="clr-namespace:Microsoft.VisualStudio.Shell;assembly=Microsoft.VisualStudio.Shell.14.0"
xmlns:s="clr-namespace:Roslyn.SyntaxVisualizer.Control;assembly=Roslyn.SyntaxVisualizer.Control"
mc:Ignorable="d"
d:DesignHeight="300" d:DesignWidth="300"
diff --git a/src/Tools/Source/SyntaxVisualizer/SyntaxVisualizerExtension/project.json b/src/Tools/Source/SyntaxVisualizer/SyntaxVisualizerExtension/project.json
index 6e643a9fa65fae5d2ad9e205d6a35651b5e4ec1d..d0820c5893cfe9d3f1a52b4c9356926736f0f6ec 100644
--- a/src/Tools/Source/SyntaxVisualizer/SyntaxVisualizerExtension/project.json
+++ b/src/Tools/Source/SyntaxVisualizer/SyntaxVisualizerExtension/project.json
@@ -1,31 +1,29 @@
-{
+{
"dependencies": {
"EnvDTE": "8.0.0",
"EnvDTE80": "8.0.0",
- "Microsoft.Composition": "1.0.27",
"Microsoft.CodeAnalysis.Analyzers": "1.1.0",
"Microsoft.CodeAnalysis.Common": "1.0.1",
"Microsoft.CodeAnalysis.EditorFeatures.Text": "1.0.1",
"Microsoft.CodeAnalysis.Workspaces.Common": "1.0.1",
- "Microsoft.VisualStudio.CoreUtility": "15.0.26201-alpha",
- "Microsoft.VisualStudio.Editor": "15.0.26201-alpha",
- "Microsoft.VisualStudio.Text.Data": "15.0.26201-alpha",
- "Microsoft.VisualStudio.Text.Logic": "15.0.26201-alpha",
- "Microsoft.VisualStudio.Text.UI": "15.0.26201-alpha",
- "Microsoft.VisualStudio.Text.UI.Wpf": "15.0.26201-alpha",
- "Microsoft.VisualStudio.Utilities": "15.0.26201-alpha",
+ "Microsoft.Composition": "1.0.27",
+ "Microsoft.VisualStudio.CoreUtility": "[14.0.23205]",
+ "Microsoft.VisualStudio.Editor": "[14.0.23205]",
"Microsoft.VisualStudio.OLE.Interop": "7.10.6070",
- "Microsoft.VisualStudio.Shell.Framework": "15.0.26201-alpha",
- "Microsoft.VisualStudio.Shell.15.0": "15.0.26201-alpha",
- "Microsoft.VisualStudio.Shell.Immutable.10.0": "15.0.26201-alpha",
+ "Microsoft.VisualStudio.Shell.14.0": "[14.0.23205]",
"Microsoft.VisualStudio.Shell.Interop": "7.10.6071",
+ "Microsoft.VisualStudio.Shell.Interop.10.0": "10.0.30319",
"Microsoft.VisualStudio.Shell.Interop.8.0": "8.0.50727",
"Microsoft.VisualStudio.Shell.Interop.9.0": "9.0.30729",
- "Microsoft.VisualStudio.Shell.Interop.10.0": "10.0.30319",
+ "Microsoft.VisualStudio.Text.Data": "[14.0.23205]",
+ "Microsoft.VisualStudio.Text.Logic": "[14.0.23205]",
+ "Microsoft.VisualStudio.Text.UI": "[14.0.23205]",
+ "Microsoft.VisualStudio.Text.UI.Wpf": "[14.0.23205]",
"Microsoft.VisualStudio.TextManager.Interop": "7.10.6070",
- "Microsoft.VisualStudio.ComponentModelHost": "15.0.26201-alpha",
+ "Microsoft.VisualStudio.Utilities": "[14.0.23205]",
"System.Collections.Immutable": "1.1.36",
- "System.Reflection.Metadata": "1.0.21"
+ "System.Reflection.Metadata": "1.0.21",
+ "VSSDK.ComponentModelHost": "[12.0.4]"
},
"frameworks": {
"net46": {}