aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAndrew Kelley <andrew@ziglang.org>2022-03-09 15:32:12 -0700
committerAndrew Kelley <andrew@ziglang.org>2022-03-09 15:35:13 -0700
commit83bb3d1ad692127cd51c101b6a01fc853ab72990 (patch)
treeb7a8c22eeb3dcbf252dec787b9437b9aee117dbb /src
parent2aa4a32097392c869fe2ef58f372a960c0268859 (diff)
downloadzig-83bb3d1ad692127cd51c101b6a01fc853ab72990.tar.gz
zig-83bb3d1ad692127cd51c101b6a01fc853ab72990.zip
Sema: fix generic fn instantiation with anytype
When the anytype parameter had only one-possible-value (e.g. `void`), it would create a mismatch in the function type and the function call. Now the function type and the callsite both omit the one-possible-value anytype parameter in instantiated generic functions.
Diffstat (limited to 'src')
-rw-r--r--src/Sema.zig3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/Sema.zig b/src/Sema.zig
index c8b905f23f..29cad45f9a 100644
--- a/src/Sema.zig
+++ b/src/Sema.zig
@@ -6158,6 +6158,9 @@ fn zirParamAnytype(
// function type of the function instruction in this block.
return;
}
+ if (null != try sema.typeHasOnePossibleValue(block, src, param_ty)) {
+ return;
+ }
// The map is already populated but we do need to add a runtime parameter.
try block.params.append(sema.gpa, .{
.ty = param_ty,