Reporter | Andrew (impworks) |
---|---|
Created | Dec 15, 2016 2:21:33 PM |
Updated | Apr 11, 2018 8:04:27 PM |
Resolved | Apr 11, 2018 8:04:27 PM |
Subsystem | Quick Fixes |
Assignee | Alexander Shvedov (shvedov) |
Priority | Critical |
State | Fixed |
Type | Bug |
Fix version | 2018.1 |
Affected versions | 2016.2.2 |
Fixed In Version ReSharper | 2018.1 EAP 7 |
VsVersion | All Versions |
Consider the following code:
When I apply the suggested "Merge conditional exprerssion" quickfix, the code becomes broken:
The
class TestClass
{
public ImageTypeEnum? Kind { get; set; }
public string Description => Kind == null ? "(none)" : ((ImageTypeEnum)Kind.Value).ToString();
}
When I apply the suggested "Merge conditional exprerssion" quickfix, the code becomes broken:
class TestClass
{
public ImageTypeEnum? Kind { get; set; }
public string Description => ((ImageTypeEnum?) Kind?.Value)?.ToString() ?? "(none)";
}
The
Kind?.Value
makes no sense in the new context, because the value is already unwrapped by a safe navigation operator.