aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorWooster <wooster0@proton.me>2023-07-30 11:10:41 +0200
committerwooster0 <wooster0@proton.me>2024-05-14 01:13:49 +0900
commitf14cf13ff8553030c47748a0cbd455514cd1f4a3 (patch)
tree3bc7dbe10a781f500800a45569fb5786baef6c54 /src
parent9ae43567a3ef14a815482ccaa2a5b412a716743e (diff)
downloadzig-f14cf13ff8553030c47748a0cbd455514cd1f4a3.tar.gz
zig-f14cf13ff8553030c47748a0cbd455514cd1f4a3.zip
Sema: suggest using try/catch/if on method call on error union
Diffstat (limited to 'src')
-rw-r--r--src/Sema.zig3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/Sema.zig b/src/Sema.zig
index c55531d924..a5c5f37e4c 100644
--- a/src/Sema.zig
+++ b/src/Sema.zig
@@ -27888,6 +27888,9 @@ fn fieldCallBind(
const decl = mod.declPtr(decl_idx);
try mod.errNoteNonLazy(decl.srcLoc(mod), msg, "'{}' is not a member function", .{field_name.fmt(ip)});
}
+ if (concrete_ty.zigTypeTag(mod) == .ErrorUnion) {
+ try sema.errNote(block, src, msg, "consider using 'try', 'catch', or 'if'", .{});
+ }
break :msg msg;
};
return sema.failWithOwnedErrorMsg(block, msg);