Sema: fix inline fn compiler crash (#25586)

Resolves: https://github.com/ziglang/zig/issues/25581
This commit is contained in:
So1aric 2025-11-13 03:21:28 +08:00 committed by GitHub
parent be2a902784
commit 49e19fc94f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 12 additions and 3 deletions

View File

@ -25528,9 +25528,7 @@ fn zirFuncFancy(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!A
extra_index += 1;
if (extra.data.bits.ret_ty_is_generic) break :blk .generic_poison;
const ret_ty_air_ref = try sema.resolveInst(ret_ty_ref);
const ret_ty_val = try sema.resolveConstDefinedValue(block, ret_src, ret_ty_air_ref, .{ .simple = .function_ret_ty });
break :blk ret_ty_val.toType();
break :blk try sema.resolveType(block, ret_src, ret_ty_ref);
} else .void;
const noalias_bits: u32 = if (extra.data.bits.has_any_noalias) blk: {

View File

@ -0,0 +1,11 @@
inline fn a() null {
return null;
}
pub fn main() void {
_ = a();
}
// error
//
// :1:15: error: expected type 'type', found '@TypeOf(null)'