diff options
| author | Veikka Tuominen <git@vexu.eu> | 2022-11-21 13:48:23 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-11-21 13:48:23 +0200 |
| commit | 7c527c6dfe590a1251b51f6e1cfe8a4ba9bb0d67 (patch) | |
| tree | 2bf79b09302f3c574b18b50591fdad9a555b6e8f /src/Module.zig | |
| parent | 89c374cd2dff36477ac1513006c03721ef946a2a (diff) | |
| parent | bbcd959c2b1721d81af5829b56e01cc472b58816 (diff) | |
| download | zig-7c527c6dfe590a1251b51f6e1cfe8a4ba9bb0d67.tar.gz zig-7c527c6dfe590a1251b51f6e1cfe8a4ba9bb0d67.zip | |
Merge pull request #13585 from Vexu/stage2-fixes
Stage2 bug fixes
Diffstat (limited to 'src/Module.zig')
| -rw-r--r-- | src/Module.zig | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/Module.zig b/src/Module.zig index af29a591cc..d598993c3f 100644 --- a/src/Module.zig +++ b/src/Module.zig @@ -1044,7 +1044,8 @@ pub const Struct = struct { .root => return queryFieldSrc(tree.*, query, file, tree.containerDeclRoot()), - else => unreachable, + // This struct was generated using @Type + else => return s.srcLoc(mod), } } @@ -1270,7 +1271,8 @@ pub const Union = struct { .tagged_union_enum_tag, .tagged_union_enum_tag_trailing, => return queryFieldSrc(tree.*, query, file, tree.taggedUnionEnumTag(node)), - else => unreachable, + // This union was generated using @Type + else => return u.srcLoc(mod), } } @@ -4631,7 +4633,7 @@ fn semaDecl(mod: *Module, decl_index: Decl.Index) !bool { const address_space_src: LazySrcLoc = .{ .node_offset_var_decl_addrspace = 0 }; const ty_src: LazySrcLoc = .{ .node_offset_var_decl_ty = 0 }; const init_src: LazySrcLoc = .{ .node_offset_var_decl_init = 0 }; - const decl_tv = try sema.resolveInstValue(&block_scope, init_src, result_ref, undefined); + const decl_tv = try sema.resolveInstValue(&block_scope, init_src, result_ref, "global variable initializer must be comptime-known"); // Note this resolves the type of the Decl, not the value; if this Decl // is a struct, for example, this resolves `type` (which needs no resolution), |
