| ... | ... | @@ -430,33 +430,6 @@ pub fn main(args: [][]u8) -> %void { |
| 430 | 430 | } |
| 431 | 431 | )SOURCE", "9\n8\n7\n6\n0\n1\n2\n3\n9\n8\n7\n6\n0\n1\n2\n3\n"); |
| 432 | 432 | |
| 433 | | add_simple_case("pointer to void return type", R"SOURCE( |
| 434 | | const io = @import("std").io; |
| 435 | | const x = void{}; |
| 436 | | fn f() -> &void { |
| 437 | | %%io.stdout.printf("OK\n"); |
| 438 | | return &x; |
| 439 | | } |
| 440 | | pub fn main(args: [][]u8) -> %void { |
| 441 | | const a = f(); |
| 442 | | return *a; |
| 443 | | } |
| 444 | | )SOURCE", "OK\n"); |
| 445 | | |
| 446 | | add_simple_case("call result of if else expression", R"SOURCE( |
| 447 | | const io = @import("std").io; |
| 448 | | fn a() -> []u8 { "a\n" } |
| 449 | | fn b() -> []u8 { "b\n" } |
| 450 | | fn f(x: bool) { |
| 451 | | %%io.stdout.printf((if (x) a else b)()); |
| 452 | | } |
| 453 | | pub fn main(args: [][]u8) -> %void { |
| 454 | | f(true); |
| 455 | | f(false); |
| 456 | | } |
| 457 | | )SOURCE", "a\nb\n"); |
| 458 | | |
| 459 | | |
| 460 | 433 | add_simple_case_libc("expose function pointer to C land", R"SOURCE( |
| 461 | 434 | const c = @c_import(@c_include("stdlib.h")); |
| 462 | 435 | |
| ... | ... | @@ -502,18 +475,6 @@ export fn main(argc: c_int, argv: &&u8) -> c_int { |
| 502 | 475 | )SOURCE", "3.25\n3\n3.00\n-0.40\n"); |
| 503 | 476 | |
| 504 | 477 | |
| 505 | | add_simple_case("const expression eval handling of variables", R"SOURCE( |
| 506 | | const io = @import("std").io; |
| 507 | | pub fn main(args: [][]u8) -> %void { |
| 508 | | var x = true; |
| 509 | | while (x) { |
| 510 | | x = false; |
| 511 | | } |
| 512 | | %%io.stdout.printf("OK\n"); |
| 513 | | } |
| 514 | | )SOURCE", "OK\n"); |
| 515 | | |
| 516 | | |
| 517 | 478 | add_simple_case("incomplete struct parameter top level decl", R"SOURCE( |
| 518 | 479 | const io = @import("std").io; |
| 519 | 480 | struct A { |