fix 𝕨⊏unit

This commit is contained in:
dzaima 2024-03-25 15:55:58 +02:00
parent 96cf03311a
commit a94903cb12
2 changed files with 8 additions and 2 deletions

View File

@ -115,9 +115,9 @@ static NOINLINE NORETURN void select_properError(B w, B x) {
B select_c2(B t, B w, B x) {
if (isAtm(x)) thrM("⊏: 𝕩 cannot be an atom");
ur xr = RNK(x);
if (xr==0) thrM("⊏: 𝕩 cannot be a unit");
if (isAtm(w)) {
watom:;
if (xr==0) thrM("⊏: 𝕩 cannot be a unit");
usz xn = *SH(x);
usz wi = WRAP(o2i64(w), xn, thrF("⊏: Indexing out-of-bounds (%R∊𝕨, %s≡≠𝕩)", w, xn));
if (xr==1) {

View File

@ -116,6 +116,12 @@
%USE tvar !¨ {𝕨 (•CurrentError) _tvar 𝕩}´¨ 01, 0 01, "?" 01, 01
a2 ! "e" (10){baaaaaaaaaa 𝕨"e"𝕩}12,34 ! 01 a
%USE eqvar {1¯1 {r𝕨𝕩 ! 𝕩 •internal.ElType r r}_eqvar 𝕩}¨ 2, 4, "hello", "ab", "cd", "ef", 4
!"⊏: 𝕩 cannot be a unit" % 0<"a"
!"⊏: 𝕩 cannot be a unit" % 0<5
!"⊏: 𝕩 cannot be an atom" % 05
!"⊏: 𝕩 cannot be a unit" % <"a"
!"⊏: 𝕩 cannot be a unit" % <5
!"⊏: 𝕩 cannot be an atom" % 5
# 𝕨⊑𝕩
!"⊑: 𝕨 contained a non-integer" % 0.13
@ -361,4 +367,4 @@ w←1‿1⥊1 ⋄ x←2⥊1 ⋄ w‿x <¨↩ ⋄ {! (∾⟨•Repr𝕩,": Expe
# ˜
5˜˝ "ab" %% 5
5˜˜ "a" %% [[5]]
5˜˝˘"ab" %% 5
5˜˝˘"ab" %% 5