Add test for accessing maps with the wrong type
This commit is contained in:
parent
0c8b95c16d
commit
8d419bc54f
@ -878,7 +878,10 @@ failing_contracts() ->
|
||||
" `x : (Cat) => Cat`">>,
|
||||
<<?Pos(52,44)
|
||||
"Cannot unify `Animal` and `Cat` in a covariant context\n"
|
||||
"when checking the type of the expression `f6() : option(Animal)` against the expected type `option(Cat)`">>
|
||||
"when checking the type of the expression `f6() : option(Animal)` against the expected type `option(Cat)`">>,
|
||||
<<?Pos(73,43)
|
||||
"Cannot unify `Animal` and `Cat` in a covariant context\n"
|
||||
"when checking the type of the expression `some_animal : Animal` against the expected type `Cat`">>
|
||||
])
|
||||
, ?TYPE_ERROR(polymorphism_variance_switching_custom_types,
|
||||
[<<?Pos(56,39)
|
||||
|
@ -61,3 +61,15 @@ main contract Main =
|
||||
|
||||
stateful function g72() : cat_cat_map = { [Chain.create()] = Chain.create() }
|
||||
stateful function f72() : animal_animal_map = g13()
|
||||
|
||||
stateful function g73() =
|
||||
let some_cat : Cat = Chain.create()
|
||||
let some_animal : Animal = some_cat
|
||||
|
||||
let some_cat_cat_map : map(Cat, Cat) = g13()
|
||||
let some_animal_animal_map : map(Animal, Animal) = some_cat_cat_map
|
||||
|
||||
let x : Animal = some_animal_animal_map[some_cat] // success
|
||||
let y : Cat = some_cat_cat_map[some_animal] // fail
|
||||
|
||||
()
|
||||
|
Loading…
x
Reference in New Issue
Block a user