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

RSRP-287532: Wrong Expression is always false

$
0
0
Reporter Andrew Serebryansky (andrew.serebryansky) Andrew Serebryansky (andrew.serebryansky)
Created Jan 1, 2012 7:17:41 PM
Updated Jan 2, 2012 2:06:54 PM
Resolved Jan 2, 2012 2:06:54 PM
Priority Critical
Type Bug
Fix versions Next
State Fixed
Assignee Evgeny Pasynkov (pasynkov)
Subsystem No subsystem
Affected versions 6.1
Fixed in build No Fixed in build
Example which shows the problem:

var keyToValue=new Dictionary<int, int> 0, 0}, {1, 1;
var ids=new List<int> {1, 2, 3};
var removed=false;
foreach(var id in ids) {
removed=keyToValue.Remove(id)|removed;
}
ReSharper's inspection logic underlines the right-hand-side of the loop body assignment and says "Expression is always false".
This is definitely not the case for the example above. At the end of the loop, removed is true.
This inspection bug does not arise if I reverse the order of the bitwise-or operands:
foreach(var id in ids) {
removed=removed|keyToValue.Remove(id);
}

Viewing all articles
Browse latest Browse all 106942

Trending Articles



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