fix regression of comparison of key_hash and add a test for it
This commit is contained in:
parent
eaba8e9857
commit
39fc076c2b
@ -1130,3 +1130,10 @@ let%expect_test _ =
|
|||||||
run_ligo_good [ "compile-storage" ; contract "big_map.ligo" ; "main" ; "(big_map1,unit)" ] ;
|
run_ligo_good [ "compile-storage" ; contract "big_map.ligo" ; "main" ; "(big_map1,unit)" ] ;
|
||||||
[%expect {|
|
[%expect {|
|
||||||
(Pair { Elt 23 0 ; Elt 42 0 } Unit) |}]
|
(Pair { Elt 23 0 ; Elt 42 0 } Unit) |}]
|
||||||
|
|
||||||
|
let%expect_test _ =
|
||||||
|
run_ligo_good [ "compile-contract" ; contract "key_hash_comparable.ligo" ; "main" ] ;
|
||||||
|
[%expect {|
|
||||||
|
{ parameter int ;
|
||||||
|
storage (pair (map %one key_hash nat) (big_map %two key_hash bool)) ;
|
||||||
|
code { DUP ; CDR ; NIL operation ; PAIR ; DIP { DROP } } } |}]
|
@ -16,7 +16,7 @@ module Ty = struct
|
|||||||
let tez_k = Mutez_key None
|
let tez_k = Mutez_key None
|
||||||
let int_k = Int_key None
|
let int_k = Int_key None
|
||||||
let string_k = String_key None
|
let string_k = String_key None
|
||||||
let _key_hash_k = Key_hash_key None
|
let key_hash_k = Key_hash_key None
|
||||||
let address_k = Address_key None
|
let address_k = Address_key None
|
||||||
let timestamp_k = Timestamp_key None
|
let timestamp_k = Timestamp_key None
|
||||||
let bytes_k = Bytes_key None
|
let bytes_k = Bytes_key None
|
||||||
@ -74,7 +74,7 @@ module Ty = struct
|
|||||||
| TC_operation -> fail (not_comparable "operation")
|
| TC_operation -> fail (not_comparable "operation")
|
||||||
| TC_signature -> fail (not_comparable "signature")
|
| TC_signature -> fail (not_comparable "signature")
|
||||||
| TC_key -> fail (not_comparable "key")
|
| TC_key -> fail (not_comparable "key")
|
||||||
| TC_key_hash -> fail (not_comparable "key_hash")
|
| TC_key_hash -> return key_hash_k
|
||||||
| TC_chain_id -> fail (not_comparable "chain_id")
|
| TC_chain_id -> fail (not_comparable "chain_id")
|
||||||
|
|
||||||
let comparable_type : type_value -> ex_comparable_ty result = fun tv ->
|
let comparable_type : type_value -> ex_comparable_ty result = fun tv ->
|
||||||
|
8
src/test/contracts/key_hash_comparable.ligo
Normal file
8
src/test/contracts/key_hash_comparable.ligo
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
type storage is record
|
||||||
|
one: map(key_hash, nat);
|
||||||
|
two: big_map(key_hash, bool);
|
||||||
|
end
|
||||||
|
|
||||||
|
type return is list (operation) * storage
|
||||||
|
|
||||||
|
function main (const a : int; const store : storage) : return is ((nil: list(operation)), store)
|
Loading…
Reference in New Issue
Block a user