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 @@ -10613,4 +10613,33 @@ private int Goo()
}
}
""", new(parseOptions: CSharpParseOptions.Default.WithLanguageVersion(LanguageVersion.CSharp14)));

[Fact, WorkItem("https://github.com/dotnet/roslyn/issues/80628")]
public Task TestGenerateAbstractMethodReturningTask()
=> TestInRegularAndScriptAsync(
"""
using System.Threading.Tasks;

abstract class C
{
async Task M()
{
await [|M2|]();
}
}
""",
"""
using System.Threading.Tasks;

abstract class C
{
async Task M()
{
await M2();
}

protected abstract Task M2();
}
""",
index: 1);
}
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ public async ValueTask<IMethodSymbol> GenerateMethodAsync(
attributes: default,
accessibility: DetermineAccessibility(isAbstract),
modifiers: DeclarationModifiers.None
.WithIsStatic(State.IsStatic).WithIsAbstract(isAbstract).WithIsUnsafe(isUnsafe).WithAsync(knownTypes.IsTaskLike(returnType)),
.WithIsStatic(State.IsStatic).WithIsAbstract(isAbstract).WithIsUnsafe(isUnsafe).WithAsync(!isAbstract && knownTypes.IsTaskLike(returnType)),
returnType: returnType,
refKind: DetermineRefKind(cancellationToken),
explicitInterfaceImplementations: default,
Expand Down
Loading