Type inference from element expressions within tuple literal arguments
The Roslyn compiler allows type inference from element expressions within tuple literal arguments.
F((1, null), (default, "")); // ok: F<int, string>()
static void F<T, U>((T, U) x, (T, U) y) { }
However, it looks like 12.6.3 Type inference only covers inference from the tuple argument type, not from the tuple element expressions.
FWIW, for collection expressions there is a similar requirement, and the collection expressions proposal extracts the rules from the first phase to an input type inference section to allow adding a recursive inference rule for collection expression elements.
Thanks for this - we will (each) take a look when we are feeling brave enough to venture once more into the type inference spec.
@RexJaeschke Given that this affects the v8 spec (as well as the v7 spec), would it be helpful to milestone this to keep track of everything that needs to be done for the current spec version?
Is this issue a duplicate of https://github.com/dotnet/csharpstandard/issues/1155, or something to cover simultaneously?
@jnm2 Done!
Bill will have a look.