File tree 1 file changed +55
-0
lines changed
1 file changed +55
-0
lines changed Original file line number Diff line number Diff line change @@ -807,4 +807,59 @@ pub fn addCases(cases: *tests.StackTracesContext) void {
807
807
,
808
808
},
809
809
});
810
+ cases .addCase (.{
811
+ .name = "error union switch with call operand" ,
812
+ .source =
813
+ \\pub fn main() !void {
814
+ \\ try foo();
815
+ \\ return error.TheSkyIsFalling;
816
+ \\}
817
+ \\
818
+ \\noinline fn failure() error{ Fatal, NonFatal }!void {
819
+ \\ return error.NonFatal;
820
+ \\}
821
+ \\
822
+ \\fn foo() error{Fatal}!void {
823
+ \\ return failure() catch |err| switch (err) {
824
+ \\ error.Fatal => return error.Fatal,
825
+ \\ error.NonFatal => return,
826
+ \\ };
827
+ \\}
828
+ ,
829
+ .Debug = .{
830
+ .expect =
831
+ \\error: TheSkyIsFalling
832
+ \\source.zig:3:5: [address] in main (test)
833
+ \\ return error.TheSkyIsFalling;
834
+ \\ ^
835
+ \\
836
+ ,
837
+ },
838
+ .ReleaseSafe = .{
839
+ .exclude_os = &.{
840
+ .windows , // TODO
841
+ .linux , // defeated by aggressive inlining
842
+ },
843
+ .expect =
844
+ \\error: TheSkyIsFalling
845
+ \\source.zig:3:5: [address] in [function]
846
+ \\ return error.TheSkyIsFalling;
847
+ \\ ^
848
+ \\
849
+ ,
850
+ .error_tracing = true ,
851
+ },
852
+ .ReleaseFast = .{
853
+ .expect =
854
+ \\error: TheSkyIsFalling
855
+ \\
856
+ ,
857
+ },
858
+ .ReleaseSmall = .{
859
+ .expect =
860
+ \\error: TheSkyIsFalling
861
+ \\
862
+ ,
863
+ },
864
+ });
810
865
}
You can’t perform that action at this time.
0 commit comments