From 336f9869865c8b98ffeb6735bdfbbd4904f47869 Mon Sep 17 00:00:00 2001 From: dzaima Date: Mon, 12 Jun 2023 00:51:12 +0300 Subject: [PATCH] =?UTF-8?q?change=20error=20messages=20in=20=E2=97=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/builtins/md2.c | 8 ++++---- test/cases/prims.bqn | 9 +++++++++ 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/src/builtins/md2.c b/src/builtins/md2.c index 6426bc9e..27c88de1 100644 --- a/src/builtins/md2.c +++ b/src/builtins/md2.c @@ -140,8 +140,8 @@ B pick_c2(B t, B w, B x); B cond_c1(Md2D* d, B x) { B f=d->f; B g=d->g; B fr = c1iX(f, x); if (isNum(fr)) { - if (isAtm(g)||RNK(g)!=1) thrM("◶: 𝕘 must have rank 1"); - usz fri = WRAP(o2i64(fr), IA(g), thrM("◶: 𝔽 out of bounds of 𝕘")); + if (isAtm(g)||RNK(g)!=1) thrM("◶: 𝕘 must have rank 1 when index is a number"); + usz fri = WRAP(o2i64(fr), IA(g), thrM("◶: Index out of bounds of 𝕘")); return c1(IGetU(g, fri), x); } else { B fn = C2(pick, fr, inc(g)); @@ -153,8 +153,8 @@ B cond_c1(Md2D* d, B x) { B f=d->f; B g=d->g; B cond_c2(Md2D* d, B w, B x) { B g=d->g; B fr = c2iWX(d->f, w, x); if (isNum(fr)) { - if (isAtm(g)||RNK(g)!=1) thrM("◶: 𝕘 must have rank 1"); - usz fri = WRAP(o2i64(fr), IA(g), thrM("◶: 𝔽 out of bounds of 𝕘")); + if (isAtm(g)||RNK(g)!=1) thrM("◶: 𝕘 must have rank 1 when index is a number"); + usz fri = WRAP(o2i64(fr), IA(g), thrM("◶: Index out of bounds of 𝕘")); return c2(IGetU(g, fri), w, x); } else { B fn = C2(pick, fr, inc(g)); diff --git a/test/cases/prims.bqn b/test/cases/prims.bqn index abdb0200..558055e4 100644 --- a/test/cases/prims.bqn +++ b/test/cases/prims.bqn @@ -281,6 +281,15 @@ w←1‿1⥊1 ⋄ x←2⥊1 ⋄ w‿x <¨↩ ⋄ {! (∾⟨•Repr𝕩,": Expe %USE tvar ⋄ a←¯5+↕10 ⋄ !¨ (⋈¨ 5+↕10)⊸≡¨ {1+⍟𝕩 ⋈10}_tvar a %USE tvar ⋄ a←¯5+↕10 ⋄ !¨ (⋈¨ 5+↕10)⊸≡¨ {1+⍟(𝕩{!𝕩≡⋈10 ⋄ 𝕗}) ⋈10}_tvar a +# ◶ +!"◶: 𝕘 must have rank 1 when index is a number" % 1◶[1‿2,3‿4] 3 +!"◶: 𝕘 must have rank 1 when index is a number" % "ab" ⊢◶[1‿2,3‿4] 3 +!"⊑: Picking item at wrong rank (index 0‿0 in array of shape ⟨2⟩)" % ⊢◶+‿- 0‿0 # shouldn't reference ⊑ but whatever +!"⊑: Picking item at wrong rank (index 1‿2 in array of shape ⟨3⟩)" % 1 +◶+‿-‿⊢ 0‿1 +10 +◶"ab"‿"cd" ¯9 %% "cd" +⟨⋈1,⋈2,⋈0⟩◶"ab"‿"cd"‿1 @ %% "cd"‿1‿"ab" + + # ˘ & ⎉ ≢ (1⥊˜ 0∾203⥊2)⎉50 1⥊˜ 0∾100⥊2 %% 1‿50‿1‿203/0‿2‿0‿2 !"⎉: Result rank too large" % (1⥊˜ 0∾203⥊2)⎉49 1⥊˜ 0∾100⥊2