提交 7afc6df9 编写于 作者: S Sam Harwell

Merge remote-tracking branch 'dotnet/dev15.7-preview1' into merges/dev15.7-preview1-to-dev15.7.x

......@@ -114,6 +114,20 @@ void M()
}");
}
[Fact, Trait(Traits.Feature, Traits.Features.CodeActionsInlineTypeCheck)]
[WorkItem(25237, "https://github.com/dotnet/roslyn/issues/25237")]
public async Task TestMissingOnReturnStatement()
{
await TestMissingInRegularAndScriptAsync(
@"class C
{
void M()
{
[|return;|]
}
}");
}
[Fact, Trait(Traits.Feature, Traits.Features.CodeActionsInlineTypeCheck)]
public async Task TestMissingOnIsExpression()
{
......
......@@ -413,6 +413,11 @@ private static SyntaxNode GetLeftmostCondition(SyntaxNode node)
{
while (true)
{
if (node == null)
{
return null;
}
switch (node.Kind())
{
case SyntaxKind.WhileStatement:
......@@ -428,13 +433,7 @@ private static SyntaxNode GetLeftmostCondition(SyntaxNode node)
var declarators = ((LocalDeclarationStatementSyntax)node).Declaration.Variables;
// We require this to be the only declarator in the declaration statement
// to simplify definitive assignment check and the code fix for now
var value = declarators.Count == 1 ? declarators[0].Initializer?.Value : null;
if (value == null)
{
return null;
}
node = value;
node = declarators.Count == 1 ? declarators[0].Initializer?.Value : null;
continue;
case SyntaxKind.ParenthesizedExpression:
node = ((ParenthesizedExpressionSyntax)node).Expression;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册