Last active 1 week ago

ncc

Revision e036798e76f7665823bae344990217ecc839a086

gistfile1.txt Raw
1❯ make test-verbose
2cargo build --release
3warning: unused variable: `expected_type`
4 --> src/compiler/ir/mod.rs:3508:9
5 |
63508 | expected_type: Option<&str>,
7 | ^^^^^^^^^^^^^ help: if this is intentional, prefix it with an underscore: `_expected_type`
8 |
9 = note: `#[warn(unused_variables)]` (part of `#[warn(unused)]`) on by default
10
11warning: method `lower_global_function_call` is never used
12 --> src/compiler/ir/mod.rs:3504:8
13 |
14 607 | impl<'a> FunctionBuilder<'a> {
15 | ---------------------------- method in this implementation
16...
173504 | fn lower_global_function_call(
18 | ^^^^^^^^^^^^^^^^^^^^^^^^^^
19 |
20 = note: `#[warn(dead_code)]` (part of `#[warn(unused)]`) on by default
21
22warning: `ncc` (lib) generated 2 warnings
23 Finished `release` profile [optimized] target(s) in 0.02s
24Running tests with verbose output...
25
26==================== array_range.nc ====================
27Expected: PASS check and run
28FINISHED CPU 0.00 MEM 0 MAXMEM -1 STALE 0 MAXMEM_RSS -1
29Running array_range.nc...
30--- Basic Slice ---
31[0, 1, 1, 2, 3]
32[1, 2, 3, 5]
33
34--- Step Slice ---
35[0, 1, 3, 8, 21, 55]
36FINISHED CPU 0.00 MEM 0 MAXMEM -1 STALE 0 MAXMEM_RSS -1
37Result: ✅ PASSED
38
39==================== array_simple.nc ====================
40Expected: PASS check and run
41FINISHED CPU 0.00 MEM 0 MAXMEM -1 STALE 0 MAXMEM_RSS -1
42Running array_simple.nc...
43Array created
44Index: 0
45Index: 1
46Index: 2
47Done
48FINISHED CPU 0.00 MEM 0 MAXMEM -1 STALE 0 MAXMEM_RSS -1
49Result: ✅ PASSED
50
51==================== assert.nc ====================
52Expected: PASS check and run
53FINISHED CPU 0.00 MEM 0 MAXMEM -1 STALE 0 MAXMEM_RSS -1
54Running assert.nc...
55Assert passed: x < y
56Assert passed: x != y
57Assert passed: true
58All assertions passed!
59FINISHED CPU 0.00 MEM 0 MAXMEM -1 STALE 0 MAXMEM_RSS -1
60Result: ✅ PASSED
61
62==================== async_await.fail.nc ====================
63Expected: FAIL check (legacy)
64Error: expected function call after 'async'
65 --> tests/async_await.fail.nc:12:26
66 |
6712 | int* future = async 5
68 | ^
69 | here
70
71Error: compilation halted: 1 errors emitted
72FINISHED CPU 0.00 MEM 0 MAXMEM -1 STALE 0 MAXMEM_RSS -1
73Result: ✅ PASSED (error as expected)
74
75==================== async_error_handling.nc ====================
76Expected: PASS check and run
77FINISHED CPU 0.00 MEM 0 MAXMEM -1 STALE 0 MAXMEM_RSS -1
78Running async_error_handling.nc...
79Success! Value: 42
80FINISHED CPU 0.00 MEM 0 MAXMEM -1 STALE 0 MAXMEM_RSS -1
81Result: ✅ PASSED
82
83==================== async.nc ====================
84Expected: PASS check and run
85FINISHED CPU 0.00 MEM 0 MAXMEM -1 STALE 0 MAXMEM_RSS -1
86Running async.nc...
87Result from async call: 5050
88Result 2: 5050
89Result 3: 5050
90All async operations completed!
91FINISHED CPU 0.00 MEM 0 MAXMEM -1 STALE 0 MAXMEM_RSS -1
92Result: ✅ PASSED
93
94==================== async_type_mismatch.fail.nc ====================
95Expected: FAIL check (legacy)
96Error: cannot initialize variable 'result' of type 'int' with value of type 'int*'
97 --> tests/async_type_mismatch.fail.nc:10:5
98 |
9910 | int result = async returnsInt()
100 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
101 |
102
103Error: cannot await non-Future type 'int'
104 --> tests/async_type_mismatch.fail.nc:14:19
105 |
10614 | int y = await x
107 | ^
108 |
109
110Error: type validation failed
111FINISHED CPU 0.00 MEM 0 MAXMEM -1 STALE 0 MAXMEM_RSS -1
112Result: ✅ PASSED (error as expected)
113
114==================== builtins_combined.nc ====================
115Expected: PASS check and run
116FINISHED CPU 0.00 MEM 0 MAXMEM -1 STALE 0 MAXMEM_RSS -1
117Running builtins_combined.nc...
118new(int) = 0
119int("789") = 789
120Assert passed: val = 100
121str(new(int)) = "0"
122All builtin function tests passed!
123FINISHED CPU 0.00 MEM 0 MAXMEM -1 STALE 0 MAXMEM_RSS -1
124Result: ✅ PASSED
125
126==================== comparison.nc ====================
127Expected: PASS check and run
128FINISHED CPU 0.00 MEM 0 MAXMEM -1 STALE 0 MAXMEM_RSS -1
129Running comparison.nc...
130String: abc
131Length: 3
1320 < 3: true
1331 < 3: true
1342 < 3: true
1353 < 3: false (CORRECT)
136FINISHED CPU 0.00 MEM 0 MAXMEM -1 STALE 0 MAXMEM_RSS -1
137Result: ✅ PASSED
138
139==================== compound.nc ====================
140Expected: PASS check and run
141FINISHED CPU 0.00 MEM 0 MAXMEM -1 STALE 0 MAXMEM_RSS -1
142Running compound.nc...
143Numerator: 20, Denominator: 31
144Numerator: 40, Denominator: 31
145x = 15
146x = 12
147x = 24
148x = 6
149x = 2
150FINISHED CPU 0.00 MEM 0 MAXMEM -1 STALE 0 MAXMEM_RSS -1
151Result: ✅ PASSED
152
153==================== functions_as_values.nc ====================
154Expected: PASS check and run
155FINISHED CPU 0.00 MEM 0 MAXMEM -1 STALE 0 MAXMEM_RSS -1
156Running functions_as_values.nc...
157FINISHED CPU 0.00 MEM 0 MAXMEM -1 STALE 0 MAXMEM_RSS -1
158Result: ✅ PASSED
159
160==================== listdir.nc ====================
161Expected: PASS check and run
162FINISHED CPU 0.00 MEM 0 MAXMEM -1 STALE 0 MAXMEM_RSS -1
163Running listdir.nc...
164=== Using io.stat (single file) ===
165README.md: size=786, is_dir=0, mode=420
166
167=== Using io.readdir (directory listing) ===
168Found 13 entries:
169 [dir] .github: 4096 bytes
170 [file] Makefile: 5814 bytes
171 [dir] tests: 4096 bytes
172 [dir] target: 4096 bytes
173 [file] .gitignore: 708 bytes
174 [dir] .git: 4096 bytes
175 [file] LICENSE: 11356 bytes
176 [dir] .idea: 4096 bytes
177 [dir] src: 4096 bytes
178 [file] Cargo.lock: 6566 bytes
179 [file] Cargo.toml: 238 bytes
180 [dir] std: 4096 bytes
181 [file] README.md: 786 bytes
182
183=== Recursive directory listing ===
184 [file] Makefile
185 [dir] tests/
186 [file] variadic_debug.nc
187 [file] testing.test.nc
188 [file] scope_leak_if.fail.nc
189 [file] struct.nc
190 [file] struct_array.nc
191 [file] panic.fail.run.nc
192 [file] functions_as_values.nc
193 [file] variadic_iter.nc
194 [file] async.nc
195 [file] variadic.nc
196 [file] builtins_combined.nc
197 [file] type_casts.nc
198 [file] simple_slice.nc
199 [file] listdir.nc
200 [file] scope_leak.fail.nc
201 [file] variadic_simple.nc
202 [file] comparison.nc
203 [file] type_alias.nc
204 [file] str.nc
205 [file] loops.nc
206 [file] tuples_comprehensive.nc
207 [file] array_simple.nc
208 [file] type_alias_func.nc
209 [file] async_type_mismatch.fail.nc
210 [file] new.nc
211 [file] assert.nc
212 [file] loop_scope.nc
213 [file] shadowing.nc
214 [file] type_alias_nested.nc
215 [file] array_range.nc
216 [file] async_await.fail.nc
217 [file] operators.nc
218 [file] time_now.nc
219 [file] compound.nc
220 [file] async_error_handling.nc
221 [file] time_sleep.nc
222 [file] .gitignore
223 [file] LICENSE
224 [dir] src/
225 [file] lib.rs
226 [dir] compiler/
227 [dir] passes/
228 [file] mod.rs
229 [file] optimizations.rs
230 [dir] syntax/
231 [file] ast.rs
232 [file] mod.rs
233 [file] lexer.rs
234 [file] parser.rs
235 [file] ast_printer.rs
236 [dir] source/
237 [file] mod.rs
238 [file] driver.rs
239 [file] mod.rs
240 [dir] hir/
241 [file] mod.rs
242 [dir] backend/
243 [file] mod.rs
244 [file] asm.rs
245 [dir] diagnostics/
246 [file] mod.rs
247 [dir] ir/
248 [file] mod.rs
249 [file] cli.rs
250 [file] main.rs
251 [file] Cargo.lock
252 [file] Cargo.toml
253 [dir] std/
254 [file] os.nc
255 [file] math.nc
256 [file] io.nc
257 [file] time.nc
258 [file] README.md
259FINISHED CPU 0.00 MEM 0 MAXMEM -1 STALE 0 MAXMEM_RSS -1
260Result: ✅ PASSED
261
262==================== loop_scope.nc ====================
263Expected: PASS check and run
264FINISHED CPU 0.00 MEM 0 MAXMEM -1 STALE 0 MAXMEM_RSS -1
265Running loop_scope.nc...
266n: 0 1
267n: 1 2
268n: 2 3
269x: 2
270FINISHED CPU 0.00 MEM 0 MAXMEM -1 STALE 0 MAXMEM_RSS -1
271Result: ✅ PASSED
272
273==================== loops.nc ====================
274Expected: PASS check and run
275FINISHED CPU 0.00 MEM 0 MAXMEM -1 STALE 0 MAXMEM_RSS -1
276Running loops.nc...
277a = 0
278a = 1
279a = 2
280a = 3
281a = 4
282a = 5
283a = 6
284a = 7
285a = 8
286a = 9
287b = 2
288b = 1
2891
2902
2913
2924
2935
2946
2957
2968
2979
29810
29911
30012
30113
30214
30315
30416
30517
30618
30719
30820
3091
3103
3115
3127
3139
31411
31513
31615
31717
31819
319FINISHED CPU 0.00 MEM 0 MAXMEM -1 STALE 0 MAXMEM_RSS -1
320Result: ✅ PASSED
321
322==================== new.nc ====================
323Expected: PASS check and run
324FINISHED CPU 0.00 MEM 0 MAXMEM -1 STALE 0 MAXMEM_RSS -1
325Running new.nc...
326new(int) = 0
327new(bool) = 0
328new(str) = ""
329new(int) again = 0
330FINISHED CPU 0.00 MEM 0 MAXMEM -1 STALE 0 MAXMEM_RSS -1
331Result: ✅ PASSED
332
333==================== operators.nc ====================
334Expected: PASS check and run
335FINISHED CPU 0.00 MEM 0 MAXMEM -1 STALE 0 MAXMEM_RSS -1
336Running operators.nc...
337=== Arithmetic Operators ===
338a = 10, b = 3
339a + b = 13
340a - b = 7
341a * b = 30
342a / b = 3
343a % b = 1
344a ** b = 1000
345
346=== Comparison Operators ===
347a == b: 0
348a != b: 1
349a < b: 0
350a > b: 1
351a <= b: 0
352a >= b: 1
353
354=== Logical Operators ===
355x = 1, y = 0
356x and y: 0
357x or y: 1
358not x: 0
359not y: 1
360
361=== Bitwise Operators ===
362c = 5, d = 3
363c << 1 = 10
364c >> 1 = 2
365c & d = 1
366c | d = 7
367c ^ d = 6
368!c = -6
369
370=== Concatenation Operator ===
371s1 <> s2 <> s3 = Hello World
372arr1 <> arr2: concatenated (array length: 771)
373
374=== Unary Operators ===
375e = 42
376-e = -42
377!e = -43
378f = 1
379not f = 0
380
381=== Operator Precedence ===
3822 + 3 * 4 = 14
383true and false or true = 1
3841 + 2 << 1 = 6
385
386=== All tests completed ===
387FINISHED CPU 0.00 MEM 0 MAXMEM -1 STALE 0 MAXMEM_RSS -1
388Result: ✅ PASSED
389
390==================== panic.fail.run.nc ====================
391Expected: PASS check, FAIL run
392FINISHED CPU 0.00 MEM 0 MAXMEM -1 STALE 0 MAXMEM_RSS -1
393Running panic.fail.run.nc...
394Test panic messageFINISHED CPU 0.00 MEM 0 MAXMEM -1 STALE 0 MAXMEM_RSS -1
395Result: ✅ PASSED (runtime error as expected)
396
397==================== scope_leak.fail.nc ====================
398Expected: FAIL check (legacy)
399Error: undefined variable 'n'
400 --> tests/scope_leak.fail.nc:7:13
401 |
4027 | int x = n
403 | ^
404 | here
405
406Error: compilation halted: 1 errors emitted
407FINISHED CPU 0.00 MEM 0 MAXMEM -1 STALE 0 MAXMEM_RSS -1
408Result: ✅ PASSED (error as expected)
409
410==================== scope_leak_if.fail.nc ====================
411Expected: FAIL check (legacy)
412Error: undefined variable 'y'
413 --> tests/scope_leak_if.fail.nc:5:13
414 |
4155 | int z = y
416 | ^
417 | here
418
419Error: compilation halted: 1 errors emitted
420FINISHED CPU 0.00 MEM 0 MAXMEM -1 STALE 0 MAXMEM_RSS -1
421Result: ✅ PASSED (error as expected)
422
423==================== shadowing.nc ====================
424Expected: PASS check and run
425FINISHED CPU 0.00 MEM 0 MAXMEM -1 STALE 0 MAXMEM_RSS -1
426Running shadowing.nc...
4271
428hello
4291
430hello
431FINISHED CPU 0.00 MEM 0 MAXMEM -1 STALE 0 MAXMEM_RSS -1
432Result: ✅ PASSED
433
434==================== simple_slice.nc ====================
435Expected: PASS check and run
436FINISHED CPU 0.00 MEM 0 MAXMEM -1 STALE 0 MAXMEM_RSS -1
437Running simple_slice.nc...
438Array: [1, 2, 3, 4, 5]
439nums[1:3]: [2, 3, 4]
440FINISHED CPU 0.00 MEM 0 MAXMEM -1 STALE 0 MAXMEM_RSS -1
441Result: ✅ PASSED
442
443==================== str.nc ====================
444Expected: PASS check and run
445FINISHED CPU 0.00 MEM 0 MAXMEM -1 STALE 0 MAXMEM_RSS -1
446Running str.nc...
4470:c
4481:o
4492:o
4503:k
4514:i
4525:e
4536:
4547:🍪
4550:c
4561:o
4572:o
4583:k
4594:i
4605:e
4616:
4627:🍪
463FINISHED CPU 0.00 MEM 0 MAXMEM -1 STALE 0 MAXMEM_RSS -1
464Result: ✅ PASSED
465
466==================== struct_array.nc ====================
467Expected: PASS check and run
468FINISHED CPU 0.00 MEM 0 MAXMEM -1 STALE 0 MAXMEM_RSS -1
469Running struct_array.nc...
470Person created: Alice, 30
471Array created
472Index: 0
473Name: Alice, Age: 30
474Index: 1
475Name: Bob, Age: 25
476Done
477FINISHED CPU 0.00 MEM 0 MAXMEM -1 STALE 0 MAXMEM_RSS -1
478Result: ✅ PASSED
479
480==================== struct.nc ====================
481Expected: PASS check and run
482FINISHED CPU 0.00 MEM 0 MAXMEM -1 STALE 0 MAXMEM_RSS -1
483Running struct.nc...
484Name: Alice, Age: 30
485name Alice
486age 30
487Numerator: 11, Denominator: 32
488Numerator: 20, Denominator: 62
489Numerator: 40, Denominator: 62
490Name: Bob, Age: 25
491name Bob
492age 25
493Name: Alice, Age: 30
494name Alice
495age 30
496Name: Charlie, Age: 35
497name Charlie
498age 35
499FINISHED CPU 0.00 MEM 0 MAXMEM -1 STALE 0 MAXMEM_RSS -1
500Result: ✅ PASSED
501
502==================== testing.test.nc ====================
503Expected: PASS check and test
504FINISHED CPU 0.00 MEM 0 MAXMEM -1 STALE 0 MAXMEM_RSS -1
505Testing testing.test.nc...
506
507Test results: 1 passed, 0 failed
508FINISHED CPU 0.00 MEM 0 MAXMEM -1 STALE 0 MAXMEM_RSS -1
509Result: ✅ PASSED
510
511==================== time_now.nc ====================
512Expected: PASS check and run
513FINISHED CPU 0.00 MEM 0 MAXMEM -1 STALE 0 MAXMEM_RSS -1
514Running time_now.nc...
515Current timestamp: 1764386923
516Timestamp after 1s: 1764386924
517FINISHED CPU 0.01 MEM 7616 MAXMEM 7616 STALE 1 MAXMEM_RSS 5316
518Result: ✅ PASSED
519
520==================== time_sleep.nc ====================
521Expected: PASS check and run
522FINISHED CPU 0.00 MEM 0 MAXMEM -1 STALE 0 MAXMEM_RSS -1
523Running time_sleep.nc...
524Start
525End
526FINISHED CPU 0.01 MEM 7608 MAXMEM 7608 STALE 2 MAXMEM_RSS 5172
527Result: ✅ PASSED
528
529==================== tuples_comprehensive.nc ====================
530Expected: PASS check and run
531FINISHED CPU 0.00 MEM 0 MAXMEM -1 STALE 0 MAXMEM_RSS -1
532Running tuples_comprehensive.nc...
533--- Basic Tuple ---
534t1[0]: 1
535t1[1]: Hi
536
537--- Optional Tuple ---
538result[0] is set
539result[1] is none
540
541--- Return Tuple ---
542vals: 6, -2
543
544--- Indexing ---
545vals[0]: 1
546vals[1]: hi
547vals[2]: 2
548
549--- Destructuring ---
550a: 1, b: 2
551x: 10, y: Test
552FINISHED CPU 0.00 MEM 0 MAXMEM -1 STALE 0 MAXMEM_RSS -1
553Result: ✅ PASSED
554
555==================== type_alias_func.nc ====================
556Expected: PASS check and run
557FINISHED CPU 0.00 MEM 0 MAXMEM -1 STALE 0 MAXMEM_RSS -1
558Running type_alias_func.nc...
559ID: 123, Name: Alice
560FINISHED CPU 0.00 MEM 0 MAXMEM -1 STALE 0 MAXMEM_RSS -1
561Result: ✅ PASSED
562
563==================== type_alias.nc ====================
564Expected: PASS check and run
565FINISHED CPU 0.00 MEM 0 MAXMEM -1 STALE 0 MAXMEM_RSS -1
566Running type_alias.nc...
567Type alias test passed!
568FINISHED CPU 0.00 MEM 0 MAXMEM -1 STALE 0 MAXMEM_RSS -1
569Result: ✅ PASSED
570
571==================== type_alias_nested.nc ====================
572Expected: PASS check and run
573FINISHED CPU 0.00 MEM 0 MAXMEM -1 STALE 0 MAXMEM_RSS -1
574Running type_alias_nested.nc...
575x = 42
576FINISHED CPU 0.00 MEM 0 MAXMEM -1 STALE 0 MAXMEM_RSS -1
577Result: ✅ PASSED
578
579==================== type_casts.nc ====================
580Expected: PASS check and run
581FINISHED CPU 0.00 MEM 0 MAXMEM -1 STALE 0 MAXMEM_RSS -1
582Running type_casts.nc...
583int("123") = 123
584str(456) = 456
585bool(0) = 0
586bool(1) = 1
587bool(42) = 1
588FINISHED CPU 0.00 MEM 0 MAXMEM -1 STALE 0 MAXMEM_RSS -1
589Result: ✅ PASSED
590
591==================== variadic_debug.nc ====================
592Expected: PASS check and run
593FINISHED CPU 0.00 MEM 0 MAXMEM -1 STALE 0 MAXMEM_RSS -1
594Running variadic_debug.nc...
595Starting sum
596About to iterate
597In loop, index: 0
598Adding: 1
599In loop, index: 1
600Adding: 2
601In loop, index: 2
602Adding: 3
603Final total: 6
604Result: 6
605FINISHED CPU 0.00 MEM 0 MAXMEM -1 STALE 0 MAXMEM_RSS -1
606Result: ✅ PASSED
607
608==================== variadic_iter.nc ====================
609Expected: PASS check and run
610FINISHED CPU 0.00 MEM 0 MAXMEM -1 STALE 0 MAXMEM_RSS -1
611Running variadic_iter.nc...
612Starting sum
613Adding: 1
614Adding: 2
615Adding: 3
616Final total: 6
617Result: 6
618FINISHED CPU 0.00 MEM 0 MAXMEM -1 STALE 0 MAXMEM_RSS -1
619Result: ✅ PASSED
620
621==================== variadic.nc ====================
622Expected: PASS check and run
623FINISHED CPU 0.00 MEM 0 MAXMEM -1 STALE 0 MAXMEM_RSS -1
624Running variadic.nc...
625Sum1 (10): 10
626Sum2 (10+5): 15
627Sum3 (10+5+10+20): 45
628Hello World!
629No Newline
630FINISHED CPU 0.00 MEM 0 MAXMEM -1 STALE 0 MAXMEM_RSS -1
631Result: ✅ PASSED
632
633==================== variadic_simple.nc ====================
634Expected: PASS check and run
635FINISHED CPU 0.00 MEM 0 MAXMEM -1 STALE 0 MAXMEM_RSS -1
636Running variadic_simple.nc...
637Got args
638Done
639FINISHED CPU 0.00 MEM 0 MAXMEM -1 STALE 0 MAXMEM_RSS -1
640Result: ✅ PASSED
641
642==================== Summary ====================
643Results: 36 passed, 0 failed
644~/git/nc mast