consistent 𝕨⊏𝕩 error messages across argument types
This commit is contained in:
parent
2eb12fef82
commit
78bef5fe32
@ -106,6 +106,13 @@ B select_c1(B t, B x) {
|
|||||||
decG(x);
|
decG(x);
|
||||||
return taga(r);
|
return taga(r);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
B select_c2(B t, B w, B x);
|
||||||
|
static NOINLINE NORETURN void select_properError(B w, B x) {
|
||||||
|
select_c2(w, w, taga(cpyHArr(x)));
|
||||||
|
fatal("select_properError");
|
||||||
|
}
|
||||||
|
|
||||||
B select_c2(B t, B w, B x) {
|
B select_c2(B t, B w, B x) {
|
||||||
if (isAtm(x)) thrM("⊏: 𝕩 cannot be an atom");
|
if (isAtm(x)) thrM("⊏: 𝕩 cannot be an atom");
|
||||||
ur xr = RNK(x);
|
ur xr = RNK(x);
|
||||||
@ -113,7 +120,7 @@ B select_c2(B t, B w, B x) {
|
|||||||
watom:;
|
watom:;
|
||||||
if (xr==0) thrM("⊏: 𝕩 cannot be a unit");
|
if (xr==0) thrM("⊏: 𝕩 cannot be a unit");
|
||||||
usz xn = *SH(x);
|
usz xn = *SH(x);
|
||||||
usz wi = WRAP(o2i64(w), xn, thrF("⊏: Indexing out-of-bounds (%R∊𝕨, %H≡≢𝕩)", w, x));
|
usz wi = WRAP(o2i64(w), xn, thrF("⊏: Indexing out-of-bounds (%R∊𝕨, %s≡≠𝕩)", w, xn));
|
||||||
if (xr==1) {
|
if (xr==1) {
|
||||||
B xf = getFillR(x);
|
B xf = getFillR(x);
|
||||||
B xv = IGet(x, wi);
|
B xv = IGet(x, wi);
|
||||||
@ -178,11 +185,11 @@ B select_c2(B t, B w, B x) {
|
|||||||
|
|
||||||
#if SINGELI_AVX2
|
#if SINGELI_AVX2
|
||||||
#define CPUSEL(W, NEXT) /*assumes 3≤xl≤6*/ \
|
#define CPUSEL(W, NEXT) /*assumes 3≤xl≤6*/ \
|
||||||
if (!avx2_select_tab[4*(we-el_i8)+xl-3](wp, xp, rp, wia, xn)) thrM("⊏: Indexing out-of-bounds");
|
if (RARE(!avx2_select_tab[4*(we-el_i8)+xl-3](wp, xp, rp, wia, xn))) select_properError(w, x);
|
||||||
bool bool_use_simd = we==el_i8 && xl==0 && xia<=128;
|
bool bool_use_simd = we==el_i8 && xl==0 && xia<=128;
|
||||||
#define BOOL_SPECIAL(W) \
|
#define BOOL_SPECIAL(W) \
|
||||||
if (sizeof(W)==1 && bool_use_simd) { \
|
if (sizeof(W)==1 && bool_use_simd) { \
|
||||||
if (!avx2_select_bool128(wp, xp, rp, wia, xn)) thrM("⊏: Indexing out-of-bounds"); \
|
if (RARE(!avx2_select_bool128(wp, xp, rp, wia, xn))) select_properError(w, x); \
|
||||||
goto setsh; \
|
goto setsh; \
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
@ -254,8 +261,8 @@ B select_c2(B t, B w, B x) {
|
|||||||
if (xl!=6) goto generic_l; \
|
if (xl!=6) goto generic_l; \
|
||||||
M_HARR(ra, wia); B* xp = arr_bptr(x); \
|
M_HARR(ra, wia); B* xp = arr_bptr(x); \
|
||||||
SLOWIF(xp==NULL) SLOW2("𝕨⊏𝕩", w, x); \
|
SLOWIF(xp==NULL) SLOW2("𝕨⊏𝕩", w, x); \
|
||||||
if (xp!=NULL) { for (usz i=0; i<wia; i++) HARR_ADD(ra, i, inc(xp[WRAP(wp[i], xia, thrF("⊏: Indexing out-of-bounds (%i∊𝕨, %H≡≢𝕩)", wp[i], x))])); } \
|
if (xp!=NULL) { for (usz i=0; i<wia; i++) HARR_ADD(ra, i, inc(xp[WRAP(wp[i], xia, thrF("⊏: Indexing out-of-bounds (%i∊𝕨, %s≡≠𝕩)", wp[i], xn))])); } \
|
||||||
else { SGet(x); for (usz i=0; i<wia; i++) HARR_ADD(ra, i, Get(x, WRAP(wp[i], xia, thrF("⊏: Indexing out-of-bounds (%i∊𝕨, %H≡≢𝕩)", wp[i], x)) )); } \
|
else { SGet(x); for (usz i=0; i<wia; i++) HARR_ADD(ra, i, Get(x, WRAP(wp[i], xia, thrF("⊏: Indexing out-of-bounds (%i∊𝕨, %s≡≠𝕩)", wp[i], xn)) )); } \
|
||||||
r = a(withFill(HARR_FV(ra), xf)); goto setsh; \
|
r = a(withFill(HARR_FV(ra), xf)); goto setsh; \
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -276,7 +283,7 @@ B select_c2(B t, B w, B x) {
|
|||||||
if (xia<2) {
|
if (xia<2) {
|
||||||
u64* wp=bitarr_ptr(w);
|
u64* wp=bitarr_ptr(w);
|
||||||
usz i; for (i=0; i<wia/64; i++) if (wp[i]) break;
|
usz i; for (i=0; i<wia/64; i++) if (wp[i]) break;
|
||||||
if (i<wia/64 || bitp_l0(wp,wia)!=0) thrF("⊏: Indexing out-of-bounds (1∊𝕨, %H≡≢𝕩)", x);
|
if (i<wia/64 || bitp_l0(wp,wia)!=0) thrF("⊏: Indexing out-of-bounds (1∊𝕨, %s≡≠𝕩)", xn);
|
||||||
x1 = x0;
|
x1 = x0;
|
||||||
} else {
|
} else {
|
||||||
x1 = GetU(x,1);
|
x1 = GetU(x,1);
|
||||||
@ -341,7 +348,7 @@ B select_c2(B t, B w, B x) {
|
|||||||
|
|
||||||
bad1:;
|
bad1:;
|
||||||
mut_pfree(rm, i*csz);
|
mut_pfree(rm, i*csz);
|
||||||
thrF("⊏: Indexing out-of-bounds (%f∊𝕨, %H≡≢𝕩)", badw, x);
|
thrF("⊏: Indexing out-of-bounds (%f∊𝕨, %s≡≠𝕩)", badw, xn);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -79,17 +79,18 @@
|
|||||||
•internal.ElType¨ {(100⥊↕2)⊏𝕨‿𝕩}⌜˜ ⟨0, 1, 2, 127, 128, 32767, 32768, ¯32767, ¯32768, ¯32769, ¯1+2⋆31, 2⋆31, @, @+1, @+255, @+256, @+1114111, {⇐}, 1‿2⟩ %% (8-(=⌜˜<⟜5)×8-⌈⌜˜) 0‿0‿1‿1‿2‿2‿3‿2‿2‿3‿3‿4‿5‿5‿5‿6‿7‿8‿8
|
•internal.ElType¨ {(100⥊↕2)⊏𝕨‿𝕩}⌜˜ ⟨0, 1, 2, 127, 128, 32767, 32768, ¯32767, ¯32768, ¯32769, ¯1+2⋆31, 2⋆31, @, @+1, @+255, @+256, @+1114111, {⇐}, 1‿2⟩ %% (8-(=⌜˜<⟜5)×8-⌈⌜˜) 0‿0‿1‿1‿2‿2‿3‿2‿2‿3‿3‿4‿5‿5‿5‿6‿7‿8‿8
|
||||||
0‿0‿0 ⊏ 1‿3⥊↕10 %% 3‿3⥊0‿1‿2
|
0‿0‿0 ⊏ 1‿3⥊↕10 %% 3‿3⥊0‿1‿2
|
||||||
≢¨ ⟨(2‿0‿3‿4‿5⥊1)⊏9‿8‿0‿7⥊0 ⋄ ⟨⟩⊏0‿8‿0‿7⥊0 ⋄ (2‿3‿0‿4⥊1)⊏↕10⟩ %% ⟨2‿0‿3‿4‿5‿8‿0‿7,0‿8‿0‿7,2‿3‿0‿4⟩
|
≢¨ ⟨(2‿0‿3‿4‿5⥊1)⊏9‿8‿0‿7⥊0 ⋄ ⟨⟩⊏0‿8‿0‿7⥊0 ⋄ (2‿3‿0‿4⥊1)⊏↕10⟩ %% ⟨2‿0‿3‿4‿5‿8‿0‿7,0‿8‿0‿7,2‿3‿0‿4⟩
|
||||||
!"⊏: Indexing out-of-bounds" % ⊏˜(200⥊1)⥊1
|
!"⊏: Indexing out-of-bounds (1∊𝕨, 1≡≠𝕩)" % ⊏˜(200⥊1)⥊1
|
||||||
!"⊏: Indexing out-of-bounds (24∊𝕨, 4‿4≡≢𝕩)" % 1‿24⊏↕4‿4
|
!"⊏: Indexing out-of-bounds (24∊𝕨, 4≡≠𝕩)" % 1‿24⊏↕4‿4
|
||||||
!"⊏: Indexing out-of-bounds (¯24∊𝕨, 4‿4≡≢𝕩)" % 1‿¯24⊏↕4‿4
|
!"⊏: Indexing out-of-bounds (¯24∊𝕨, 4≡≠𝕩)" % 1‿¯24⊏↕4‿4
|
||||||
!"𝕨⊏𝕩: 𝕨 must be an array of numbers or list of such arrays" % (1‿¯26∾@)⊏@∾↕5
|
!"𝕨⊏𝕩: 𝕨 must be an array of numbers or list of such arrays" % (1‿¯26∾@)⊏@∾↕5
|
||||||
!"⊏: Indexing out-of-bounds (¯26∊𝕨, ⟨5⟩≡≢𝕩)" % ¯26⊏↕5
|
!"⊏: Indexing out-of-bounds (¯26∊𝕨, 5≡≠𝕩)" % ¯26⊏↕5
|
||||||
!"Expected integer" % ¯26.5⊏↕5
|
!"Expected integer" % ¯26.5⊏↕5
|
||||||
!"⊏: Indexing out-of-bounds" % 1‿¯26⊏↕5
|
!"⊏: Indexing out-of-bounds (¯26∊𝕨, 5≡≠𝕩)" % 1‿¯26⊏↕5
|
||||||
!"⊏: Indexing out-of-bounds" % 1‿26⊏↕5
|
!"⊏: Indexing out-of-bounds (26∊𝕨, 5≡≠𝕩)" % 1‿26⊏↕5
|
||||||
!"Expected integer" % 0‿1.1‿2 ⊏ ↕10
|
!"Expected integer" % 0‿1.1‿2 ⊏ ↕10
|
||||||
!"⊏: Indexing out-of-bounds (1∊𝕨, 1‿3≡≢𝕩)" % 0‿0‿1 ⊏ 1‿3⥊↕10000
|
!"⊏: Indexing out-of-bounds (1∊𝕨, 1≡≠𝕩)" % 0‿0‿1 ⊏ 1‿3⥊↕10000
|
||||||
!"⊏: Indexing out-of-bounds (2∊𝕨, ⟨2⟩≡≢𝕩)" % (1+9=↕10)⊏⟨1‿2,3⟩
|
!"⊏: Indexing out-of-bounds (2∊𝕨, 2≡≠𝕩)" % (1+9=↕10)⊏⟨1‿2,3⟩
|
||||||
|
%USE tvar ⋄ !∘≡¨⟜⊏ ∾ {⥊𝕨 ⊏⎊(•CurrentError∘⊢) _tvar 𝕩}´¨ ⟨⟨0‿1, ⋈0⟩ ⋄ ⟨0‿1, "?"⟩ ⋄ ⟨0‿1, ≍0‿1⟩⟩
|
||||||
a←↕2 ⋄ ! "e" ≡ (↕10){b←a‿a‿a‿a‿a‿a‿a‿a‿a‿a ⋄ 𝕨⊏⎊"e"𝕩}⟨1‿2,3‿4⟩ ⋄ ! 0‿1 ≡ a
|
a←↕2 ⋄ ! "e" ≡ (↕10){b←a‿a‿a‿a‿a‿a‿a‿a‿a‿a ⋄ 𝕨⊏⎊"e"𝕩}⟨1‿2,3‿4⟩ ⋄ ! 0‿1 ≡ a
|
||||||
%USE tvar ⋄ {!∘≡¨⟜⊏⥊ 1‿¯1 {t←•internal.ElType 𝕩 ⋄ r←𝕨⊏𝕩 ⋄ t≥•internal.ElType r ⋄ r}_tvar 𝕩}¨ ⟨↕2, ↕4, "hello", ⟨"ab", "cd", "ef"⟩, ↕⋈4⟩
|
%USE tvar ⋄ {!∘≡¨⟜⊏⥊ 1‿¯1 {t←•internal.ElType 𝕩 ⋄ r←𝕨⊏𝕩 ⋄ t≥•internal.ElType r ⋄ r}_tvar 𝕩}¨ ⟨↕2, ↕4, "hello", ⟨"ab", "cd", "ef"⟩, ↕⋈4⟩
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user