-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Closed
Closed
Copy link
Labels
Milestone
Description
Version Used: d5931e0
Steps to Reproduce:
#nullable enable
public delegate void Del<T>(T t = default);
public class C<T>
{
public void M0(T t) { }
// Behavior for member methods, for comparison
public void M1(T t = default)
{
M0(t); // warning CS8604: Possible null reference argument
}
public void M2()
{
Del<T> del = t => M0(t); // expected warning, but didn't get one
Del<T> del1 = t => { t = default; M0(t); }; // warning CS8604: Possible null reference argument
}
}Expected Behavior: Warnings on all 3 commented lines
Actual Behavior: Warnings on 2 commented lines
I might be able to fix this with my "put parameter default values in the bound tree" work. Not yet sure.
edit: Expected behavior of this scenario has changed based on the proposal nullable-parameter-default-value-analysis.md
Reactions are currently unavailable