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

RSRP-292234: Impure methods called on readonly fields

$
0
0
Reporter Roman Royter (rroyter) Roman Royter (rroyter)
Created Mar 29, 2012 8:53:51 PM
Updated Mar 29, 2012 8:53:51 PM
Priority Normal
Type Unspecified
Fix versions No Fix versions
State Submitted
Assignee Unassigned
Subsystem No subsystem
Affected versions No Affected versions
Fixed in build No Fixed in build
R# gives a false positive on the following code:
private readonly Rect rect;
...
if (rect.Contains(point))
{
...
}
"Impure Method is called for readonly field of value type."

read only structs are passed by copy, so the Contains method cannot modify the original struct and therefore it is pure.
See http://stackoverflow.com/q/9927434/71263 for reference.

Viewing all articles
Browse latest Browse all 106942

Trending Articles



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