diff options
| author | Andrew Kelley <andrew@ziglang.org> | 2022-03-26 00:33:14 -0700 |
|---|---|---|
| committer | Andrew Kelley <andrew@ziglang.org> | 2022-03-26 00:33:14 -0700 |
| commit | af844931b2600e50e586436dee0d607d67ed9ff2 (patch) | |
| tree | c76003ccb51808c017ad6401d617729847f4ffa7 /src/Module.zig | |
| parent | 6ef761307ce286f4c6955ce2e7627e9a0d6ec442 (diff) | |
| download | zig-af844931b2600e50e586436dee0d607d67ed9ff2.tar.gz zig-af844931b2600e50e586436dee0d607d67ed9ff2.zip | |
stage2: resolve types more lazily
This avoids unwanted "foo depends on itself" compilation errors.
Diffstat (limited to 'src/Module.zig')
| -rw-r--r-- | src/Module.zig | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/Module.zig b/src/Module.zig index 0666936f1f..71e2bd8d7c 100644 --- a/src/Module.zig +++ b/src/Module.zig @@ -3904,7 +3904,7 @@ fn semaDecl(mod: *Module, decl: *Decl) !bool { // 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), // not the struct itself. - try sema.resolveTypeFully(&block_scope, src, decl_tv.ty); + try sema.resolveTypeLayout(&block_scope, src, decl_tv.ty); const decl_arena_state = try decl_arena_allocator.create(std.heap.ArenaAllocator.State); @@ -4049,6 +4049,10 @@ fn semaDecl(mod: *Module, decl: *Decl) !bool { if (has_runtime_bits) { log.debug("queue linker work for {*} ({s})", .{ decl, decl.name }); + // Needed for codegen_decl which will call updateDecl and then the + // codegen backend wants full access to the Decl Type. + try sema.resolveTypeFully(&block_scope, src, decl.ty); + try mod.comp.bin_file.allocateDeclIndexes(decl); try mod.comp.work_queue.writeItem(.{ .codegen_decl = decl }); |
