hazel icon indicating copy to clipboard operation
hazel copied to clipboard

Polymorphic equality

Open GuoDCZ opened this issue 4 months ago • 12 comments

In progress handling #1252.

Front-end tests:

test 1 == 2 end;
test 1. == 1. end;
test false != false end;
test "str" == "str" end;
test [1,2] != [2,1] end;
test (false, "") == (false, "") end;
type T = +A+B(Int) in
test A == B(1) end;
test A == A end;
#Static Error: type inconsistent#
1 == 1.;
"" == false;
#Static Error: type contains arrow#
let f = fun x -> x in
f == f;
string_compare == string_compare;
let a : +A+B(Int->Int) =    in
a == a;
let a : rec R -> A(Int->Int) + R =    in
a == a;
let a = typfun A -> fun x : A -> x in
a == a;
let a = (1, [f]) in
a == a; 
#Dynamic Error: type inconsistent#
let a : ? = 2. in
1 == a;
#Dynamic Error: type contains arrow#
let f : ? = fun x -> x in
f == f

GuoDCZ avatar Apr 15 '24 17:04 GuoDCZ