diff --git a/src/EditorFeatures/CSharpTest/SimplifyInterpolation/SimplifyInterpolationTests.cs b/src/EditorFeatures/CSharpTest/SimplifyInterpolation/SimplifyInterpolationTests.cs index cfbdce828adf9bfc2786924b2a5fe86d8adbb72e..2cafda444293c9909349364fbc4e152bffe1aea8 100644 --- a/src/EditorFeatures/CSharpTest/SimplifyInterpolation/SimplifyInterpolationTests.cs +++ b/src/EditorFeatures/CSharpTest/SimplifyInterpolation/SimplifyInterpolationTests.cs @@ -198,7 +198,7 @@ void M(string someValue) { void M(string someValue) { - _ = $""prefix {someValue,-3} suffix""; + _ = $""prefix {someValue,3} suffix""; } }"); } @@ -218,13 +218,13 @@ void M(string someValue) { void M(string someValue) { - _ = $""prefix {someValue,3} suffix""; + _ = $""prefix {someValue,-3} suffix""; } }"); } [Fact] - public async Task PadLeftWithComplexConstantExpressionRequiringParentheses() + public async Task PadLeftWithComplexConstantExpression() { await TestInRegularAndScriptAsync( @"class C @@ -240,7 +240,7 @@ void M(string someValue) void M(string someValue) { const int someConstant = 1; - _ = $""prefix {someValue,-((byte)3.3 + someConstant)} suffix""; + _ = $""prefix {someValue,(byte)3.3 + someConstant} suffix""; } }"); } @@ -260,7 +260,7 @@ void M(string someValue) { void M(string someValue) { - _ = $""prefix {someValue,-3} suffix""; + _ = $""prefix {someValue,3} suffix""; } }"); } @@ -280,7 +280,7 @@ void M(string someValue) { void M(string someValue) { - _ = $""prefix {someValue,3} suffix""; + _ = $""prefix {someValue,-3} suffix""; } }"); } @@ -312,7 +312,7 @@ void M(string someValue) } [Fact] - public async Task PadRightWithComplexConstantExpression() + public async Task PadRightWithComplexConstantExpressionRequiringParentheses() { await TestInRegularAndScriptAsync( @"class C @@ -328,7 +328,7 @@ void M(string someValue) void M(string someValue) { const int someConstant = 1; - _ = $""prefix {someValue,(byte)3.3 + someConstant} suffix""; + _ = $""prefix {someValue,-((byte)3.3 + someConstant)} suffix""; } }"); } @@ -420,7 +420,7 @@ void M(string someValue) { void M(string someValue) { - _ = $""prefix {someValue,-3:goo} suffix""; + _ = $""prefix {someValue,3:goo} suffix""; } }"); } @@ -440,7 +440,7 @@ void M(string someValue) { void M(string someValue) { - _ = $""prefix {someValue,3:goo} suffix""; + _ = $""prefix {someValue,-3:goo} suffix""; } }"); } @@ -511,7 +511,7 @@ void M(string someValue) { void M(string someValue) { - _ = $""prefix {someValue,-3} suffix""; + _ = $""prefix {someValue,3} suffix""; } }"); } @@ -568,7 +568,7 @@ void M(string someValue) { void M(string someValue) { - _ = $""prefix {someValue.PadLeft(3),3} suffix""; + _ = $""prefix {someValue.PadLeft(3),-3} suffix""; } }"); } diff --git a/src/Features/Core/Portable/SimplifyInterpolation/Helpers.cs b/src/Features/Core/Portable/SimplifyInterpolation/Helpers.cs index 08c21bf47bf70f4760a8e0e900730cba7b015a92..2fd4f2bc31ee0357ecb26e61340b9025fb417bf6 100644 --- a/src/Features/Core/Portable/SimplifyInterpolation/Helpers.cs +++ b/src/Features/Core/Portable/SimplifyInterpolation/Helpers.cs @@ -131,7 +131,7 @@ private static TextSpan GetSpanWithinLiteralQuotes(IVirtualCharService virtualCh unwrapped = invocation.Instance; alignment = alignmentSyntax as TExpressionSyntax; - negate = targetName == nameof(string.PadLeft); + negate = targetName == nameof(string.PadRight); unnecessarySpans.AddRange(invocation.Syntax.Span .Subtract(invocation.Instance.Syntax.FullSpan)