diff options
| author | Cody Tapscott <topolarity@tapscott.me> | 2022-09-23 14:40:55 -0700 |
|---|---|---|
| committer | Cody Tapscott <topolarity@tapscott.me> | 2022-10-21 11:22:49 -0700 |
| commit | 597ead5318421befba3619fed389820d241ecc78 (patch) | |
| tree | 53be9aa62a94066cc011c6ec0bda9a90bf187623 /src/value.zig | |
| parent | b529d8e48f2082c4e8df10d0ff26e2c7702bb693 (diff) | |
| download | zig-597ead5318421befba3619fed389820d241ecc78.tar.gz zig-597ead5318421befba3619fed389820d241ecc78.zip | |
stage2: Fix usage of getError()
Despite the old doc-comment, this function cannot be valid for all types
since it operates with only a value and Error (Union) types have
overlapping Value representations with other Types.
Diffstat (limited to 'src/value.zig')
| -rw-r--r-- | src/value.zig | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/value.zig b/src/value.zig index ee5b357a70..d24c5a1c17 100644 --- a/src/value.zig +++ b/src/value.zig @@ -2971,9 +2971,10 @@ pub const Value = extern union { }; } - /// Valid for all types. Asserts the value is not undefined and not unreachable. - /// Prefer `errorUnionIsPayload` to find out whether something is an error or not - /// because it works without having to figure out the string. + /// Valid only for error (union) types. Asserts the value is not undefined and not + /// unreachable. For error unions, prefer `errorUnionIsPayload` to find out whether + /// something is an error or not because it works without having to figure out the + /// string. pub fn getError(self: Value) ?[]const u8 { return switch (self.tag()) { .@"error" => self.castTag(.@"error").?.data.name, |
