Reporter | 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).
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:
Instead the following "incorrect" code is generated:
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();