add type aliases, rework compiler, remove optimization

This commit is contained in:
Neemek 2026-07-12 11:34:17 +02:00
parent 94b12f28ab
commit d54249cffe
Signed by: neemek
GPG key ID: 84FFE4D7D40AB25E
12 changed files with 869 additions and 1597 deletions

View file

@ -1,7 +1,7 @@
assertEq((1, 2), (1, 2))
assertEq(type((1,)), type((1,)))
assertEq(typeof((1,)), typeof((1,)))
assertEq((1,), (1,))
fn neighbours(n: int) -> (int, int) {

View file

@ -1,8 +1,15 @@
assertEq(type(1), "int")
assertEq(type("Hello"), "string")
assertEq(type(true), "boolean")
assertEq(typeof(1), "int")
assertEq(typeof("Hello"), "string")
assertEq(typeof(true), "boolean")
# lists
assertEq(type(["Hello", "world"]), "list[string]")
assertEq(type([0, 1]), "list[int]")
assertEq(typeof(["Hello", "world"]), "[string]")
assertEq(typeof([0, 1]), "[int]")
assertEq(typeof((0, 1)), "(int, int)")
type Vec2 = (int, int)
fn add(a: Vec2, b: Vec2) -> Vec2 {
(a[0] + b[0], a[1] + b[1])
}