mirror of
https://github.com/ziglang/zig.git
synced 2025-12-29 17:43:17 +00:00
parent
fec4b7ef5c
commit
436c72e89a
@ -9919,7 +9919,7 @@ fn zirParam(
|
||||
.is_comptime = comptime_syntax,
|
||||
.name = param_name,
|
||||
});
|
||||
sema.inst_map.putAssumeCapacityNoClobber(inst, .generic_poison);
|
||||
sema.inst_map.putAssumeCapacity(inst, .generic_poison);
|
||||
return;
|
||||
},
|
||||
else => |e| return e,
|
||||
@ -9936,7 +9936,7 @@ fn zirParam(
|
||||
.is_comptime = comptime_syntax,
|
||||
.name = param_name,
|
||||
});
|
||||
sema.inst_map.putAssumeCapacityNoClobber(inst, .generic_poison);
|
||||
sema.inst_map.putAssumeCapacity(inst, .generic_poison);
|
||||
return;
|
||||
},
|
||||
else => |e| return e,
|
||||
@ -9951,7 +9951,7 @@ fn zirParam(
|
||||
if (is_comptime) {
|
||||
// If this is a comptime parameter we can add a constant generic_poison
|
||||
// since this is also a generic parameter.
|
||||
sema.inst_map.putAssumeCapacityNoClobber(inst, .generic_poison);
|
||||
sema.inst_map.putAssumeCapacity(inst, .generic_poison);
|
||||
} else {
|
||||
// Otherwise we need a dummy runtime instruction.
|
||||
const result_index: Air.Inst.Index = @enumFromInt(sema.air_instructions.len);
|
||||
@ -9959,7 +9959,7 @@ fn zirParam(
|
||||
.tag = .alloc,
|
||||
.data = .{ .ty = param_ty },
|
||||
});
|
||||
sema.inst_map.putAssumeCapacityNoClobber(inst, result_index.toRef());
|
||||
sema.inst_map.putAssumeCapacity(inst, result_index.toRef());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -578,3 +578,9 @@ test "call generic function that uses capture from function declaration's scope"
|
||||
const s = S.foo(123);
|
||||
try expectEqual(123.0, s[0]);
|
||||
}
|
||||
|
||||
comptime {
|
||||
// The same function parameter instruction being analyzed multiple times
|
||||
// should override the result of the previous analysis.
|
||||
for (0..2) |_| _ = fn (void) void;
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user