Skip to content

[Proposal]: Target-typed inference for type patterns #9630

@MadsTorgersen

Description

@MadsTorgersen

Target-typed inference for type patterns

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<int> intOption, instead of:

if (intOption is Some<int> some) ...

You can simply write:

if (intOption is Some some) ... // 'Some<int>' inferred from the type of 'intOption'

Design meetings

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions