diff options
| author | Andrew Kelley <andrew@ziglang.org> | 2022-12-07 21:35:02 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-12-07 21:35:02 -0500 |
| commit | d69e97ae1677ca487833caf6937fa428563ed0ae (patch) | |
| tree | 9299ebd6762715fd756972458f152ed123bf718f /src/Sema.zig | |
| parent | 913b4a3f19955296a892ffe4f148f8c097a7732a (diff) | |
| parent | 6039554b26b1aee6502063d9130907369c4ffd38 (diff) | |
| download | zig-d69e97ae1677ca487833caf6937fa428563ed0ae.tar.gz zig-d69e97ae1677ca487833caf6937fa428563ed0ae.zip | |
Merge pull request #13806 from Vexu/stage2-fixes
misc fixes and improvements
Diffstat (limited to 'src/Sema.zig')
| -rw-r--r-- | src/Sema.zig | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/src/Sema.zig b/src/Sema.zig index 68348ac161..3edc35aeb6 100644 --- a/src/Sema.zig +++ b/src/Sema.zig @@ -5405,6 +5405,13 @@ fn zirExport(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!void }, else => |e| return e, }; + { + try sema.mod.ensureDeclAnalyzed(decl_index); + const exported_decl = sema.mod.declPtr(decl_index); + if (exported_decl.val.castTag(.function)) |some| { + return sema.analyzeExport(block, src, options, some.data.owner_decl); + } + } try sema.analyzeExport(block, src, options, decl_index); } @@ -17870,6 +17877,13 @@ fn zirTagName(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air operand_ty.fmt(mod), }), }; + if (enum_ty.enumFieldCount() == 0) { + // TODO I don't think this is the correct way to handle this but + // it prevents a crash. + return sema.fail(block, operand_src, "cannot get @tagName of empty enum '{}'", .{ + enum_ty.fmt(mod), + }); + } const enum_decl_index = enum_ty.getOwnerDecl(); const casted_operand = try sema.coerce(block, enum_ty, operand, operand_src); if (try sema.resolveDefinedValue(block, operand_src, casted_operand)) |val| { @@ -20997,6 +21011,9 @@ fn analyzeMinMax( if (rhs_val.isUndef()) return sema.addConstUndef(simd_op.result_ty); + try sema.resolveLazyValue(lhs_val); + try sema.resolveLazyValue(rhs_val); + const opFunc = switch (air_tag) { .min => Value.numberMin, .max => Value.numberMax, |
