aboutsummaryrefslogtreecommitdiff
path: root/bootstrap/test2.cff
blob: 0c546bb7929f3de424d943bfaaf66f36c0ab6760 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
import "libc.hff";

struct Node<T> {
   link *Node,
   value T,

   fn ok(self Node) void {
   }
}

struct Array<T, N usize> {
   m [N]T,
}

def X = 7 + 2;

struct Bit<T> {
   def Z = 3;
   fn foo(x T) T { return (~x ^ X) + Z; }
   // fn foo(x T) T { return ~x + Y; }
}

defmacro def2(x, v) [static x = (v)]

def2(Y, 3.3);

enum union Value {
   None,
   Int i32,
   Flo f32,
}

enum union Option<T> {
   None,
   Some T
}

extern fn main() void {
   let n Node<int> = {#null, 0};
   let n Node<int> = {&n, 1};
   let x Array<int, 10> = {};
   let x Array<int, 0xB - 1> = x;

   let x int #?;
   x = X + 1 + Y;

   let const v= Value:None;
   v = :Int(1 + x);
}