Currently, we treat tuples like generic Pair<T1, T2> during the conversion/assignment. This results in a redundant safety warning, since we already track the initial state of Item1/Item2 in the case of tuples.

#nullable enable
public class UnitTest1
{
void M(string? s, string s2)
{
(string, string) t = (s, s2); // should be W-warning on elements
t.Item1.ToString();
// Motivations to change this:
// - redundant safety warning
// - generic type inference
// - deconstruction
Pair<string, string> p = Pair.Create(s, s2);
p.Item1.ToString();
var t2 = ((string, string))(s, s2); // should be W-warning on elements. t2 is (string, string), but state is Item1 is nullable
t2.Item1.ToString(); // safety
}
}
public class Pair<T1, T2>
{
public T1 Item1;
public T2 Item2;
}
static class Pair
{
public static Pair<T1, T2> Create<T1, T2>(T1 x, T2 y) { throw null; }
}
FYI @cston
Currently, we treat tuples like generic
Pair<T1, T2>during the conversion/assignment. This results in a redundant safety warning, since we already track the initial state ofItem1/Item2in the case of tuples.FYI @cston