diff --git a/stage0/corpus.zig b/stage0/corpus.zig index 767f00a0d5..99f0340e81 100644 --- a/stage0/corpus.zig +++ b/stage0/corpus.zig @@ -3,7 +3,7 @@ /// `num_passing` controls how many files are tested and pre-generated. /// Both build.zig and stages_test.zig import this file. /// To enable more tests: just increment `num_passing`. -pub const num_passing: usize = 4; +pub const num_passing: usize = 5; pub const files = [_][]const u8{ "stage0/sema_tests/empty.zig", diff --git a/stage0/sema.c b/stage0/sema.c index 12abee47fa..a6344b6fb5 100644 --- a/stage0/sema.c +++ b/stage0/sema.c @@ -8156,6 +8156,23 @@ static void analyzeFuncBodyAndRecord(Sema* sema, SemaBlock* block, key.data.ptr_type.child = elem_ty; key.data.ptr_type.flags = ip_flags; param_ty = ipIntern(sema->ip, key); + } else { + // General case: analyze the type body in comptime + // context (e.g. decl_val + break_inline for + // references to module-level type aliases). + const uint32_t* type_body + = &sema->code.extra[param_payload + 2]; + instMapEnsureSpaceForBody( + &sema->inst_map, type_body, type_body_len_p); + fn_block.is_comptime = true; + (void)analyzeBodyInner( + sema, &fn_block, type_body, type_body_len_p); + fn_block.is_comptime = false; + ZirInstRef type_operand + = sema->code.inst_datas[sema->comptime_break_inst] + .break_data.operand; + AirInstRef type_air = resolveInst(sema, type_operand); + param_ty = AIR_REF_TO_IP(type_air); } } else if (type_body_len_p > 2) { const uint32_t* type_body