From 0e044e2aa6a5b55ff948cda13ff5062d2a07a4c6 Mon Sep 17 00:00:00 2001 From: jcouv Date: Tue, 13 Sep 2016 12:01:27 -0700 Subject: [PATCH] PR feedback (1) --- .../CSharpTest/EditAndContinue/ActiveStatementTests.cs | 10 +++++----- .../EditAndContinue/RudeEditStatementTests.cs | 2 +- .../Portable/CSharpFeaturesResources.Designer.cs | 2 +- .../CSharp/Portable/CSharpFeaturesResources.resx | 2 +- .../EditAndContinue/CSharpEditAndContinueAnalyzer.cs | 3 +++ 5 files changed, 11 insertions(+), 8 deletions(-) diff --git a/src/EditorFeatures/CSharpTest/EditAndContinue/ActiveStatementTests.cs b/src/EditorFeatures/CSharpTest/EditAndContinue/ActiveStatementTests.cs index a344516ddb36f..e8731033bcbfe 100644 --- a/src/EditorFeatures/CSharpTest/EditAndContinue/ActiveStatementTests.cs +++ b/src/EditorFeatures/CSharpTest/EditAndContinue/ActiveStatementTests.cs @@ -8167,7 +8167,7 @@ class C static void F(object o) { Console.WriteLine(1); - foreach (var (x, y) in new[] { (1, 2) }) { } + foreach (var (x, y) in new[] { (1, 2) }) { Console.WriteLine(2); } } } "; @@ -8177,7 +8177,7 @@ class C static void F(object o) { Console.WriteLine(1); - foreach (var (x, y) in new[] { o }) { } + foreach (var (x, y) in new[] { o }) { Console.WriteLine(2); } } } "; @@ -8215,7 +8215,7 @@ static void F(object o1, object o2) var active = GetActiveStatements(src1, src2); edits.VerifyRudeDiagnostics(active, - Diagnostic(RudeEditKind.UpdateAroundActiveStatement, "var (x, y)", CSharpFeaturesResources.deconstruction)); + Diagnostic(RudeEditKind.UpdateAroundActiveStatement, "var (x, y) = o2", CSharpFeaturesResources.deconstruction)); } [Fact] @@ -8245,7 +8245,7 @@ static void F(object o1, object o2) var active = GetActiveStatements(src1, src2); edits.VerifyRudeDiagnostics(active, - Diagnostic(RudeEditKind.UpdateAroundActiveStatement, "(int x, int y)", CSharpFeaturesResources.deconstruction)); + Diagnostic(RudeEditKind.UpdateAroundActiveStatement, "(int x, int y) = o2", CSharpFeaturesResources.deconstruction)); } [Fact] @@ -8424,7 +8424,7 @@ static void F(object o1, object o2) var active = GetActiveStatements(src1, src2); edits.VerifyRudeDiagnostics(active, - Diagnostic(RudeEditKind.UpdateAroundActiveStatement, "(x, y)", CSharpFeaturesResources.tuple)); + Diagnostic(RudeEditKind.UpdateAroundActiveStatement, "var (x, y) = o2;", CSharpFeaturesResources.deconstruction)); } [Fact] diff --git a/src/EditorFeatures/CSharpTest/EditAndContinue/RudeEditStatementTests.cs b/src/EditorFeatures/CSharpTest/EditAndContinue/RudeEditStatementTests.cs index 27d21f7c8c651..cc948d0afd84f 100644 --- a/src/EditorFeatures/CSharpTest/EditAndContinue/RudeEditStatementTests.cs +++ b/src/EditorFeatures/CSharpTest/EditAndContinue/RudeEditStatementTests.cs @@ -6539,7 +6539,7 @@ static void F(object o) ActiveStatementsDescription.Empty, expectedDiagnostics: new[] { - Diagnostic(RudeEditKind.UpdateAroundActiveStatement, "switch (o)", CSharpFeaturesResources.v7_switch) + Diagnostic(RudeEditKind.UpdateAroundActiveStatement, null, CSharpFeaturesResources.v7_switch) }); } diff --git a/src/Features/CSharp/Portable/CSharpFeaturesResources.Designer.cs b/src/Features/CSharp/Portable/CSharpFeaturesResources.Designer.cs index abe8b0dece6f3..2a52ad6535a05 100644 --- a/src/Features/CSharp/Portable/CSharpFeaturesResources.Designer.cs +++ b/src/Features/CSharp/Portable/CSharpFeaturesResources.Designer.cs @@ -1091,7 +1091,7 @@ internal static string using_statement { } /// - /// Looks up a localized string similar to v7 switch. + /// Looks up a localized string similar to C# 7 enhanced switch statement. /// internal static string v7_switch { get { diff --git a/src/Features/CSharp/Portable/CSharpFeaturesResources.resx b/src/Features/CSharp/Portable/CSharpFeaturesResources.resx index ff96a4eb87f23..3a2bb5bc59576 100644 --- a/src/Features/CSharp/Portable/CSharpFeaturesResources.resx +++ b/src/Features/CSharp/Portable/CSharpFeaturesResources.resx @@ -400,7 +400,7 @@ {Locked="ref"} "ref" is a C# keyword and should not be localized. - v7 switch + C# 7 enhanced switch statement global statement diff --git a/src/Features/CSharp/Portable/EditAndContinue/CSharpEditAndContinueAnalyzer.cs b/src/Features/CSharp/Portable/EditAndContinue/CSharpEditAndContinueAnalyzer.cs index b79033ac001bf..89f5830ce3ff8 100644 --- a/src/Features/CSharp/Portable/EditAndContinue/CSharpEditAndContinueAnalyzer.cs +++ b/src/Features/CSharp/Portable/EditAndContinue/CSharpEditAndContinueAnalyzer.cs @@ -1358,6 +1358,7 @@ internal static TextSpan GetDiagnosticSpanImpl(SyntaxKind kind, SyntaxNode node, case SyntaxKind.RefType: case SyntaxKind.RefExpression: case SyntaxKind.DeclarationPattern: + case SyntaxKind.VariableComponentAssignment: return node.Span; default: @@ -1610,6 +1611,7 @@ internal static string GetStatementDisplayNameImpl(SyntaxNode node) case SyntaxKind.ForEachComponentStatement: case SyntaxKind.ParenthesizedVariableComponent: case SyntaxKind.TypedVariableComponent: + case SyntaxKind.VariableComponentAssignment: return CSharpFeaturesResources.deconstruction; case SyntaxKind.TupleType: @@ -3106,6 +3108,7 @@ private static bool IsUnsupportedCSharp7EnCNode(SyntaxNode n) { case SyntaxKind.IsPatternExpression: case SyntaxKind.DeconstructionDeclarationStatement: + case SyntaxKind.VariableComponentAssignment: case SyntaxKind.ForEachComponentStatement: case SyntaxKind.ParenthesizedVariableComponent: case SyntaxKind.TypedVariableComponent: