authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2021-08-05 23:17:29-07:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2021-08-05 23:17:29-07:00
log47f2463b5c784cb7be9593f56e6b89805dbb8f06
treee08eed656f8d648dcf550dc7244d31a0b3846416
parentc03a04a58942446b48e9294df991a17a3a6f7b48

std.HashMap: fix getPtrAdapted. AstGen: fix fn param iteration

There was a bug in stage2 regarding iteration of function parameter AST. This resulted in a false negative "unused parameter" compile error, which, when fixed, revealed a bug in the std lib HashMap implementation.

2 files changed, 4 insertions(+), 1 deletions(-)

lib/std/hash_map.zig+1-1
......@@ -563,7 +563,7 @@ pub fn HashMap(
563563 return self.unmanaged.getPtrContext(key, self.ctx);
564564 }
565565 pub fn getPtrAdapted(self: Self, key: anytype, ctx: anytype) ?*V {
566 return self.unmanaged.getPtrAdapted(key, self.ctx);
566 return self.unmanaged.getPtrAdapted(key, ctx);
567567 }
568568
569569 /// Finds the key and value associated with a key in the map
lib/std/zig/ast.zig+3
......@@ -2198,6 +2198,9 @@ pub const full = struct {
21982198 .type_expr = param_type,
21992199 };
22002200 }
2201 if (token_tags[it.tok_i] == .comma) {
2202 it.tok_i += 1;
2203 }
22012204 if (token_tags[it.tok_i] == .r_paren) {
22022205 return null;
22032206 }