| ... | ... | @@ -631,6 +631,49 @@ pub fn addCases(ctx: *TestContext) !void { |
| 631 | 631 | ":6:5: error: redundant non-exhaustive enum mark", |
| 632 | 632 | ":3:5: note: other mark here", |
| 633 | 633 | }); |
| 634 | |
| 635 | case.addError( |
| 636 | \\const E1 = enum { |
| 637 | \\ a, |
| 638 | \\ b, |
| 639 | \\ c, |
| 640 | \\ _ = 10, |
| 641 | \\}; |
| 642 | \\export fn foo() void { |
| 643 | \\ const x = E1.a; |
| 644 | \\} |
| 645 | , &.{ |
| 646 | ":5:9: error: '_' is used to mark an enum as non-exhaustive and cannot be assigned a value", |
| 647 | }); |
| 648 | |
| 649 | case.addError( |
| 650 | \\const E1 = enum {}; |
| 651 | \\export fn foo() void { |
| 652 | \\ const x = E1.a; |
| 653 | \\} |
| 654 | , &.{ |
| 655 | ":1:12: error: enum declarations must have at least one tag", |
| 656 | }); |
| 657 | |
| 658 | case.addError( |
| 659 | \\const E1 = enum { a, b, _ }; |
| 660 | \\export fn foo() void { |
| 661 | \\ const x = E1.a; |
| 662 | \\} |
| 663 | , &.{ |
| 664 | ":1:12: error: non-exhaustive enum missing integer tag type", |
| 665 | ":1:25: note: marked non-exhaustive here", |
| 666 | }); |
| 667 | |
| 668 | case.addError( |
| 669 | \\const E1 = enum { a, b, c, b, d }; |
| 670 | \\export fn foo() void { |
| 671 | \\ const x = E1.a; |
| 672 | \\} |
| 673 | , &.{ |
| 674 | ":1:28: error: duplicate enum tag", |
| 675 | ":1:22: note: other tag here", |
| 676 | }); |
| 634 | 677 | } |
| 635 | 678 | |
| 636 | 679 | ctx.c("empty start function", linux_x64, |