Do we look at tuples like Pair<T1, T2>
or like locals?
// current behavior is similar to Pair<T1, T2> except that we’re able to initialize the state of the fields in tuple literals
static void M(string? x, string y)
{
(string, string) t = (x, y); // warning: (string?, string) mismatch
t.Item1.ToString(); // warning: may be null
var t2 = Identity(t); // infers `(string, string)`
}
// an alternative is to treat tuples like we do locals
static void M(string? x, string y)
{
(string, string) t = (x, y); // W-warning: x is possibly null
t.Item1.ToString(); // warning: may be null
var t2 = Identity(t); // infers `(string?, string)`
}
We concluded we should stick with current approach.