提交 5d36b856 编写于 作者: M Martin Strecker

Removed check for NullLiteralExpression

上级 1e444cfd
......@@ -3913,5 +3913,28 @@ static void Main(dynamic p)
}
}");
}
[WorkItem(18978, "https://github.com/dotnet/roslyn/issues/18978")]
[Fact, Trait(Traits.Feature, Traits.Features.CodeActionsRemoveUnnecessaryCast)]
public async Task DontRemoveCastCallToMethodWithParamsArgs()
{
await TestMissingInRegularAndScriptAsync(
@"
class Program
{
public static void Main(string[] args)
{
var takesArgs = new[] { ""Hello"", ""World"" };
TakesParams(takesArgs);
TakesParams([|(object)takesArgs|]);
}
private static void TakesParams(params object[] foo)
{
Console.WriteLine(foo.Length);
}
}");
}
}
}
\ No newline at end of file
......@@ -161,8 +161,6 @@ private static bool UserDefinedConversionIsAllowed(ExpressionSyntax expression,
//
// Foo((object)null);
if (cast.Expression.WalkDownParentheses().IsKind(SyntaxKind.NullLiteralExpression))
{
var argument = cast.WalkUpParentheses().Parent as ArgumentSyntax;
if (argument != null)
{
......@@ -200,7 +198,6 @@ private static bool UserDefinedConversionIsAllowed(ExpressionSyntax expression,
}
}
}
}
return false;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册