aboutsummaryrefslogtreecommitdiff
path: root/src/value.zig
diff options
context:
space:
mode:
authorCody Tapscott <topolarity@tapscott.me>2022-09-23 14:40:55 -0700
committerCody Tapscott <topolarity@tapscott.me>2022-10-21 11:22:49 -0700
commit597ead5318421befba3619fed389820d241ecc78 (patch)
tree53be9aa62a94066cc011c6ec0bda9a90bf187623 /src/value.zig
parentb529d8e48f2082c4e8df10d0ff26e2c7702bb693 (diff)
downloadzig-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.zig7
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,