Skip to content

Incorrect nullability warning in local function #40157

@JohanLarsson

Description

@JohanLarsson
void M()
{
    if (Try(out var s))
    {
        int Local()
        {
            //     ↓ CS8602 here with 16.4
            return s.Length;
        }
    }
}

bool Try([NotNullWhen(true)] out string? text)
{
    text = string.Empty;
    return true;
}

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions