-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsource
More file actions
176 lines (145 loc) · 2.98 KB
/
source
File metadata and controls
176 lines (145 loc) · 2.98 KB
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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
export import ::my_module::my_submodule::sum_numbers;
export def sum_numbers ::my_module::my_submodule::sum_numbers;
export module a {
def b ::source::b::b;
export func a() {}
}
export module b {
def a ::source::a::a;
export func b() {}
}
export module hello {
module world {}
@abc def sum_numbers ::source::sum_numbers;
@mingleton
export module whats {
module up {}
@extern func putc(c: char) void;
func try_anon(anon argument: uint32) void;
func try_shadowing(mut putc: char, anon mut mut anon sum_numbers: uint) {
const my_var = 5;
{
const my_var = 'h';
const q = my_var;
}
const q = my_var;
putc = 'r';
return;
}
func try_mut(mut a: char, b: char) {
a = b;
b = a;
return b;
}
func sample1(name: bool, age: int);
func sample2(jones: void, rage: uint) uint;
export func main() {
try_anon(argument: 95, argument: 64);
try_shadowing = 'h';
sum_numbers(2, 3, 4);
const a: _ = 30 +- 2 * 3;
a = sum_numbers;
const kitty = 3;
kitty = hey;
lets_do_this1 = lets_do_this2;
sample1 = sample2;
const sul = rifuty + 9;
2 + 4;
{
mut b: uintptr;
const c;
mut e: bool = -::my_jodule;
b = --a + ::source::hella;
function(3, a: 5, b: 4)(q: -5-hey(cool: 9), e: 5) = 3;
}
return;
return ::u::b::q;
}
func test_numeric_inference() {
const a: float16 = 3.0;
const b: float32 = 9.0;
const c = a + b;
const d = 9.0 - 3;
const e: uint32 = 42;
const f: int64 = -99;
const g: float128 = e - f;
}
func whatever() {
const q = 3();
const few_args = sum_numbers();
const many_args = sum_numbers(2, 3, 4);
const nonexistent_argument = sum_numbers(2, e: 3);
const mix = sum_numbers(b: 2, a: 'h');
const a = sum_numbers(2, 3);
}
func cycle() {
const cycle_a;
const cycle_b;
const cycle_c;
cycle_b = cycle_a;
cycle_a = cycle_c;
cycle_c = cycle_b;
}
func invalid_types(cool: _) _;
func hey(cool: uintptr) uint => 2 + 2 / -cool;
export func lets_do_this1(name: bool, age: intsize, what: float128) uint1382;
export func lets_do_this2(jame: bool, aje: intsize, wjat: float128) uint1382;
/*
func john(k: int16) void {
const a = 30;
mut b: uint;
const d: int;
mut u: char = 'u';
}
func lets_do_this(name: string, age: uint) bool {
const return_value: bool = false;
}
*/
}
func greet();
}
module yo {
module hi {}
}
/*
module jogram {}
module program {
module john {}
module pupil {
module tutil {
func bello() {}
}
}
func main() { aavs /*
mut a = 3 + 3
}
func silly() void {
const e = 30
mut abc = 48
const a = 3 + 4 * -5 - 8 + 7
+ e
- (3 + 4) * 5 + abc + "hey" - 'h'
mut b = 28
const k i32 = 2
mut y i32
}
func silly(a i32, b i32, c char) void {}
func other() void {
const pure = 37
const mut = pure
const union = mut
const john = 19
john + pure = union
silly + john
silly(3, 4, 'a' - 'b')
/* } */
/*
func potato<T>(a: T, b: V) T {}
*/ +("")
"a" + 3
''
*/
'\v' 'a' 'b'
0b1
} module bogram {}
*/