Project
ReSharper
Priority
Critical
Type
Cosmetics
Fix versions
2.5
State
Fixed
Assignee
Andrey Simanovsky
Subsystem
Code Insight
Affected versions
No Affected versions
Fixed in build
No Fixed in build
  • Created by   Serge Baltic
    5 years ago (05 Oct 2006 22:31)
  • Updated by   Serge Baltic
    5 years ago (26 Nov 2006 01:16)
  • Jira: RSRP-29417
    (history, comments)
 
RSRP-29417 R#->Code->Generate->Equals'n'GetHashCode: Should Check Whether Already Generated
1
Issue is visible to: All Users
  The issue is visible to the selected user group only
R# should check whether those functions are already present in the class, and disable the action (or, at least, show an error if too expensive to check in OnUpdate) if they are.

Currently, R# just silently generates the duplicates.

Issue was closed
Comments (6)
 
History
 
Linked Issues (?)
 
TeamCity Changes (0)
 
Andrey Simanovsky
  Andrey Simanovsky
09 Oct 2006 21:56
5 years ago
This behavior is useless, IMO.
Serge Baltic
  Serge Baltic
09 Oct 2006 23:58
5 years ago
The resulting code won't compile, that's what useless here.
Andrey Simanovsky
  Andrey Simanovsky
10 Oct 2006 14:55
5 years ago
Generate actions do not suppose that resulting code would necessarily compile.
Valentin Kipiatkov
  Valentin Kipiatkov
26 Oct 2006 22:20
5 years ago
IMO it definitely should be disabled when both GetHashCode and Equals are implemented. But what to do when only one of them is present? I'm not sure.
Serge Baltic
  Serge Baltic
26 Oct 2006 22:47
5 years ago
Not definitely. I think it should warn that method "such" already exists, overwrite or just generate missing? If both of them are present, then the question should be "overwrite or not?".

Eg use case: you added a new field to the struct, you want to generate the new GetHashCode+Equals, regardless of whether there were any before. You'll chose "overwrite".
Andrey Simanovsky
  Andrey Simanovsky
26 Nov 2006 01:16
5 years ago
Addiotional page added that allows to drop old implementations of Equals and GetHashCode if they are present.