From 9826c4ce0ed9d197cc56803d239dfaeb03544ea2 Mon Sep 17 00:00:00 2001 From: dzaima Date: Mon, 17 Feb 2025 06:30:11 +0200 Subject: [PATCH] =?UTF-8?q?add=20=F0=9D=95=A8/=F0=9D=95=A9=20in=20dyadic?= =?UTF-8?q?=20=E2=8C=BD/=E2=8C=BD=E2=81=BC=20error=20message?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/builtins/sfns.c | 10 +++++----- test/cases/prims.bqn | 14 ++++++++++++-- test/cases/under.bqn | 2 +- 3 files changed, 18 insertions(+), 8 deletions(-) diff --git a/src/builtins/sfns.c b/src/builtins/sfns.c index 2a93150e..b62b9e91 100644 --- a/src/builtins/sfns.c +++ b/src/builtins/sfns.c @@ -1186,7 +1186,7 @@ B reverse_c2(B t, B w, B x); #define WRAP_ROT(V, L) ({ i64 v_ = (V); usz l_ = (L); if ((u64)v_ >= (u64)l_) { v_%= (i64)l_; if(v_<0) v_+= l_; } v_; }) NOINLINE B rotate_highrank(bool inv, B w, B x) { #define INV (inv? "⁼" : "") - if (RNK(w)>1) thrF("⌽%U: 𝕨 must have rank at most 1 (%H ≡ ≢𝕨)", INV, w); + if (RNK(w)>1) thrF("𝕨⌽%U𝕩: 𝕨 must have rank at most 1 (%H ≡ ≢𝕨)", INV, w); B r; usz wia = IA(w); if (isAtm(x) || RNK(x)==0) { @@ -1207,7 +1207,7 @@ NOINLINE B rotate_highrank(bool inv, B w, B x) { if (wia==0) { r=x; goto decW_ret; } if (!elNum(TI(w,elType))) { w = num_squeeze(w); - if (!elNum(TI(w,elType))) thrF("⌽%U: 𝕨 contained non-number", INV); + if (!elNum(TI(w,elType))) thrF("𝕨⌽%U𝕩: 𝕨 contained non-number", INV); } bool origF64 = TI(w,elType)==el_f64; w = toF64Any(w); @@ -1277,7 +1277,7 @@ NOINLINE B rotate_highrank(bool inv, B w, B x) { decW_ret: decG(w); return r; - badlen: thrF("⌽%U: Length of list 𝕨 must be at most rank of 𝕩 (%s ≡ ≠𝕨, %H ≡ ≢𝕩⟩", INV, wia, x); + badlen: thrF("𝕨⌽%U𝕩: Length of list 𝕨 must be at most rank of 𝕩 (%s ≡ ≠𝕨, %H ≡ ≢𝕩⟩", INV, wia, x); #undef INV } B reverse_c2(B t, B w, B x) { @@ -1505,9 +1505,9 @@ B shape_ucw(B t, B o, B w, B x) { B reverse_ix(B t, B w, B x) { - if (isAtm(x) || RNK(x)==0) thrM("⌽⁼: 𝕩 must have rank at least 1"); + if (isAtm(x) || RNK(x)==0) thrM("𝕨⌽⁼𝕩: 𝕩 must have rank at least 1"); if (isF64(w)) return C2(reverse, m_f64(-o2fG(w)), x); - if (isAtm(w)) thrM("⌽⁼: 𝕨 must consist of integers"); + if (isAtm(w)) thrM("𝕨⌽⁼𝕩: 𝕨 must consist of integers"); return rotate_highrank(1, w, x); } diff --git a/test/cases/prims.bqn b/test/cases/prims.bqn index 9d951b4d..12b3d4ad 100644 --- a/test/cases/prims.bqn +++ b/test/cases/prims.bqn @@ -271,9 +271,19 @@ a←↕2 ⋄ ! "e" ≡ (↕10){b←a‿a‿a‿a‿a‿a‿a‿a‿a‿a ⋄ !"Expected integer, got NaN" % %USE eqerr ⋄ ⟨0÷0, ⟨0÷0⟩⟩ ⌽_eqerr ⟨↕10, ↕0, 0‿0⥊0, ⟨⟩⟩ !"Integer out of range: ∞" % %USE eqerr ⋄ ⟨∞, ⟨∞⟩⟩ ⌽_eqerr ⟨↕10, ↕0, 0‿0⥊0, ⟨⟩⟩ !"Expected integer, got function" % %USE eqerr ⋄ ⟨⊑ ⟩ ⌽_eqerr ⟨↕10, ↕0, 0‿0⥊0, ⟨⟩⟩ -!"Expected integer, got character" % %USE eqerr ⋄ ⟨'a'⟩ ⌽_eqerr ⟨↕10, ↕0, 0‿0⥊0, ⟨⟩⟩ -!"⌽: 𝕨 contained non-number" % %USE eqerr ⋄ ⟨3‿'a', 'a'‿3, 0‿'a', 'a'‿0⟩ ⌽_eqerr ⟨0‿0⥊0,0‿0‿0⥊0⟩ +!"Expected integer, got character" % %USE eqerr ⋄ ⟨'a'⟩ ⌽ _eqerr ⟨↕10, ↕0, 0‿0⥊0, ⟨⟩⟩ +!"𝕨⌽⁼𝕩: 𝕨 must consist of integers" % %USE eqerr ⋄ ⟨'a'⟩ ⌽⁼_eqerr ⟨↕10, ↕0, 0‿0⥊0, ⟨⟩⟩ +!"𝕨⌽𝕩: 𝕨 contained non-number" % %USE eqerr ⋄ ⟨3‿'a', 'a'‿3, 0‿'a', 'a'‿0⟩ ⌽ _eqerr ⟨0‿0⥊0,0‿0‿0⥊0⟩ +!"𝕨⌽⁼𝕩: 𝕨 contained non-number" % %USE eqerr ⋄ ⟨3‿'a', 'a'‿3, 0‿'a', 'a'‿0⟩ ⌽⁼_eqerr ⟨0‿0⥊0,0‿0‿0⥊0⟩ !"Integer out of range: ∞" % %USE eqerr ⋄ ⟨3‿∞, ∞‿3, 0‿∞, ∞‿0⟩ ⌽_eqerr ⟨0‿0⥊0,0‿0‿0⥊0⟩ +!"𝕨⌽𝕩: 𝕨 must have rank at most 1 (1‿1 ≡ ≢𝕨)" % %USE eqerr ⋄ ⟨≍⋈1⟩ ⌽ _eqerr ⟨2‿2⥊1, ↕1⟩ +!"𝕨⌽⁼𝕩: 𝕨 must have rank at most 1 (1‿1 ≡ ≢𝕨)" % %USE eqerr ⋄ ⟨≍⋈1⟩ ⌽⁼_eqerr ⟨2‿2⥊1, ↕1⟩ +!"𝕨⌽𝕩: Length of list 𝕨 must be at most rank of 𝕩 (3 ≡ ≠𝕨, ⟨⟩ ≡ ≢𝕩⟩" % 1‿2‿3 ⌽ 1 +!"𝕨⌽⁼𝕩: 𝕩 must have rank at least 1" % 1‿2‿3 ⌽⁼ 1 +!"𝕨⌽𝕩: Length of list 𝕨 must be at most rank of 𝕩 (3 ≡ ≠𝕨, ⟨3⟩ ≡ ≢𝕩⟩" % 1‿2‿3 ⌽ ↕3 +!"𝕨⌽⁼𝕩: 𝕩 must have rank at least 1" % ⟨⟩ ⌽⁼ 1 +(<⁼ ⟨⟩⌽{a⇐1‿2}).a %% 1‿2 +1‿2‿3 ⌽ 4‿4‿4‿4⥊↕256 %% F←{(4|𝕨+↕4)⊏𝕩} ⋄ 3 F⎉2 2 F˘ 1 F 4‿4‿4‿4⥊↕256 (1+1e15) ⌽ ↕10 %% (1+↕9)∾0 (-1+1e15) ⌽ ↕10 %% 9∾↕9 diff --git a/test/cases/under.bqn b/test/cases/under.bqn index 975356ac..655a86dc 100644 --- a/test/cases/under.bqn +++ b/test/cases/under.bqn @@ -172,6 +172,6 @@ n←500 ⋄ a←↕n ⋄ i←(-n)+↕2×n ⋄ r←⌽(2×n)⥊a ⋄ ! (⌽a) ≡ !"⋈⁼: Argument wasn't a length-1 list" % (<4)⌾⋈ 2 # k⊸⌽ -!"⌽⁼: 𝕩 must have rank at least 1" % 1⌾(2⊸⌽) ↕10 +!"𝕨⌽⁼𝕩: 𝕩 must have rank at least 1" % 1⌾(2⊸⌽) ↕10 ⊏⌾(2⊸⌽) 10‿10⥊↕100 %% 28‿29‿20‿21‿22‿23‿24‿25‿26‿27 ≍⌾(1‿2⊸⌽) 5‿5⥊↕25 %% 1‿5‿5⥊22‿23‿24‿20‿21‿2‿3‿4‿0‿1‿7‿8‿9‿5‿6‿12‿13‿14‿10‿11‿17‿18‿19‿15‿16