-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Closed
Labels
Milestone
Description
using System.Runtime.CompilerServices;
[NonNullTypes]
class C
{
static (string?, string) F()
{
return (string.Empty, string.Empty);
}
void Deconstruct(out string? x, out string y)
{
x = string.Empty;
y = string.Empty;
}
static void M()
{
(var x, var y) = new C();
x.ToString(); // warning: maybe null
y.ToString();
(var z, var w) = F();
z.ToString(); // warning: maybe null
w.ToString();
}
}(jcouv update:)
Note: I've added references to this issue to replace PROTOTYPE markers. I believe that once the deconstruction scenario is properly handled, it should be possible to remove the following two methods:
// PROTOTYPE(NullableReferenceTypes): Remove this method. Initial binding should not infer nullability.
internal static TypeSymbolWithAnnotations GetTypeAndNullability(this BoundExpression expr)
{
...
}
// PROTOTYPE(NullableReferenceTypes): Remove this method. Initial binding should not infer nullability.
private static bool? IsNullableInternal(this BoundExpression expr)
{
...
}As part of this, we should also review NullableWalker.VisitForEachIterationVariables.
Reactions are currently unavailable