| 1 | const FileOpenError = error{ |
| 2 | AccessDenied, |
| 3 | OutOfMemory, |
| 4 | FileNotFound, |
| 5 | }; |
| 6 | |
| 7 | const AllocationError = error{ |
| 8 | OutOfMemory, |
| 9 | }; |
| 10 | |
| 11 | test "coerce superset to subset" { |
| 12 | foo(FileOpenError.OutOfMemory) catch {}; |
| 13 | } |
| 14 | |
| 15 | fn foo(err: FileOpenError) AllocationError { |
| 16 | return err; |
| 17 | } |
| 18 | |
| 19 | // test_error=not a member of destination error set |