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

RSRP-453699: 'Merge conditional expression' mistakenly inserts ?. after non-nullable type

$
0
0
Reporter Vladimir Reshetnikov (nikov) Vladimir Reshetnikov (nikov)
Created Feb 10, 2016 10:03:57 PM
Updated Apr 11, 2018 8:06:13 PM
Subsystem Code Analysis - C#
Assignee Alexander Shvedov (shvedov)
Priority Critical
State In Progress
Type Bug
Fix version 2017.2
Affected versions 10.0.2
Fixed In Version ReSharper 2018.1 EAP 7
VsVersion VS 2015 RTM
using System;

class C
{
int? GetYear(DateTime x)
{
return x == null ? (int?) null : x.Year; // Invoke 'Merge conditional' QF
}
}

ACTUAL:

        return x?.Year;

EXPECTED:

        return x.Year;

Viewing all articles
Browse latest Browse all 106942

Trending Articles



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