stage0: handle decl_val in param type body, bump num_passing to 5
The parameter type resolution had a gap: 2-instruction type bodies were only handled for ptr_type, missing decl_val+break_inline (used when a parameter type references a module-level const like `const U32 = @Type(...)`). Add a general fallback using analyzeBodyInner for non-ptr_type 2-instruction bodies. This enables reify_int.zig which uses @Type to create u32. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -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",
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user