From e5c6efc8ae2ca1ffcf96b1987f1e7095b92f86ea Mon Sep 17 00:00:00 2001 From: Gaith Hallak Date: Tue, 24 May 2022 22:16:34 +0400 Subject: [PATCH] Test variance switching for bivariant records --- test/aeso_compiler_tests.erl | 10 +++++----- .../polymorphism_variance_switching_records.aes | 8 ++++++++ 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/test/aeso_compiler_tests.erl b/test/aeso_compiler_tests.erl index 9263c45..eeab5e4 100644 --- a/test/aeso_compiler_tests.erl +++ b/test/aeso_compiler_tests.erl @@ -991,19 +991,19 @@ failing_contracts() -> "when checking the type of the expression `TK(f_a_to_c_to_u) : tk(Animal, Cat)` against the expected type `tk(Cat, Cat)`">> ]) , ?TYPE_ERROR(polymorphism_variance_switching_records, - [<>, - <>, - <>, - <>, - <>]) , ?TYPE_ERROR(polymorphism_variance_switching_oracles, diff --git a/test/contracts/polymorphism_variance_switching_records.aes b/test/contracts/polymorphism_variance_switching_records.aes index 765cf76..445868d 100644 --- a/test/contracts/polymorphism_variance_switching_records.aes +++ b/test/contracts/polymorphism_variance_switching_records.aes @@ -10,6 +10,7 @@ main contract Main = record rec_c('a) = { x : () => 'a} record rec_d('a) = { x : 'a => unit, y : () => 'a } + record rec_e('a) = { x : int } stateful entrypoint new_cat() : Cat = Chain.create() stateful entrypoint new_animal() : Animal = new_cat() @@ -47,4 +48,11 @@ main contract Main = let r17 : rec_d(Cat) = rxaya // fail let r20 : rec_d(Cat) = rxcyc // 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 + () \ No newline at end of file