From 30461c655f08e37f0758e0de137b679b789024cc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Edvard=20Th=C3=B6rnros?= Date: Tue, 9 Mar 2021 17:41:57 +0100 Subject: fix functions as optional types --- progs/tests/union_types_simple.sy | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'progs/tests') diff --git a/progs/tests/union_types_simple.sy b/progs/tests/union_types_simple.sy index 490717e..f6cf622 100644 --- a/progs/tests/union_types_simple.sy +++ b/progs/tests/union_types_simple.sy @@ -14,10 +14,23 @@ g :: fn a:bool -> int | (bool, bool) { } } +h :: fn a:bool -> int | fn -> int { + if a { + f :: fn -> int { ret 1 } + ret f + } else { + ret 1 + } +} + start :: fn { 1 <=> f! true nil <=> f! false (true, true) <=> g! false 1 <=> g! true f(true) <=> g(true) + + 1 <=> h! false + q :: h! true + 1 <=> q() } -- cgit v1.2.1