From 7ec991b8d6654aaf27a005804347346e16500a47 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Edvard=20Th=C3=B6rnros?= Date: Thu, 14 Jan 2021 21:10:07 +0100 Subject: 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 --- tests/fun.tdy | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) (limited to 'tests/fun.tdy') 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 -- cgit v1.2.1