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

Equality of sum types is broken #2081

Closed
athas opened this issue Jan 9, 2024 · 1 comment
Closed

Equality of sum types is broken #2081

athas opened this issue Jan 9, 2024 · 1 comment

Comments

@athas
Copy link
Member

athas commented Jan 9, 2024

Incredibly we didn't notice until now.

-- ==
-- entry: test_sum
-- script input { mk_sum 1i32 }
-- output { false }

type sum = #none | #color i32

entry mk_sum (x: i32) : sum = #color x
entry test_sum (s: sum) = s != #none

It is internalisation that messes it up and compares even values from the unused constructors.

@athas
Copy link
Member Author

athas commented Jan 9, 2024

Of course, a reasonable question could be if we should just ban equality on sum types in the type checker.

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

No branches or pull requests

1 participant