aboutsummaryrefslogtreecommitdiffstats
path: root/progs
diff options
context:
space:
mode:
authorEdvard Thörnros <edvard.thornros@gmail.com>2021-03-09 17:41:57 +0100
committerEdvard Thörnros <edvard.thornros@gmail.com>2021-03-09 17:41:57 +0100
commit30461c655f08e37f0758e0de137b679b789024cc (patch)
tree468452a89354bace1d0e3d806cab0fd622ce7de8 /progs
parent9ef8eaa4564b2e498c56cad50491f2fdcea9d643 (diff)
downloadsylt-30461c655f08e37f0758e0de137b679b789024cc.tar.gz
fix functions as optional types
Diffstat (limited to 'progs')
-rw-r--r--progs/tests/union_types_simple.sy13
1 files changed, 13 insertions, 0 deletions
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()
}