Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Union<T1, T2> comparisons are broken #1

Closed
DavidArno opened this issue Jul 1, 2015 · 0 comments
Closed

Union<T1, T2> comparisons are broken #1

DavidArno opened this issue Jul 1, 2015 · 0 comments
Labels

Comments

@DavidArno
Copy link
Owner

Comparing two Union<int, string>, where one is an int and the other is a string can result in equality being incorrectly reported, as exhibited via this code snippet:

var a = new Union<int, string>(0);
var b = new Union<int, string>("1234");
Assert.IsFalse(a.Equals(b));

The problem is that Union<int, string>("1234") will internally store the default value (0) for the int value and so the two match.

@DavidArno DavidArno added the Bug label Jul 1, 2015
DavidArno added a commit that referenced this issue Jul 1, 2015
…alues.

Issue #2 Value-based equality implemented for union of 3 and 4.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant