From 5a918cef56bca9de8a343f012ae7537c4e2720ae Mon Sep 17 00:00:00 2001 From: Chris Boesch Date: Mon, 31 Aug 2026 13:31:45 +0200 Subject: [PATCH] fixed that @hasDecl only works on public functions now --- exercises/070_comptime5.zig | 8 ++++---- patches/patches/070_comptime5.patch | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/exercises/070_comptime5.zig b/exercises/070_comptime5.zig index afd4ae8..3b93a7b 100644 --- a/exercises/070_comptime5.zig +++ b/exercises/070_comptime5.zig @@ -25,12 +25,12 @@ const Duck = struct { location_x: i32 = 0, location_y: i32 = 0, - fn waddle(self: *Duck, x: i16, y: i16) void { + pub fn waddle(self: *Duck, x: i16, y: i16) void { self.location_x += x; self.location_y += y; } - fn quack(self: Duck) void { + pub fn quack(self: Duck) void { if (self.loudness < 4) { print("\"Quack.\" ", .{}); } else { @@ -44,12 +44,12 @@ const RubberDuck = struct { location_x: i32 = 0, location_y: i32 = 0, - fn waddle(self: *RubberDuck, x: i16, y: i16) void { + pub fn waddle(self: *RubberDuck, x: i16, y: i16) void { self.location_x += x; self.location_y += y; } - fn quack(self: RubberDuck) void { + pub fn quack(self: RubberDuck) void { // Assigning an expression to '_' allows us to safely // "use" the value while also ignoring it. _ = self; diff --git a/patches/patches/070_comptime5.patch b/patches/patches/070_comptime5.patch index e5f0357..6b0ef06 100644 --- a/patches/patches/070_comptime5.patch +++ b/patches/patches/070_comptime5.patch @@ -1,5 +1,5 @@ ---- exercises/070_comptime5.zig 2023-10-03 22:15:22.125574535 +0200 -+++ answers/070_comptime5.zig 2023-10-05 20:04:07.159435482 +0200 +--- exercises/070_comptime5.zig 2026-08-31 13:28:01.202098783 +0200 ++++ answers/070_comptime5.zig 2026-08-31 13:27:33.431493595 +0200 @@ -123,8 +123,8 @@ // Please make sure MyType has both waddle() and quack() // methods: