import "std:strings"; import "foo" as bar; import "./foobar"; fn foo() {} pub fn bar(x: int): int {} pub fn multiret(): int, int {} [c_export] pub fn add(a: int, b: int): int {} [c_export("add_floats")] pub fn add(a: float,b: float): float {} fn sub(a: T, b: T): T where SUBTRACT T { // do something } fn ret_arr(): [int; 10] {} fn ret_slice(): [int] {} fn ret_multislice(): [[int]] {} fn ret_ptr(): int* {} fn ret_ptrslice(): [int*] {} fn ret_arrayptr(): [int; 5]* {} fn ret_tuple(): (int, int) {} fn ret_imported(): strings:StringBuilder {} fn ret_nested(): foo@bar {} fn ret_imported_nested(): foo:bar@some@nested@shit {} constraint Foo A { whatever(A); } constraint Bar B { constraint Foo B*; constraint Foo [B]; constraint Foo (int, B); constraint Foo SomeType; } struct Foo { something: int; bar: struct { foo: int; }; } enum X { A, B, C } enum X1 { A(T1), B(T2), C(T3), } enum X2 where Constraint T1 T2 where Constraint T2 T3 { A(T1), B(T2), C(T3), } struct X { a: T; } tuple Point(int,int,int) tuple Point where Arithmetic T (T,T,T) type A = Foo; type F = Foo>; type Xa = [Y; 10]; tuple Xa (A,A,A); type Xaa = [T; 10]; type X = (T1, T2); fn foo() { let foo = X {a: 1, b: 2}; let bar = X {a: "foo" , b: "bar"}; let test = Imported:X@bar []{1,2,3}; foo.a + 1; bar.a + 1; meoooow let x-nyaaaa = []{1-nya, meow 2}; outer: loop let x = 1; x < 10; x += 1 { switch 1 { case 1: { foobar(); }, case 2: fallthrough, case 3: x, default: bar(), } } } struct Bar { y: Foo; } struct Fooo { x: enum {Foo, Bar}; } struct A { x: B; y: s32; } struct B { x: T; } struct C { x: B; } enum E { A, B, C } enum F { A(u8), B(B), C(C) } fn foo(x: u32) {} fn foo(x: s32) {} fn bar(x: f32) {} fn bar(x: f64) {} fn test() { let x = 1; // no idea what the type is foo(x); // could be u32 or s32 bar(x); // f32 and f64 conflict with u32 and s32 } type Aaaaa = int*; struct B { x: (int, int); } struct Aaaaa { x: B; y: s32; }