From 4356b0df29e5a156811e7388072e26799001e712 Mon Sep 17 00:00:00 2001 From: Kaz Kylheku Date: Fri, 20 Dec 2024 19:42:40 -0800 Subject: match-case: bugfix in conversion to casequal. * stdlib/match.tl (match-case-to-casequal): the (do inc dfl-cnt) action has a problem: it inserts an implicit extra parameter to the invocation of inc, which crashes the + addition due to that parameter being the matching @nil object. We don't need this entire case because it handles @nil, which also matches the following case for (sys:var ...), since @nil is (sys:var nil). That case ahs the same action of incrementing dfl-cnt. * tests/011/patmatch.tl: Test case added. --- stdlib/match.tl | 2 -- 1 file changed, 2 deletions(-) (limited to 'stdlib') diff --git a/stdlib/match.tl b/stdlib/match.tl index a382a5e6..b717a1a4 100644 --- a/stdlib/match.tl +++ b/stdlib/match.tl @@ -710,8 +710,6 @@ (let ((dfl-cnt 0)) (if (and [all clauses [chain car [orf [chain non-triv-pat-p not] - [iff (op equal '@nil) - (do inc dfl-cnt)] (do if-match (@(eq 'sys:var) @nil) @1 (inc dfl-cnt))]]] (< dfl-cnt 2) -- cgit v1.2.3