Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,7 @@ public static bool IsAwaitable(this ITypeSymbol? typeSymbol, SemanticModel seman
{
while (operation?.Parent is not null)
{
if (operation.Parent is IAnonymousFunctionOperation or IMethodBodyOperation)
if (operation.Parent is IAnonymousFunctionOperation or IMethodBodyOperation or ILocalFunctionOperation)
{
return operation.Parent;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -485,4 +485,34 @@ class Class1

await CSVerify.VerifyAnalyzerAsync(test);
}

[Fact]
public async Task LocalVoidFunctionWithinAsyncTaskMethod()
{
string test = /* lang=c#-test */ """
using System.Threading.Tasks;

class Test
{
async Task DoOperationAsync()
{
DoOperationInner();

void DoOperationInner()
{
[|HelperAsync()|];
}
}

void DoOperation()
{
[|HelperAsync()|];
}

Task HelperAsync() => Task.CompletedTask;
}
""";

await CSVerify.VerifyAnalyzerAsync(test);
}
}
Loading