From b1bd4766031ad0c735731acba4f256af1407c43f Mon Sep 17 00:00:00 2001 From: Benoit Giannangeli Date: Thu, 19 Sep 2024 09:53:58 +0200 Subject: [PATCH] fix: Restored mistakenly commented placeholder multi-parent check --- src/Parser.zig | 2 +- src/obj.zig | 30 +++++++++++++++--------------- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/src/Parser.zig b/src/Parser.zig index e5cdf0fa..03e8d212 100644 --- a/src/Parser.zig +++ b/src/Parser.zig @@ -1790,7 +1790,7 @@ fn resolvePlaceholderWithRelation( self.reporter.reportErrorFmt( .map_key_type, self.ast.tokens.get(child_placeholder.where), - "`{s}` can't be subscripted", + "Bad key type for `{s}`", .{ (try resolved_type.toStringAlloc(self.gc.allocator)).items, }, diff --git a/src/obj.zig b/src/obj.zig index f5527038..bfe3aa0c 100644 --- a/src/obj.zig +++ b/src/obj.zig @@ -5025,21 +5025,21 @@ pub const PlaceholderDef = struct { return; } - // if (child.resolved_type.?.Placeholder.parent != null) { - // if (BuildOptions.debug_placeholders) { - // io.print( - // ">>> Placeholder @{} ({s}) has already a {} relation with @{} ({s})\n", - // .{ - // @intFromPtr(child), - // if (child.resolved_type.?.Placeholder.name) |name| name.string else "unknown", - // child.resolved_type.?.Placeholder.parent_relation.?, - // @intFromPtr(child.resolved_type.?.Placeholder.parent.?), - // if (child.resolved_type.?.Placeholder.parent.?.resolved_type.?.Placeholder.name) |name| name.string else "unknown", - // }, - // ); - // } - // return; - // } + if (child.resolved_type.?.Placeholder.parent != null) { + if (BuildOptions.debug_placeholders) { + io.print( + ">>> Placeholder @{} ({s}) has already a {} relation with @{} ({s})\n", + .{ + @intFromPtr(child), + if (child.resolved_type.?.Placeholder.name) |name| name.string else "unknown", + child.resolved_type.?.Placeholder.parent_relation.?, + @intFromPtr(child.resolved_type.?.Placeholder.parent.?), + if (child.resolved_type.?.Placeholder.parent.?.resolved_type.?.Placeholder.name) |name| name.string else "unknown", + }, + ); + } + return; + } child.resolved_type.?.Placeholder.parent = parent; try parent.resolved_type.?.Placeholder.children.append(child);