dotnet/roslyn

'Use pattern-matching' should be missing on writes from local function captures

Open

#29,512 opened on Aug 24, 2018

View on GitHub
 (1 comment) (0 reactions) (0 assignees)C# (4,257 forks)batch import
Area-IDEBughelp wanted

Repository metrics

Stars
 (20,414 stars)
PR merge metrics
 (Avg merge 6d 17h) (256 merged PRs in 30d)

Description

From https://github.com/dotnet/roslyn/pull/26097#discussion_r210728805

We should look for writes that are logically within the span, but syntactically are not.

var s = field as string;
WriteField();
if (s != null) { ... }

void WriteField () => field = null;

/cc @sharwell

Contributor guide