From 2080ac3bda5d1eac9e2f4dde02e96161be395ba3 Mon Sep 17 00:00:00 2001 From: sogaiu <983021772@users.noreply.github.com> Date: Fri, 6 Aug 2021 08:24:26 +0900 Subject: [PATCH 1/2] Tweak get-in behavior --- src/boot/boot.janet | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/boot/boot.janet b/src/boot/boot.janet index 1e902c42..8826dc92 100644 --- a/src/boot/boot.janet +++ b/src/boot/boot.janet @@ -1351,7 +1351,7 @@ a sequence of keys.` [ds ks &opt dflt] (var d ds) - (loop [k :in ks :while d] (set d (get d k))) + (loop [k :in ks :while (not (nil? d))] (set d (get d k))) (if (= nil d) dflt d)) (defn update-in From 547fda6a401c6474b2b6e56115e6ff6fe4b8dcfb Mon Sep 17 00:00:00 2001 From: sogaiu <983021772@users.noreply.github.com> Date: Fri, 6 Aug 2021 10:05:34 +0900 Subject: [PATCH 2/2] Add tests --- test/suite0010.janet | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/test/suite0010.janet b/test/suite0010.janet index 7e8c8520..db2c7ead 100644 --- a/test/suite0010.janet +++ b/test/suite0010.janet @@ -161,4 +161,10 @@ ([err] :caught)))) "regression #638")) +# Issue #751 +(def t {:side false}) +(assert (nil? (get-in t [:side :note])) "get-in with false value") +(assert (= (get-in t [:side :note] "dflt") "dflt") + "get-in with false value and default") + (end-suite)