-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Closed
Labels
4 - In ReviewA fix for the issue is submitted for review.A fix for the issue is submitted for review.Area-CompilersBugFeature - Nullable Reference TypesNullable Reference TypesNullable Reference TypesFeature - Primary Constructors
Milestone
Description
Version Used:
4.7.0-1.final
Steps to Reproduce:
#nullable enable
class B(string s)
{
public string S { get; } = s;
}
class C(B b)
: B(b.S)
// ^ CS8602 dereference of a possibly null reference
{
string T() => b.S; // removing this usage makes the diagnostic disappear
}Diagnostic Id:
CS8602
Expected Behavior:
No diagnostic. The code that produces this diagnostic was fine before I invoked the "convert to primary constructor" fix.
Actual Behavior:
Incorrect diagnostic.
Metadata
Metadata
Assignees
Labels
4 - In ReviewA fix for the issue is submitted for review.A fix for the issue is submitted for review.Area-CompilersBugFeature - Nullable Reference TypesNullable Reference TypesNullable Reference TypesFeature - Primary Constructors