92 lines
1.2 KiB
Plaintext
92 lines
1.2 KiB
Plaintext
|
import "std:strings";
|
||
|
import "foo" as bar;
|
||
|
import "./foobar";
|
||
|
|
||
|
/*
|
||
|
fn foo() {}
|
||
|
|
||
|
pub fn bar(int x) -> int {}
|
||
|
|
||
|
pub fn multiret() -> int, int {}
|
||
|
|
||
|
[c_export] pub fn add(int a, int b) -> int {}
|
||
|
|
||
|
[c_export("add_floats")] pub fn add(float a, float b) -> float {}
|
||
|
|
||
|
fn sub<T>(T a, T b) -> 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<B>;
|
||
|
}
|
||
|
|
||
|
*/
|
||
|
|
||
|
struct Foo {
|
||
|
int something;
|
||
|
struct {
|
||
|
int foo;
|
||
|
} bar;
|
||
|
}
|
||
|
|
||
|
|
||
|
Foo f;
|
||
|
f.something
|
||
|
|
||
|
enum X {
|
||
|
A,
|
||
|
B,
|
||
|
C
|
||
|
}
|
||
|
|
||
|
enum X<T1, T2, T3> {
|
||
|
A(T1),
|
||
|
B(T2),
|
||
|
C(T3),
|
||
|
}
|
||
|
|
||
|
enum X<T1, T2, T3> where Constraint T1 T2 where Constraint T2 T3 {
|
||
|
A(T1),
|
||
|
B(T2),
|
||
|
C(T3),
|
||
|
}
|
||
|
|
||
|
struct X<T> {
|
||
|
T a;
|
||
|
}
|
||
|
|
||
|
tuple Point(int,int,int)
|
||
|
|
||
|
tuple Point<T> where Arithmetic T (T,T,T)
|
||
|
|
||
|
type A = Foo;
|
||
|
|
||
|
type F<X> = Foo<Bar<X>>;
|