diff options
| author | Edvard Thörnros <edvard.thornros@gmail.com> | 2021-03-08 21:57:52 +0100 |
|---|---|---|
| committer | Edvard Thörnros <edvard.thornros@gmail.com> | 2021-03-08 21:57:52 +0100 |
| commit | 4e6ef21576d9ec6a8861246464b1905819b68efe (patch) | |
| tree | c0e07b88e9257783990895dfc6d3ab559e82b712 /progs/tests | |
| parent | 858d5c1756b64f4973588424b8ba375136740510 (diff) | |
| download | sylt-4e6ef21576d9ec6a8861246464b1905819b68efe.tar.gz | |
fix some nice tests for the nullable_types
Diffstat (limited to 'progs/tests')
| -rw-r--r-- | progs/tests/nullable_types.sy | 33 |
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! +} + |
