diff options
| author | Andrew Kelley <andrew@ziglang.org> | 2021-05-11 17:34:13 -0700 |
|---|---|---|
| committer | Andrew Kelley <andrew@ziglang.org> | 2021-05-11 17:34:13 -0700 |
| commit | cbbc7cc8b1edeeae1715248a5d13304027698367 (patch) | |
| tree | 08305439f53718e48bd65da4ae8751949dab218b /src/Sema.zig | |
| parent | 5d9fc11d18bef9142cb32af3d1515b6de9f125ab (diff) | |
| download | zig-cbbc7cc8b1edeeae1715248a5d13304027698367.tar.gz zig-cbbc7cc8b1edeeae1715248a5d13304027698367.zip | |
stage2: better handling of file-level compile errors across updates
* `Module.File` now retains the most recent successful ZIR in the event
that an update causes a ZIR compile error. This way Zig does not
throw out useful semantic analysis results when an update temporarily
introduces a ZIR compile error.
* Semantic analysis of a File now unconditionally creates a Decl object
for the File. The Decl object is marked as `file_failed` in case of
File-level compile errors. This allows detecting of the File being
outdated, and dependency tracking just like any other Decl.
Diffstat (limited to 'src/Sema.zig')
| -rw-r--r-- | src/Sema.zig | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/Sema.zig b/src/Sema.zig index 43b18d0032..50a9af4ddf 100644 --- a/src/Sema.zig +++ b/src/Sema.zig @@ -4387,7 +4387,7 @@ fn zirImport(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError! }, }; try mod.semaFile(result.file); - return mod.constType(sema.arena, src, result.file.namespace.ty); + return mod.constType(sema.arena, src, result.file.namespace.?.ty); } fn zirShl(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError!*Inst { @@ -7285,7 +7285,7 @@ fn getBuiltinType( const opt_builtin_inst = try sema.analyzeNamespaceLookup( block, src, - std_file.namespace, + std_file.namespace.?, "builtin", ); const builtin_inst = try sema.analyzeLoad(block, src, opt_builtin_inst.?, src); |
