aboutsummaryrefslogtreecommitdiff
path: root/src/Sema.zig
diff options
context:
space:
mode:
Diffstat (limited to 'src/Sema.zig')
-rw-r--r--src/Sema.zig19
1 files changed, 9 insertions, 10 deletions
diff --git a/src/Sema.zig b/src/Sema.zig
index 54be47f584..40c170cbe7 100644
--- a/src/Sema.zig
+++ b/src/Sema.zig
@@ -2998,7 +2998,7 @@ fn zirStructDecl(
return Air.internedToRef(wip_ty.finish(ip, new_namespace_index));
}
-fn createTypeName(
+pub fn createTypeName(
sema: *Sema,
block: *Block,
name_strategy: Zir.Inst.NameStrategy,
@@ -14065,14 +14065,13 @@ fn zirImport(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.
return Air.internedToRef(ty);
},
.zon => {
- if (extra.res_ty == .none) {
- return sema.fail(block, operand_src, "'@import' of ZON must have a known result type", .{});
- }
- const res_ty_inst = try sema.resolveInst(extra.res_ty);
- const res_ty = try sema.analyzeAsType(block, operand_src, res_ty_inst);
- if (res_ty.isGenericPoison()) {
- return sema.fail(block, operand_src, "'@import' of ZON must have a known result type", .{});
- }
+ const res_ty: InternPool.Index = b: {
+ if (extra.res_ty == .none) break :b .none;
+ const res_ty_inst = try sema.resolveInst(extra.res_ty);
+ const res_ty = try sema.analyzeAsType(block, operand_src, res_ty_inst);
+ if (res_ty.isGenericPoison()) break :b .none;
+ break :b res_ty.toIntern();
+ };
try sema.declareDependency(.{ .zon_file = result.file_index });
const interned = try LowerZon.run(
@@ -31699,7 +31698,7 @@ fn addReferenceEntry(
try zcu.addUnitReference(sema.owner, referenced_unit, src);
}
-fn addTypeReferenceEntry(
+pub fn addTypeReferenceEntry(
sema: *Sema,
src: LazySrcLoc,
referenced_type: InternPool.Index,