From 3b7b207527a2d2532e69208183c809ce115dbcd2 Mon Sep 17 00:00:00 2001 From: Gaith Hallak Date: Mon, 25 Apr 2022 19:50:14 +0400 Subject: [PATCH] Add tests for option and type aliases --- .../contracts/polymorphism_variance_switching.aes | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/test/contracts/polymorphism_variance_switching.aes b/test/contracts/polymorphism_variance_switching.aes index 434ff9f..cfe7b80 100644 --- a/test/contracts/polymorphism_variance_switching.aes +++ b/test/contracts/polymorphism_variance_switching.aes @@ -48,3 +48,18 @@ main contract Main = stateful function g5(x : (Animal => Animal)) : Cat = Chain.create() stateful function f5(x : (Cat => Cat)) : Animal = g5(x) + + stateful function g6() : option(Cat) = Some(Chain.create()) + stateful function f6() : option(Animal) = g6() + stateful function h6() : option(Cat) = f6() + + type cat_type = Cat + type animal_type = Animal + type cat_cat_map = map(cat_type, cat_type) + type animal_animal_map = map(animal_type, animal_type) + + stateful function g71(x : animal_type) : cat_type = Chain.create() + stateful function f71(x : cat_type) : animal_type = g1(x) + + stateful function g72() : cat_cat_map = { [Chain.create()] = Chain.create() } + stateful function f72() : animal_animal_map = g13()