[Proposal]: `Task<T>` nullability covariance
- Dominant language
- C#
- Stars
- 12.7k
- Forks
- 1.1k
- Avg merge
- 11h 1m
- Merged PRs (30d)
- 3
Description
# `Task` nullability covariance
* Specification: None yet
* Discussion: https://github.com/dotnet/csharplang/discussions/8996
## Summary
[summary]: #summary
`Task` nullability covariance (LDM tentatively approved, needs design proposal for task-like types)
It should be possible to return a `Task` for a `Task`.
```cs
using System.Threading.Tasks;
#nullable enable
public class C
{
public Task<(bool Result, string? Extras)> M()
{
return Task.FromResult((true, "")); // currently produces a warning
}
}
```
## Design meetings
Split issue from https://github.com/dotnet/csharplang/issues/3868
https://github.com/dotnet/csharplang/blob/main/meetings/2022/LDM-2022-09-28.md#nullability-improvements
https://github.com/dotnet/csharplang/blob/main/meetings/2024/LDM-2024-09-06.md#taskt-nullability-covariance
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.