unoplatform / Uno.CodeGen

A set of source generators for equality, immutability, ...
Other
90 stars 11 forks source link

EqualityHash should work with enums #110

Open jeanplevesque opened 5 years ago

jeanplevesque commented 5 years ago

I'm submitting a...

Current behavior

Writing this:

[EqualityHash]
public DayOfWeek DayOfWeek { get; }

yields this warning:

Type DayOfWeek of member DayOfWeek doesn't implements .GetHashCode(): it won't be used for hash computation. If you can't change the type System.DayOfWeek, you should use a custom hash method or a custom comparer. Alternatively, use something else for hash computation.

Expected behavior

No warning. The numerical value from the enum should be used for the hashcode computation.

Environment

Nuget Package: Uno.Equality

Package Version(s): 1.27.0

Affected platform(s):
- [x] iOS
- [x] Android
- [x] WebAssembly
- [x] Windows
- [ ] Build tasks

Visual Studio
- [x] 2017 (version: )
- [x] 2017 Preview (version: )
- [ ] for Mac (version: )

Relevant plugins
- [ ] Resharper (version: )