aboutsummaryrefslogtreecommitdiffstats
path: root/tests/fun.tdy
diff options
context:
space:
mode:
authorEdvard Thörnros <edvard.thornros@gmail.com>2021-01-14 21:10:07 +0100
committerGustav Sörnäs <gustav@sornas.net>2021-01-15 16:57:56 +0100
commit7ec991b8d6654aaf27a005804347346e16500a47 (patch)
treebf36be24f2a8dffa4589aecfce75d0f0bf55f440 /tests/fun.tdy
parent4e6071aee97a26610aeee423d830a695b8c4d563 (diff)
downloadsylt-7ec991b8d6654aaf27a005804347346e16500a47.tar.gz
Start of typesystem
There's a type system, that kinda works There needs to be better parsing of types, since not all types are currently parsable. Some of them are, and the simple stuff works! :D
Diffstat (limited to 'tests/fun.tdy')
-rw-r--r--tests/fun.tdy16
1 files changed, 14 insertions, 2 deletions
diff --git a/tests/fun.tdy b/tests/fun.tdy
index 8b94cad..8dc3b77 100644
--- a/tests/fun.tdy
+++ b/tests/fun.tdy
@@ -2,13 +2,13 @@
f := fn {
print 1
}
-f() <=> true
+f()
// Simple
f2 := fn a: int {
print a
}
-f2(2) <=> true
+f2(2)
// Return value
f3 := fn -> int {
@@ -39,3 +39,15 @@ g := fn f: int {
}
g(h) <=> 1
+
+
+q := fn i: int -> int {
+ if i == 1 {
+ ret 2
+ } else {
+ ret 3
+ }
+}
+
+q(1) <=> 2
+q(0) <=> 3