History | Log In     View a printable version of the current page.  
Issue Details (XML | Word | Printable)

Key: RSRP-59166
Type: Bug Bug
Status: Open Open
Priority: Normal Normal
Assignee: Alexander Zverev
Reporter: William Dean
Votes: 0
Watchers: 1
Operations

If you were logged in you would be able to see more operations.
ReSharper

"Initialise Field From Constructor Parameter" can generate invalid duplicate ctor parameters

Created: 24 Feb 08 14:03   Updated: 06 May 08 18:57
Component/s: Generate Action
Fix Version/s: 4.0
Security Level: Everybody (All jira users)

Original Estimate: Unknown Remaining Estimate: Unknown Time Spent: Unknown

Build: 735


 Description  « Hide
If you create a class like this:

class TestClass
{
int _myField;

public TestClass(int myField)
{

}
}

And then hit Alt-Enter on the _myField member and choose "Initialse Field From Constructor Parameter", Resharper changes the constructor to the following:

public TestClass(int myField, int myField)

{ _myField = myField; }

Clearly this is not what's intended, and doesn't compile, either. Resharper should skip adding existing constructor parameters and just add the assignment.

(Just as a note, if you hit Alt-Enter on the 'myField' constructor parameter and chose 'Initialize field...', then the appropriate code IS generated without any spurious duplication)



 All   Comments   Work Log   Change History      Sort Order:
There are no comments yet on this issue.