aboutsummaryrefslogtreecommitdiff
path: root/test/cases/compile_errors/runtime_operation_in_comptime_scope.zig
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 /test/cases/compile_errors/runtime_operation_in_comptime_scope.zig
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 'test/cases/compile_errors/runtime_operation_in_comptime_scope.zig')
-rw-r--r--test/cases/compile_errors/runtime_operation_in_comptime_scope.zig5
1 files changed, 3 insertions, 2 deletions
diff --git a/test/cases/compile_errors/runtime_operation_in_comptime_scope.zig b/test/cases/compile_errors/runtime_operation_in_comptime_scope.zig
index 8c1d31adf2..e3576c179b 100644
--- a/test/cases/compile_errors/runtime_operation_in_comptime_scope.zig
+++ b/test/cases/compile_errors/runtime_operation_in_comptime_scope.zig
@@ -27,8 +27,9 @@ var rt: u32 = undefined;
// :19:5: note: operation is runtime due to this operand
// :14:8: note: called at comptime from here
// :10:12: note: called at comptime from here
-// :13:10: note: function with comptime-only return type 'type' is evaluated at comptime
-// :13:10: note: types are not available at runtime
+// :10:12: note: call to function with comptime-only return type 'type' is evaluated at comptime
+// :13:10: note: return type declared here
+// :10:12: note: types are not available at runtime
// :2:8: note: called from here
// :19:8: error: unable to evaluate comptime expression
// :19:5: note: operation is runtime due to this operand