Skip to content

Work on #74: allow customizing whether the == and != operators are generated for classes#75

Open
fraluderin wants to merge 1 commit intodiegofrata:mainfrom
fraluderin:main
Open

Work on #74: allow customizing whether the == and != operators are generated for classes#75
fraluderin wants to merge 1 commit intodiegofrata:mainfrom
fraluderin:main

Conversation

@fraluderin
Copy link
Copy Markdown

Proposed draft implementation: added parameter OverrideEqualityOperators in EquatableAttribute to customize equality operators override behavior; updated ClassEqualityGenerator to observe OverrideEqualityOperators parameter; added test cases BaseEqualityWithoutOperators

…stomize equality operators override behavior; updated ClassEqualityGenerator to observe OverrideEqualityOperators parameter; added test cases BaseEqualityWithoutOperators
@diegofrata
Copy link
Copy Markdown
Owner

Hi @fraluderin. It looks as this PR was based off main. There has some significant rework in the the develop branch for version 4.0 which I just released today. This will need a rebase before it can be reviewed.

@fraluderin
Copy link
Copy Markdown
Author

Hi @diegofrata, no problem.
I can rebase in the next few days.

I'll ask if I’m in doubt.

@diegofrata
Copy link
Copy Markdown
Owner

One concern is that OverrideEqualityOperators correctly only works on classes and does nothing for structs and records. I think this needs to be quite clear in the docs but also it would be useful to have an analyzer that warns the user that setting it to false on a struct/record does nothing.

@osexpert
Copy link
Copy Markdown

"One concern is that OverrideEqualityOperators correctly only works on classes and does nothing for structs and records"
Maybe it could be solved by rephrasing it, eg. GenerateClassEqualityOperators = true (default)

@diegofrata
Copy link
Copy Markdown
Owner

@osexpert I think that would do, but an analyzer is always a good call!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants