| author | |
| committer | |
| log | a82c6453c1553ce89ec24803d4192030639d79ab |
| tree | 22c39cef84328674b4f6a266d07d6e3edbff7246 |
| parent | edadccde549b99305882e795e44672a9f41be037 |
| parent | a23a022820d24f660b314457e1984ceb2586e109 |
| signature |
fix: container member access `usingnamespace` decls fails3 files changed, 17 insertions(+), 2 deletions(-)
src/ir.cpp+1-2| ... | ... | @@ -17673,8 +17673,7 @@ static IrInstruction *ir_analyze_container_member_access_inner(IrAnalyze *ira, |
| 17673 | 17673 | if (!is_slice(bare_struct_type)) { |
| 17674 | 17674 | ScopeDecls *container_scope = get_container_scope(bare_struct_type); |
| 17675 | 17675 | assert(container_scope != nullptr); |
| 17676 | auto entry = container_scope->decl_table.maybe_get(field_name); | |
| 17677 | Tld *tld = entry ? entry->value : nullptr; | |
| 17676 | auto tld = find_container_decl(ira->codegen, container_scope, field_name); | |
| 17678 | 17677 | if (tld) { |
| 17679 | 17678 | if (tld->id == TldIdFn) { |
| 17680 | 17679 | resolve_top_level_decl(ira->codegen, tld, source_instr->source_node, false); |
test/stage1/behavior.zig+1| ... | ... | @@ -34,6 +34,7 @@ comptime { |
| 34 | 34 | _ = @import("behavior/bugs/2692.zig"); |
| 35 | 35 | _ = @import("behavior/bugs/3046.zig"); |
| 36 | 36 | _ = @import("behavior/bugs/3112.zig"); |
| 37 | _ = @import("behavior/bugs/3367.zig"); | |
| 37 | 38 | _ = @import("behavior/bugs/394.zig"); |
| 38 | 39 | _ = @import("behavior/bugs/421.zig"); |
| 39 | 40 | _ = @import("behavior/bugs/529.zig"); |
test/stage1/behavior/bugs/3367.zig created+15| ... | ... | @@ -0,0 +1,15 @@ |
| 1 | const std = @import("std"); | |
| 2 | const expect = std.testing.expect; | |
| 3 | ||
| 4 | const Foo = struct { | |
| 5 | usingnamespace Mixin; | |
| 6 | }; | |
| 7 | ||
| 8 | const Mixin = struct { | |
| 9 | pub fn two(self: Foo) void {} | |
| 10 | }; | |
| 11 | ||
| 12 | test "container member access usingnamespace decls" { | |
| 13 | var foo = Foo{}; | |
| 14 | foo.two(); | |
| 15 | } |