[Proposal]: Type inference using method group natural type #9006
Unanswered
jcouv
asked this question in
Language Ideas
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Type inference using method group natural type
Champion issue: #9007
Summary
It allows the natural type of a method group to contribute to method type inference
Context on method type inference
The current type inference rules allow
Uitype parameters inC<U1 ... Uk>when given aC<V1...Vk>andCis a class, struct, interface or delegate type.But they don't allow method groups to contribute to bounds.
Type inference
We modify the explicit parameter type inference rules to not just apply to explicitly-typed lambdas, but also to method groups:
An explicit parameter type inference is made from an expression
Eto a typeTin the following way:Eis an explicitly typed anonymous function *or method group with a unique signature with parameter typesU₁...UᵥandTis a delegate type or expression tree type with parameter typesV₁...Vᵥthen for eachUᵢan exact inference is made fromUᵢto the correspondingVᵢ.Follow-ups:
Relates to issue for method groups contributing to method type inference: #129
LDM Discussions
Beta Was this translation helpful? Give feedback.
All reactions