Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge dev15.7-preview1 to dev15.7.x #25383

Merged
merged 8 commits into from
Mar 9, 2018
Original file line number Diff line number Diff line change
Expand Up @@ -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()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -413,6 +413,11 @@ private static SyntaxNode GetLeftmostCondition(SyntaxNode node)
{
while (true)
{
if (node == null)
{
return null;
}

switch (node.Kind())
{
case SyntaxKind.WhileStatement:
Expand All @@ -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;
Expand Down