[Proposal]: Target-typed inference for type patterns
- Dominant language
- C#
- Stars
- 12.7k
- Forks
- 1.1k
- Avg merge
- 11h 1m
- Merged PRs (30d)
- 3
Description
# Target-typed inference for type patterns
* Specification: https://github.com/dotnet/csharplang/blob/main/proposals/inference-for-type-patterns.md
* Discussion: https://github.com/dotnet/csharplang/discussions/9631
## Summary
[summary]: #summary
Generic type inference is extended to type patterns, which may omit a type argument list when it can be inferred from the pattern input value. For instance, given a declaration `Option intOption`, instead of:
```csharp
if (intOption is Some some) ...
```
You can simply write:
```csharp
if (intOption is Some some) ... // 'Some' inferred from the type of 'intOption'
```
## Design meetings
* https://github.com/dotnet/csharplang/blob/main/meetings/2025/LDM-2025-08-27.md#type-inference-in-patterns
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.