dotnet/roslyn

IDE0059 and code fix for use discard but instead (correctly) simplifies to type match

开放

#57,748 创建于 2021年11月13日

 (1 条评论) (0 个反应) (0 位负责人)C# (4,257 个派生)batch import
Area-IDEBugFeature - IDE0059help wanted

仓库指标

星标
 (20,414 个星标)
PR 合并指标
 (平均合并 6天 17小时) (30 天内合并 256 个 PR)

描述

Version Used: .NET 6.0.100

Steps to Reproduce:

  1. Have a type match like that Foo foo => throw new NotImplementedException(),
  2. Code Analyzers correctly detect IDE0059 unnecessary assignment
  3. Code Fixes suggest to use discard (not wrong but so C# 8?)
  4. Code Fixes executes and emits the following ... Foo => throw new NotImplementedException(),

Expected Behavior: Either, Code Fix does what it says in the UI (introduce a discard) OR is correctly named/described.

Actual Behavior: Code Fix does something else then what it actually says. Not that the refactoring itself is wrong ... i am happy with the overall outcome but the description meanwhile is misleading.

贡献者指南