Quantcast
Channel: YouTrackReSharper (RSRP) - Bug and Issue Tracker
Viewing all articles
Browse latest Browse all 106942

RSRP-190381: QFix on "?? Left Operand Never Null": Breaks Code (Changes Expression Type)

$
0
0
Reporter Serge Baltic (baltic) Serge Baltic (baltic)
Created Sep 3, 2010 8:52:39 PM
Updated Apr 7, 2018 2:54:46 PM
Resolved Apr 7, 2018 2:54:46 PM
Subsystem Quick Fixes
Assignee Alisa Afonina (alisa.afonina)
Priority Major
State Obsolete
Type Bug
Fix version No Fix versions
Affected versions No Affected versions
Fixed In Version ReSharper Undefined
VsVersion All Versions
void X()
{
    bool f = bool.Parse(Console.ReadLine());
    int? x = null;

    if(f)
        x = 5;

    int n = f ? (x ?? 6) : 7;
}

?? 6 is highlighted as redundant.

The QFix removes it without adding any cast, which changes the expression type from int to int?, which breaks the assignment.

Viewing all articles
Browse latest Browse all 106942

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>