| ... | @@ -93,16 +93,16 @@ pub fn addCases(ctx: *TestContext) !void { | ... | @@ -93,16 +93,16 @@ pub fn addCases(ctx: *TestContext) !void { |
| 93 | , ""); | 93 | , ""); |
| 94 | case.addError( | 94 | case.addError( |
| 95 | \\pub export fn main() c_int { | 95 | \\pub export fn main() c_int { |
| 96 | \\ const c = @intToError(0); | 96 | \\ _ = @intToError(0); |
| 97 | \\ return 0; | 97 | \\ return 0; |
| 98 | \\} | 98 | \\} |
| 99 | , &.{":2:27: error: integer value 0 represents no error"}); | 99 | , &.{":2:21: error: integer value 0 represents no error"}); |
| 100 | case.addError( | 100 | case.addError( |
| 101 | \\pub export fn main() c_int { | 101 | \\pub export fn main() c_int { |
| 102 | \\ const c = @intToError(3); | 102 | \\ _ = @intToError(3); |
| 103 | \\ return 0; | 103 | \\ return 0; |
| 104 | \\} | 104 | \\} |
| 105 | , &.{":2:27: error: integer value 3 represents no error"}); | 105 | , &.{":2:21: error: integer value 3 represents no error"}); |
| 106 | } | 106 | } |
| 107 | | 107 | |
| 108 | { | 108 | { |
| ... | @@ -383,6 +383,7 @@ pub fn addCases(ctx: *TestContext) !void { | ... | @@ -383,6 +383,7 @@ pub fn addCases(ctx: *TestContext) !void { |
| 383 | \\ true => 2, | 383 | \\ true => 2, |
| 384 | \\ false => 3, | 384 | \\ false => 3, |
| 385 | \\ }; | 385 | \\ }; |
| | 386 | \\ _ = b; |
| 386 | \\} | 387 | \\} |
| 387 | , &.{ | 388 | , &.{ |
| 388 | ":6:9: error: duplicate switch value", | 389 | ":6:9: error: duplicate switch value", |
| ... | @@ -398,6 +399,7 @@ pub fn addCases(ctx: *TestContext) !void { | ... | @@ -398,6 +399,7 @@ pub fn addCases(ctx: *TestContext) !void { |
| 398 | \\ f64, i32 => 3, | 399 | \\ f64, i32 => 3, |
| 399 | \\ else => 4, | 400 | \\ else => 4, |
| 400 | \\ }; | 401 | \\ }; |
| | 402 | \\ _ = b; |
| 401 | \\} | 403 | \\} |
| 402 | , &.{ | 404 | , &.{ |
| 403 | ":6:14: error: duplicate switch value", | 405 | ":6:14: error: duplicate switch value", |
| ... | @@ -414,6 +416,7 @@ pub fn addCases(ctx: *TestContext) !void { | ... | @@ -414,6 +416,7 @@ pub fn addCases(ctx: *TestContext) !void { |
| 414 | \\ f16...f64 => 3, | 416 | \\ f16...f64 => 3, |
| 415 | \\ else => 4, | 417 | \\ else => 4, |
| 416 | \\ }; | 418 | \\ }; |
| | 419 | \\ _ = b; |
| 417 | \\} | 420 | \\} |
| 418 | , &.{ | 421 | , &.{ |
| 419 | ":3:30: error: ranges not allowed when switching on type 'type'", | 422 | ":3:30: error: ranges not allowed when switching on type 'type'", |
| ... | @@ -431,6 +434,7 @@ pub fn addCases(ctx: *TestContext) !void { | ... | @@ -431,6 +434,7 @@ pub fn addCases(ctx: *TestContext) !void { |
| 431 | \\ 3 => 40, | 434 | \\ 3 => 40, |
| 432 | \\ else => 50, | 435 | \\ else => 50, |
| 433 | \\ }; | 436 | \\ }; |
| | 437 | \\ _ = b; |
| 434 | \\} | 438 | \\} |
| 435 | , &.{ | 439 | , &.{ |
| 436 | ":8:14: error: unreachable else prong; all cases already handled", | 440 | ":8:14: error: unreachable else prong; all cases already handled", |
| ... | @@ -556,10 +560,10 @@ pub fn addCases(ctx: *TestContext) !void { | ... | @@ -556,10 +560,10 @@ pub fn addCases(ctx: *TestContext) !void { |
| 556 | \\const E1 = packed enum { a, b, c }; | 560 | \\const E1 = packed enum { a, b, c }; |
| 557 | \\const E2 = extern enum { a, b, c }; | 561 | \\const E2 = extern enum { a, b, c }; |
| 558 | \\export fn foo() void { | 562 | \\export fn foo() void { |
| 559 | \\ const x = E1.a; | 563 | \\ _ = E1.a; |
| 560 | \\} | 564 | \\} |
| 561 | \\export fn bar() void { | 565 | \\export fn bar() void { |
| 562 | \\ const x = E2.a; | 566 | \\ _ = E2.a; |
| 563 | \\} | 567 | \\} |
| 564 | , &.{ | 568 | , &.{ |
| 565 | ":1:12: error: enums do not support 'packed' or 'extern'; instead provide an explicit integer tag type", | 569 | ":1:12: error: enums do not support 'packed' or 'extern'; instead provide an explicit integer tag type", |
| ... | @@ -579,10 +583,10 @@ pub fn addCases(ctx: *TestContext) !void { | ... | @@ -579,10 +583,10 @@ pub fn addCases(ctx: *TestContext) !void { |
| 579 | \\ c, | 583 | \\ c, |
| 580 | \\}; | 584 | \\}; |
| 581 | \\export fn foo() void { | 585 | \\export fn foo() void { |
| 582 | \\ const x = E1.a; | 586 | \\ _ = E1.a; |
| 583 | \\} | 587 | \\} |
| 584 | \\export fn bar() void { | 588 | \\export fn bar() void { |
| 585 | \\ const x = E2.a; | 589 | \\ _ = E2.a; |
| 586 | \\} | 590 | \\} |
| 587 | , &.{ | 591 | , &.{ |
| 588 | ":3:5: error: enum fields cannot be marked comptime", | 592 | ":3:5: error: enum fields cannot be marked comptime", |
| ... | @@ -621,7 +625,7 @@ pub fn addCases(ctx: *TestContext) !void { | ... | @@ -621,7 +625,7 @@ pub fn addCases(ctx: *TestContext) !void { |
| 621 | \\ c, | 625 | \\ c, |
| 622 | \\}; | 626 | \\}; |
| 623 | \\export fn foo() void { | 627 | \\export fn foo() void { |
| 624 | \\ const x = E1.a; | 628 | \\ _ = E1.a; |
| 625 | \\} | 629 | \\} |
| 626 | , &.{ | 630 | , &.{ |
| 627 | ":3:7: error: expected ',', found 'align'", | 631 | ":3:7: error: expected ',', found 'align'", |
| ... | @@ -638,7 +642,7 @@ pub fn addCases(ctx: *TestContext) !void { | ... | @@ -638,7 +642,7 @@ pub fn addCases(ctx: *TestContext) !void { |
| 638 | \\ _, | 642 | \\ _, |
| 639 | \\}; | 643 | \\}; |
| 640 | \\export fn foo() void { | 644 | \\export fn foo() void { |
| 641 | \\ const x = E1.a; | 645 | \\ _ = E1.a; |
| 642 | \\} | 646 | \\} |
| 643 | , &.{ | 647 | , &.{ |
| 644 | ":6:5: error: redundant non-exhaustive enum mark", | 648 | ":6:5: error: redundant non-exhaustive enum mark", |
| ... | @@ -653,7 +657,7 @@ pub fn addCases(ctx: *TestContext) !void { | ... | @@ -653,7 +657,7 @@ pub fn addCases(ctx: *TestContext) !void { |
| 653 | \\ _ = 10, | 657 | \\ _ = 10, |
| 654 | \\}; | 658 | \\}; |
| 655 | \\export fn foo() void { | 659 | \\export fn foo() void { |
| 656 | \\ const x = E1.a; | 660 | \\ _ = E1.a; |
| 657 | \\} | 661 | \\} |
| 658 | , &.{ | 662 | , &.{ |
| 659 | ":5:9: error: '_' is used to mark an enum as non-exhaustive and cannot be assigned a value", | 663 | ":5:9: error: '_' is used to mark an enum as non-exhaustive and cannot be assigned a value", |
| ... | @@ -662,7 +666,7 @@ pub fn addCases(ctx: *TestContext) !void { | ... | @@ -662,7 +666,7 @@ pub fn addCases(ctx: *TestContext) !void { |
| 662 | case.addError( | 666 | case.addError( |
| 663 | \\const E1 = enum {}; | 667 | \\const E1 = enum {}; |
| 664 | \\export fn foo() void { | 668 | \\export fn foo() void { |
| 665 | \\ const x = E1.a; | 669 | \\ _ = E1.a; |
| 666 | \\} | 670 | \\} |
| 667 | , &.{ | 671 | , &.{ |
| 668 | ":1:12: error: enum declarations must have at least one tag", | 672 | ":1:12: error: enum declarations must have at least one tag", |
| ... | @@ -671,7 +675,7 @@ pub fn addCases(ctx: *TestContext) !void { | ... | @@ -671,7 +675,7 @@ pub fn addCases(ctx: *TestContext) !void { |
| 671 | case.addError( | 675 | case.addError( |
| 672 | \\const E1 = enum { a, b, _ }; | 676 | \\const E1 = enum { a, b, _ }; |
| 673 | \\export fn foo() void { | 677 | \\export fn foo() void { |
| 674 | \\ const x = E1.a; | 678 | \\ _ = E1.a; |
| 675 | \\} | 679 | \\} |
| 676 | , &.{ | 680 | , &.{ |
| 677 | ":1:12: error: non-exhaustive enum missing integer tag type", | 681 | ":1:12: error: non-exhaustive enum missing integer tag type", |
| ... | @@ -681,7 +685,7 @@ pub fn addCases(ctx: *TestContext) !void { | ... | @@ -681,7 +685,7 @@ pub fn addCases(ctx: *TestContext) !void { |
| 681 | case.addError( | 685 | case.addError( |
| 682 | \\const E1 = enum { a, b, c, b, d }; | 686 | \\const E1 = enum { a, b, c, b, d }; |
| 683 | \\pub export fn main() c_int { | 687 | \\pub export fn main() c_int { |
| 684 | \\ const x = E1.a; | 688 | \\ _ = E1.a; |
| 685 | \\} | 689 | \\} |
| 686 | , &.{ | 690 | , &.{ |
| 687 | ":1:28: error: duplicate enum tag", | 691 | ":1:28: error: duplicate enum tag", |
| ... | @@ -691,28 +695,28 @@ pub fn addCases(ctx: *TestContext) !void { | ... | @@ -691,28 +695,28 @@ pub fn addCases(ctx: *TestContext) !void { |
| 691 | case.addError( | 695 | case.addError( |
| 692 | \\pub export fn main() c_int { | 696 | \\pub export fn main() c_int { |
| 693 | \\ const a = true; | 697 | \\ const a = true; |
| 694 | \\ const b = @enumToInt(a); | 698 | \\ _ = @enumToInt(a); |
| 695 | \\} | 699 | \\} |
| 696 | , &.{ | 700 | , &.{ |
| 697 | ":3:26: error: expected enum or tagged union, found bool", | 701 | ":3:20: error: expected enum or tagged union, found bool", |
| 698 | }); | 702 | }); |
| 699 | | 703 | |
| 700 | case.addError( | 704 | case.addError( |
| 701 | \\pub export fn main() c_int { | 705 | \\pub export fn main() c_int { |
| 702 | \\ const a = 1; | 706 | \\ const a = 1; |
| 703 | \\ const b = @intToEnum(bool, a); | 707 | \\ _ = @intToEnum(bool, a); |
| 704 | \\} | 708 | \\} |
| 705 | , &.{ | 709 | , &.{ |
| 706 | ":3:26: error: expected enum, found bool", | 710 | ":3:20: error: expected enum, found bool", |
| 707 | }); | 711 | }); |
| 708 | | 712 | |
| 709 | case.addError( | 713 | case.addError( |
| 710 | \\const E = enum { a, b, c }; | 714 | \\const E = enum { a, b, c }; |
| 711 | \\pub export fn main() c_int { | 715 | \\pub export fn main() c_int { |
| 712 | \\ const b = @intToEnum(E, 3); | 716 | \\ _ = @intToEnum(E, 3); |
| 713 | \\} | 717 | \\} |
| 714 | , &.{ | 718 | , &.{ |
| 715 | ":3:15: error: enum 'test_case.E' has no tag with value 3", | 719 | ":3:9: error: enum 'test_case.E' has no tag with value 3", |
| 716 | ":1:11: note: enum declared here", | 720 | ":1:11: note: enum declared here", |
| 717 | }); | 721 | }); |
| 718 | | 722 | |
| ... | @@ -780,10 +784,10 @@ pub fn addCases(ctx: *TestContext) !void { | ... | @@ -780,10 +784,10 @@ pub fn addCases(ctx: *TestContext) !void { |
| 780 | case.addError( | 784 | case.addError( |
| 781 | \\const E = enum { a, b, c }; | 785 | \\const E = enum { a, b, c }; |
| 782 | \\pub export fn main() c_int { | 786 | \\pub export fn main() c_int { |
| 783 | \\ var x = E.d; | 787 | \\ _ = E.d; |
| 784 | \\} | 788 | \\} |
| 785 | , &.{ | 789 | , &.{ |
| 786 | ":3:14: error: enum 'test_case.E' has no member named 'd'", | 790 | ":3:10: error: enum 'test_case.E' has no member named 'd'", |
| 787 | ":1:11: note: enum declared here", | 791 | ":1:11: note: enum declared here", |
| 788 | }); | 792 | }); |
| 789 | | 793 | |
| ... | @@ -791,6 +795,7 @@ pub fn addCases(ctx: *TestContext) !void { | ... | @@ -791,6 +795,7 @@ pub fn addCases(ctx: *TestContext) !void { |
| 791 | \\const E = enum { a, b, c }; | 795 | \\const E = enum { a, b, c }; |
| 792 | \\pub export fn main() c_int { | 796 | \\pub export fn main() c_int { |
| 793 | \\ var x: E = .d; | 797 | \\ var x: E = .d; |
| | 798 | \\ _ = x; |
| 794 | \\} | 799 | \\} |
| 795 | , &.{ | 800 | , &.{ |
| 796 | ":3:17: error: enum 'test_case.E' has no field named 'd'", | 801 | ":3:17: error: enum 'test_case.E' has no field named 'd'", |