WiseTechGlobal / WTG.Analyzers

Analyzers from WiseTech Global to enforce our styles, behaviours, and prevent common mistakes.
Other
16 stars 3 forks source link

WTG1002 false positive when using target typed new(). #182

Closed brian-reichle closed 2 years ago

brian-reichle commented 2 years ago

The following local variable declaration generates a WTG1002 diagnostic, but shouldn't

Dictionary<string, string> foo = new();

new() is only able to identify the correct type because the variable was given an explicit type. If I change it to var then it (understandably) generates a CS8754 error.