dotnet/roslyn

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

オープン

#57,748 opened on 2021/11/13

 (1 件のコメント) (0 件のリアクション) (0 人の担当者)C# (4,257 件のフォーク)batch import
Area-IDEBugFeature - IDE0059help wanted

Repository metrics

Stars
 (20,414 個のスター)
PR merge metrics
 (平均マージ 6d 17h) (30d で 256 merged PRs)

説明

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.

コントリビューターガイド