Give clear names to the records in records variance switching test
This commit is contained in:
parent
e5c6efc8ae
commit
8067d15a41
@ -993,19 +993,16 @@ failing_contracts() ->
|
|||||||
, ?TYPE_ERROR(polymorphism_variance_switching_records,
|
, ?TYPE_ERROR(polymorphism_variance_switching_records,
|
||||||
[<<?Pos(27,13)
|
[<<?Pos(27,13)
|
||||||
"Cannot unify `Animal` and `Cat` in a covariant context\n"
|
"Cannot unify `Animal` and `Cat` in a covariant context\n"
|
||||||
"when checking the type of the pattern `r03 : rec_a(Cat)` against the expected type `Main.rec_a(Animal)`">>,
|
"when checking the type of the pattern `r03 : rec_co(Cat)` against the expected type `Main.rec_co(Animal)`">>,
|
||||||
<<?Pos(33,13)
|
<<?Pos(33,13)
|
||||||
"Cannot unify `Cat` and `Animal` in a contravariant context\n"
|
"Cannot unify `Cat` and `Animal` in a contravariant context\n"
|
||||||
"when checking the type of the pattern `r06 : rec_b(Animal)` against the expected type `Main.rec_b(Cat)`">>,
|
"when checking the type of the pattern `r06 : rec_contra(Animal)` against the expected type `Main.rec_contra(Cat)`">>,
|
||||||
<<?Pos(41,13)
|
<<?Pos(40,13)
|
||||||
"Cannot unify `Animal` and `Cat` in a covariant context\n"
|
|
||||||
"when checking the type of the pattern `r11 : rec_c(Cat)` against the expected type `Main.rec_c(Animal)`">>,
|
|
||||||
<<?Pos(47,13)
|
|
||||||
"Cannot unify `Cat` and `Animal` in a invariant context\n"
|
"Cannot unify `Cat` and `Animal` in a invariant context\n"
|
||||||
"when checking the type of the pattern `r16 : rec_d(Animal)` against the expected type `Main.rec_d(Cat)`">>,
|
"when checking the type of the pattern `r10 : rec_inv(Animal)` against the expected type `Main.rec_inv(Cat)`">>,
|
||||||
<<?Pos(48,13)
|
<<?Pos(41,13)
|
||||||
"Cannot unify `Animal` and `Cat` in a invariant context\n"
|
"Cannot unify `Animal` and `Cat` in a invariant context\n"
|
||||||
"when checking the type of the pattern `r17 : rec_d(Cat)` against the expected type `Main.rec_d(Animal)`">>])
|
"when checking the type of the pattern `r11 : rec_inv(Cat)` against the expected type `Main.rec_inv(Animal)`">>])
|
||||||
, ?TYPE_ERROR(polymorphism_variance_switching_oracles,
|
, ?TYPE_ERROR(polymorphism_variance_switching_oracles,
|
||||||
[<<?Pos(15,13)
|
[<<?Pos(15,13)
|
||||||
"Cannot unify `Cat` and `Animal` in a contravariant context\n"
|
"Cannot unify `Cat` and `Animal` in a contravariant context\n"
|
||||||
|
@ -5,12 +5,12 @@ contract Cat : Animal =
|
|||||||
entrypoint sound() = "meow"
|
entrypoint sound() = "meow"
|
||||||
|
|
||||||
main contract Main =
|
main contract Main =
|
||||||
record rec_a('a) = { x : 'a }
|
record rec_co('a) = { x : 'a ,
|
||||||
record rec_b('a) = { x : 'a => unit }
|
y : () => 'a }
|
||||||
record rec_c('a) = { x : () => 'a}
|
record rec_contra('a) = { x : 'a => unit }
|
||||||
record rec_d('a) = { x : 'a => unit,
|
record rec_inv('a) = { x : 'a => unit,
|
||||||
y : () => 'a }
|
y : () => 'a }
|
||||||
record rec_e('a) = { x : int }
|
record rec_biv('a) = { x : int }
|
||||||
|
|
||||||
stateful entrypoint new_cat() : Cat = Chain.create()
|
stateful entrypoint new_cat() : Cat = Chain.create()
|
||||||
stateful entrypoint new_animal() : Animal = new_cat()
|
stateful entrypoint new_animal() : Animal = new_cat()
|
||||||
@ -20,39 +20,32 @@ main contract Main =
|
|||||||
stateful entrypoint unit_to_cat() : Cat = new_cat()
|
stateful entrypoint unit_to_cat() : Cat = new_cat()
|
||||||
|
|
||||||
stateful entrypoint init() =
|
stateful entrypoint init() =
|
||||||
let ra : rec_a(Animal) = { x = new_animal() }
|
let ra : rec_co(Animal) = { x = new_animal(), y = unit_to_animal }
|
||||||
let rc : rec_a(Cat) = { x = new_cat() }
|
let rc : rec_co(Cat) = { x = new_cat(), y = unit_to_cat }
|
||||||
let r01 : rec_a(Animal) = ra // success
|
let r01 : rec_co(Animal) = ra // success
|
||||||
let r02 : rec_a(Animal) = rc // success
|
let r02 : rec_co(Animal) = rc // success
|
||||||
let r03 : rec_a(Cat) = ra // fail
|
let r03 : rec_co(Cat) = ra // fail
|
||||||
let r04 : rec_a(Cat) = rc // sucess
|
let r04 : rec_co(Cat) = rc // sucess
|
||||||
|
|
||||||
let ratu : rec_b(Animal) = { x = animal_to_unit }
|
let ratu : rec_contra(Animal) = { x = animal_to_unit }
|
||||||
let rctu : rec_b(Cat) = { x = cat_to_unit }
|
let rctu : rec_contra(Cat) = { x = cat_to_unit }
|
||||||
let r05 : rec_b(Animal) = ratu // success
|
let r05 : rec_contra(Animal) = ratu // success
|
||||||
let r06 : rec_b(Animal) = rctu // fail
|
let r06 : rec_contra(Animal) = rctu // fail
|
||||||
let r07 : rec_b(Cat) = ratu // success
|
let r07 : rec_contra(Cat) = ratu // success
|
||||||
let r08 : rec_b(Cat) = rctu // success
|
let r08 : rec_contra(Cat) = rctu // success
|
||||||
|
|
||||||
let ruta : rec_c(Animal) = { x = unit_to_animal }
|
let rxaya : rec_inv(Animal) = { x = animal_to_unit, y = unit_to_animal }
|
||||||
let rutc : rec_c(Cat) = { x = unit_to_cat }
|
let rxcyc : rec_inv(Cat) = { x = cat_to_unit, y = unit_to_cat }
|
||||||
let r09 : rec_c(Animal) = ruta // success
|
let r09 : rec_inv(Animal) = rxaya // success
|
||||||
let r10 : rec_c(Animal) = rutc // success
|
let r10 : rec_inv(Animal) = rxcyc // fail
|
||||||
let r11 : rec_c(Cat) = ruta // fail
|
let r11 : rec_inv(Cat) = rxaya // fail
|
||||||
let r12 : rec_c(Cat) = rutc // success
|
let r12 : rec_inv(Cat) = rxcyc // success
|
||||||
|
|
||||||
let rxaya : rec_d(Animal) = { x = animal_to_unit, y = unit_to_animal }
|
let rba : rec_biv(Animal) = { x = 1 }
|
||||||
let rxcyc : rec_d(Cat) = { x = cat_to_unit, y = unit_to_cat }
|
let rbc : rec_biv(Cat) = { x = 1 }
|
||||||
let r13 : rec_d(Animal) = rxaya // success
|
let r13 : rec_biv(Animal) = rba // success
|
||||||
let r16 : rec_d(Animal) = rxcyc // fail
|
let r14 : rec_biv(Animal) = rbc // success
|
||||||
let r17 : rec_d(Cat) = rxaya // fail
|
let r15 : rec_biv(Cat) = rba // success
|
||||||
let r20 : rec_d(Cat) = rxcyc // success
|
let r16 : rec_biv(Cat) = rbc // success
|
||||||
|
|
||||||
let rba : rec_e(Animal) = { x = 1 }
|
|
||||||
let rbc : rec_e(Cat) = { x = 1 }
|
|
||||||
let r21 : rec_e(Animal) = rba // success
|
|
||||||
let r21 : rec_e(Animal) = rbc // success
|
|
||||||
let r22 : rec_e(Cat) = rba // success
|
|
||||||
let r22 : rec_e(Cat) = rbc // success
|
|
||||||
|
|
||||||
()
|
()
|
Loading…
x
Reference in New Issue
Block a user