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

RSRP-287531: Incorrect code is generated when inlining a variable that is a collection

$
0
0
Reporter Werner Strydom (bloudraak) Werner Strydom (bloudraak)
Created Jan 1, 2012 3:31:21 AM
Updated Jan 1, 2012 3:38:17 AM
Priority Normal
Type Bug
Fix versions No Fix versions
State Submitted
Assignee Sergey Shkredov (serjic.shkredov)
Subsystem Refactoring
Affected versions 6.1
Fixed in build No Fixed in build
Consider the following code snippet where ComparisonCollection is an instance of List<Comparison> (or any other collection type).
var collection = new ComparisonCollection();
collection.Add(new Comparison());
return collection;

Now put your cursor on "collection" of "return collection" and select to inline the variable. I'd expect the following to be generated because its identical in functionality to the original code:
return new ComparisonCollection {new Comparison()};

Instead the following "incorrect" code is generated:
new ComparisonCollection().Add(new Comparison());
return new ComparisonCollection();

Viewing all articles
Browse latest Browse all 106942

Trending Articles



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