aboutsummaryrefslogtreecommitdiffstats
path: root/progs
diff options
context:
space:
mode:
Diffstat (limited to 'progs')
-rw-r--r--progs/tests/nullable_types.sy33
1 files changed, 33 insertions, 0 deletions
diff --git a/progs/tests/nullable_types.sy b/progs/tests/nullable_types.sy
new file mode 100644
index 0000000..2088c53
--- /dev/null
+++ b/progs/tests/nullable_types.sy
@@ -0,0 +1,33 @@
+test001 :: fn -> int {
+ a : int? = nil
+ a = 2
+ ret a
+}
+
+test002 :: fn b:bool -> int? {
+ if b {
+ ret nil
+ } else {
+ ret 0
+ }
+}
+
+// TODO(ed): Introduce type type!
+test003 :: fn {
+ a := test002! false
+ a += 1
+ a <=> 1
+}
+
+
+start :: fn {
+ test001!
+ nil <=> test002! true
+ 0 <=> test002! false
+ q : bool? = true
+ q <=> true
+ q = nil
+ q <=> nil
+ test003!
+}
+