Type checking error in presence of layout annotation
Type checker refuses to unify type in presence of layout annotations.
For instance if we compile this contract:
type my_record is
[@layout:comb]
record [
field1 : int;
field2 : nat;
]
//declaring the function that returns the sender’s balance
function get_balance (const entry : option (int)) : my_record is
case entry of [
None -> (failwith ("ba bla"): record[field1: int ; field2 : nat])
| Some (_o) -> record [field1 = 1 ; field2 = 0n]
]
we have the following error message:
File "test.pligo", line 11, characters 13-70:
Invalid type(s).
Expected: "my_record", but got: "record[field1 -> int , field2 -> nat]"
Then if we remove the annotation the compilation does not raise anymore this type error.