You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
There are a number of scenarios where the actual type arguments of a type being instantiated can potentially be inferred from context:
Direct assignment of the result of a new expression to a variable or property with an explicit type
Directly passing the result of a new expression to a function as an actual argument
Instantiating a type via new where all of the formal type arguments can be pattern matched to corresponding types in actual constructor arguments
The first two cases are instances of the same kind of type inference needed to infer anonymous function argument types (see #498) - i.e. the inference is pushed from the outside down/from left to right into an expression rather than going from the inside out/right to left. It may be that a mechanism built to support #498 could also support these kinds of constructor type inference.
The last case is similar to generic argument type inference for function calls (see #679) - i.e. really just an extension of function overload resolution, although the results would need to be translated into what type to instantiate rather than what method signature to call.
The text was updated successfully, but these errors were encountered:
There are a number of scenarios where the actual type arguments of a type being instantiated can potentially be inferred from context:
new
expression to a variable or property with an explicit typenew
expression to a function as an actual argumentnew
where all of the formal type arguments can be pattern matched to corresponding types in actual constructor argumentsThe first two cases are instances of the same kind of type inference needed to infer anonymous function argument types (see #498) - i.e. the inference is pushed from the outside down/from left to right into an expression rather than going from the inside out/right to left. It may be that a mechanism built to support #498 could also support these kinds of constructor type inference.
The last case is similar to generic argument type inference for function calls (see #679) - i.e. really just an extension of function overload resolution, although the results would need to be translated into what type to instantiate rather than what method signature to call.
The text was updated successfully, but these errors were encountered: