Skip to content

Commit

Permalink
Merge pull request #25383 from dotnet/merges/dev15.7-preview1-to-dev1…
Browse files Browse the repository at this point in the history
…5.7.x

Merge dev15.7-preview1 to dev15.7.x
  • Loading branch information
Shyam-Gupta authored Mar 9, 2018
2 parents 04787d6 + 7afc6df commit f9caf7d
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 7 deletions.
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

0 comments on commit f9caf7d

Please sign in to comment.