mirror of
https://github.com/ziglang/zig.git
synced 2026-01-20 22:35:24 +00:00
Sema: add missing declared here note
This commit is contained in:
parent
f14cf13ff8
commit
ac55685a94
@ -2238,6 +2238,7 @@ fn failWithExpectedOptionalType(sema: *Sema, block: *Block, src: LazySrcLoc, non
|
||||
if (non_optional_ty.zigTypeTag(mod) == .ErrorUnion) {
|
||||
try sema.errNote(block, src, msg, "consider using 'try', 'catch', or 'if'", .{});
|
||||
}
|
||||
try addDeclaredHereNote(sema, msg, non_optional_ty);
|
||||
break :msg msg;
|
||||
};
|
||||
return sema.failWithOwnedErrorMsg(block, msg);
|
||||
|
||||
@ -0,0 +1,16 @@
|
||||
export fn foo() void {
|
||||
while (bar()) |x| {
|
||||
_ = x;
|
||||
}
|
||||
}
|
||||
const X = enum { a };
|
||||
fn bar() X {
|
||||
return .a;
|
||||
}
|
||||
|
||||
// error
|
||||
// backend=stage2
|
||||
// target=native
|
||||
//
|
||||
// :2:15: error: expected optional type, found 'tmp.X'
|
||||
// :6:11: note: enum declared here
|
||||
Loading…
x
Reference in New Issue
Block a user