diff options
| author | Jacob Young <jacobly0@users.noreply.github.com> | 2023-08-05 03:31:33 -0400 |
|---|---|---|
| committer | Andrew Kelley <andrew@ziglang.org> | 2023-08-05 11:21:50 -0700 |
| commit | a91a8df6791b6fe228ad616acd9fbbde46451651 (patch) | |
| tree | e7a9990cb09ecb53e2a90a6c9c2fbbf68540a5e3 /src/Sema.zig | |
| parent | fc6e5756848cd627b69756853937ce22500e62cc (diff) | |
| download | zig-a91a8df6791b6fe228ad616acd9fbbde46451651.tar.gz zig-a91a8df6791b6fe228ad616acd9fbbde46451651.zip | |
Sema: fix issues passing an invalid type to a generic method
Closes #16601
Diffstat (limited to 'src/Sema.zig')
| -rw-r--r-- | src/Sema.zig | 13 |
1 files changed, 1 insertions, 12 deletions
diff --git a/src/Sema.zig b/src/Sema.zig index 9b137cf5af..f5f1bc15b3 100644 --- a/src/Sema.zig +++ b/src/Sema.zig @@ -7622,7 +7622,7 @@ fn instantiateGenericCall( else if (call_src == .node_offset) .{ .call_arg = .{ .decl = block.src_decl, .call_node_offset = call_src.node_offset.x, - .arg_index = @intCast(total_i), + .arg_index = @intCast(total_i - @intFromBool(bound_arg_src != null)), } } else .unneeded; const comptime_arg = callee.comptime_args.get(ip)[total_i]; @@ -9343,17 +9343,6 @@ fn zirParam( assert(sema.inst_map.remove(inst)); } - if (sema.generic_owner != .none) { - if (try sema.typeHasOnePossibleValue(param_ty)) |opv| { - // In this case we are instantiating a generic function call with a non-comptime - // non-anytype parameter that ended up being a one-possible-type. - // We don't want the parameter to be part of the instantiated function type. - sema.inst_map.putAssumeCapacity(inst, Air.internedToRef(opv.toIntern())); - sema.comptime_args[param_index] = opv.toIntern(); - return; - } - } - try block.params.append(sema.arena, .{ .ty = param_ty.toIntern(), .is_comptime = comptime_syntax, |
