const std = @import("std"); const FileOpenError = error{ AccessDenied, OutOfMemory, FileNotFound, }; const AllocationError = error{ OutOfMemory, }; test "coerce subset to superset" { const err = foo(AllocationError.OutOfMemory); try std.testing.expect(err == FileOpenError.OutOfMemory); } fn foo(err: AllocationError) FileOpenError { return err; } // test