dotnet/roslyn

Code fix suggestion: fix return type

オープン

#29,677 opened on 2018/09/05

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

Repository metrics

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

説明

I want to propose a code fix for fixing the return type.

Example 1:

image

image

Here I would like to press CTRL + . and get the code fix suggestion: Fix return type from void to IEnumerable<InputParameter>

Mind that void is just a return type here (a Unit). So for example when the return type was InputParameter you would get the suggestion: Fix return type from InputParameter to IEnumerable<InputParameter>

Sorry for the brief suggestion, maybe I can add more details later @kuhlenh


Update (jcouv): As of 16.1p1, some scenarios are now handled (see PR https://github.com/dotnet/roslyn/pull/33457):

  • void M() { return 1; } (CS0127)
  • async void M() { return 1; } (CS1997)
  • void M() => 1; (CS0201)

Other scenarios listed below are not handled yet. In particular:

  • fixing an existing return type that is not void,
  • giving a clever type, instead of object, when typeless expressions (lambdas) are returned,
  • VB scenarios.

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