diff --git a/src/bin/expect_tests/contract_tests.ml b/src/bin/expect_tests/contract_tests.ml index d68369a3f..2a3c4bd8d 100644 --- a/src/bin/expect_tests/contract_tests.ml +++ b/src/bin/expect_tests/contract_tests.ml @@ -1130,3 +1130,10 @@ let%expect_test _ = run_ligo_good [ "compile-storage" ; contract "big_map.ligo" ; "main" ; "(big_map1,unit)" ] ; [%expect {| (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 } } } |}] \ No newline at end of file diff --git a/src/passes/8-compiler/compiler_type.ml b/src/passes/8-compiler/compiler_type.ml index 3e8690bdc..9e7d874b0 100644 --- a/src/passes/8-compiler/compiler_type.ml +++ b/src/passes/8-compiler/compiler_type.ml @@ -16,7 +16,7 @@ module Ty = struct let tez_k = Mutez_key None let int_k = Int_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 timestamp_k = Timestamp_key None let bytes_k = Bytes_key None @@ -74,7 +74,7 @@ module Ty = struct | TC_operation -> fail (not_comparable "operation") | TC_signature -> fail (not_comparable "signature") | 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") let comparable_type : type_value -> ex_comparable_ty result = fun tv -> diff --git a/src/test/contracts/key_hash_comparable.ligo b/src/test/contracts/key_hash_comparable.ligo new file mode 100644 index 000000000..02003b927 --- /dev/null +++ b/src/test/contracts/key_hash_comparable.ligo @@ -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) \ No newline at end of file