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

RSRP-288155: CA 'Compute constant value' breaks code and does no actual work

$
0
0
Reporter Evgeny Gavrin (Evgeny.Gavrin) Evgeny Gavrin (Evgeny.Gavrin)
Created Feb 3, 2012 5:34:34 PM
Updated Feb 3, 2012 5:36:23 PM
Priority Critical
Type Bug
Fix versions No Fix versions
State Submitted
Assignee Evgeny Pasynkov (pasynkov)
Subsystem Code Analysis
Affected versions 6.1.1
Fixed in build No Fixed in build
If you press Alt-Enter over "(double)" and accept the "Compute constant value" transformation - "(double)" disappears, the resulting code becomes incorrect and the constant will not be calculated.

double doubleValue;
int intValue1 = 985;
int intValue2 = 7000;

// Correct code before transformation
doubleValue = intValue2 * ((double)1 / intValue1) - 0.01;
Console.WriteLine(doubleValue); // 7....

// after (incorrect)
doubleValue = intValue2 * (1 / intValue1) - 0.01;
Console.WriteLine(doubleValue); // -0.0..

Viewing all articles
Browse latest Browse all 106942

Trending Articles



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