Version Used:
Branch master (10 Mar 2020)
Latest commit 441c154 by msftbot[bot]:
Merge pull request #42303 from CyrusNajmabadi/useCompoundParens
Support parenthesized expressions in use-compound-operator.
Steps to Reproduce:
Compile the following code
#nullable enable
class C
{
void M(string s)
{
Infer(s, default); // Infer<string?>, no warnings
Infer(s, null); // Infer<string>, CS8625 cannot convert null literal to non-nullable refernece type
}
T Infer<T>(T t1, T t2) => t1 ?? t2;
}
Expected Behavior:
The same type argument is inferred for both Infer calls.
Actual Behavior:
Different nullability is inferred for calls with default and null. defualt infers string? and doesn't have any warnings while the call with null infers string and reports CS8625 cannot convert null literal to non-nullable refernece type
/cc @jcouv
Version Used:
Steps to Reproduce:
Compile the following code
Expected Behavior:
The same type argument is inferred for both
Infercalls.Actual Behavior:
Different nullability is inferred for calls with
defaultandnull.defualtinfersstring?and doesn't have any warnings while the call withnullinfersstringand reportsCS8625 cannot convert null literal to non-nullable refernece type/cc @jcouv