From 3ef45acb19c1df4f58b5fb2f2b289f6b8a923fd6 Mon Sep 17 00:00:00 2001 From: Kaz Kylheku Date: Mon, 24 Jun 2019 17:21:19 -0700 Subject: replace: fix strange diagnostic from bad fallthrough. * lib.c (replace): If a COBJ is passed to replace which doesn't support the operation, we wrongly pass it to replace_buf because the BUF case was added into the fallthrough pass. The end result is that length_buf blows up on the object, resulting in a strange diagnostic. The BUF case must be moved above COBJ. --- lib.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib.c b/lib.c index 3554e290..746f0e72 100644 --- a/lib.c +++ b/lib.c @@ -10105,14 +10105,14 @@ val replace(val seq, val items, val from, val to) return replace_str(seq, items, from, to); case VEC: return replace_vec(seq, items, from, to); + case BUF: + return replace_buf(seq, items, from, to); case COBJ: if (seq->co.cls == carray_s) return carray_replace(seq, items, from, to); if (obj_struct_p(seq)) return replace_obj(seq, items, from, to); /* fallthrough */ - case BUF: - return replace_buf(seq, items, from, to); default: type_mismatch(lit("~a: ~s is not a sequence"), self, seq, nao); } -- cgit v1.2.3