Skip to content

Commit

Permalink
PR feedback (1)
Browse files Browse the repository at this point in the history
  • Loading branch information
jcouv committed Sep 14, 2016
1 parent fafbbed commit 0e044e2
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8167,7 +8167,7 @@ class C
static void F(object o)
{
<AS:0>Console.WriteLine(1);</AS:0>
foreach (var (x, y) in new[] { (1, 2) }) { }
foreach (var (x, y) in new[] { (1, 2) }) { Console.WriteLine(2); }
}
}
";
Expand All @@ -8177,7 +8177,7 @@ class C
static void F(object o)
{
<AS:0>Console.WriteLine(1);</AS:0>
foreach (var (x, y) in new[] { o }) { }
foreach (var (x, y) in new[] { o }) { Console.WriteLine(2); }
}
}
";
Expand Down Expand Up @@ -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]
Expand Down Expand Up @@ -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]
Expand Down Expand Up @@ -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]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
});
}

Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion src/Features/CSharp/Portable/CSharpFeaturesResources.resx
Original file line number Diff line number Diff line change
Expand Up @@ -400,7 +400,7 @@
<comment>{Locked="ref"} "ref" is a C# keyword and should not be localized.</comment>
</data>
<data name="v7_switch" xml:space="preserve">
<value>v7 switch</value>
<value>C# 7 enhanced switch statement</value>
</data>
<data name="global_statement" xml:space="preserve">
<value>global statement</value>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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:
Expand Down

0 comments on commit 0e044e2

Please sign in to comment.