aboutsummaryrefslogtreecommitdiff
path: root/lib/std/math
diff options
context:
space:
mode:
authormlugg <mlugg@mlugg.co.uk>2025-01-05 05:27:48 +0000
committermlugg <mlugg@mlugg.co.uk>2025-01-09 06:46:47 +0000
commite9bd2d45d4bbaf7eff7e95bc3ef7a0123b66a103 (patch)
treeda18bc40935c7dd9698d792eae3d102fa0ad67ae /lib/std/math
parent3f95003d4c57650f9b4779f55c8d7368b137337c (diff)
downloadzig-e9bd2d45d4bbaf7eff7e95bc3ef7a0123b66a103.tar.gz
zig-e9bd2d45d4bbaf7eff7e95bc3ef7a0123b66a103.zip
Sema: rewrite semantic analysis of function calls
This rewrite improves some error messages, hugely simplifies the logic, and fixes several bugs. One of these bugs is technically a new rule which Andrew and I agreed on: if a parameter has a comptime-only type but is not declared `comptime`, then the corresponding call argument should not be *evaluated* at comptime; only resolved. Implementing this required changing how function types work a little, which in turn required allowing a new kind of function coercion for some generic use cases: function coercions are now allowed to implicitly *remove* `comptime` annotations from parameters with comptime-only types. This is okay because removing the annotation affects only the call site. Resolves: #22262
Diffstat (limited to 'lib/std/math')
-rw-r--r--lib/std/math/log_int.zig1
1 files changed, 1 insertions, 0 deletions
diff --git a/lib/std/math/log_int.zig b/lib/std/math/log_int.zig
index 376aa69a4d..96227639d0 100644
--- a/lib/std/math/log_int.zig
+++ b/lib/std/math/log_int.zig
@@ -61,6 +61,7 @@ pub fn log_int(comptime T: type, base: T, x: T) Log2Int(T) {
}
test "log_int" {
+ @setEvalBranchQuota(2000);
// Test all unsigned integers with 2, 3, ..., 64 bits.
// We cannot test 0 or 1 bits since base must be > 1.
inline for (2..64 + 1) |bits| {