Add tests for calling constrained functions

This commit is contained in:
Gaith Hallak
2022-06-14 13:27:00 +04:00
parent 6c17e57a7c
commit fc08fe09a5
3 changed files with 25 additions and 2 deletions
+7 -1
View File
@@ -881,7 +881,13 @@ failing_contracts() ->
<<?Pos(153,88)
"Values of type `custom_record((int, char) => bool)` are not comparable by inequality">>,
<<?Pos(154,88)
"Values of type `custom_record((int, char) => bool)` are not comparable by equality">>
"Values of type `custom_record((int, char) => bool)` are not comparable by equality">>,
<<?Pos(158,35)
"Values of type `map(int, int)` are not comparable by inequality">>,
<<?Pos(159,35)
"Values of type `('a) => 'a` are not comparable by inequality">>,
<<?Pos(163,34)
"Values of type `('b) => 'b` are not comparable by equality">>
])
, ?TYPE_ERROR(warnings,
[<<?Pos(0, 0)
@@ -153,4 +153,13 @@ main contract C =
function record_of_nomcomp_ord(x : custom_record(lam), y : custom_record(lam)) = x >= y // fail
function record_of_nomcomp_eq (x : custom_record(lam), y : custom_record(lam)) = x == y // pass
entrypoint init() = ()
entrypoint init() =
let passing_ord_ord = passing_ord([1], [2]) // pass
let passing_ord_eq = passing_ord({[1] = 2}, {[2] = 3}) // fail
let passing_ord_noncomp = passing_ord((x) => x, (x) => x) // fail
let passing_eq_ord = passing_eq([1], [2]) // pass
let passing_eq_eq = passing_eq({[1] = 2}, {[2] = 3}) // pass
let passing_eq_noncomp = passing_eq((x) => x, (x) => x) // fail
()