diku-dk / futhark

:boom::computer::boom: A data-parallel functional programming language
http://futhark-lang.org
ISC License
2.38k stars 165 forks source link

Equality of sum types is broken #2081

Closed athas closed 9 months ago

athas commented 9 months ago

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 commented 9 months ago

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