From f02c92ee6a2bdb7d917bb54bd7a3da21481a3b9a Mon Sep 17 00:00:00 2001 From: dzaima Date: Thu, 23 Nov 2023 18:11:19 +0200 Subject: [PATCH] =?UTF-8?q?fix=203=20=E2=88=A8=20"abc"?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/singeli/c/arithdDispatch.c | 6 ++++-- test/cases/prims.bqn | 36 ++++++++++++++++------------------ 2 files changed, 21 insertions(+), 21 deletions(-) diff --git a/src/singeli/c/arithdDispatch.c b/src/singeli/c/arithdDispatch.c index 67a1a363..69693fb1 100644 --- a/src/singeli/c/arithdDispatch.c +++ b/src/singeli/c/arithdDispatch.c @@ -288,12 +288,14 @@ static NOINLINE B or_SA(B t, B w, B x) { return bit_sel(x, m_f64(bqn_or(wf, 0)), m_f64(bqn_or(wf, 1))); } x = num_squeezeChk(x); - if (TI(x,elType)==el_bit) goto bitsel; + u8 xe = TI(x,elType); + if (xe==el_bit) goto bitsel; + if (!elNum(xe)) return arith_recd(or_c2, w, x); + x = toF64Any(x); f64* rp; B r = m_f64arrc(&rp, x); usz ia = a(x)->ia; - x = toF64Any(x); orSAc_f64_f64_f64(rp, w.u, tyany_ptr(x), ia); decG(x); return r; diff --git a/test/cases/prims.bqn b/test/cases/prims.bqn index ac08fc6f..c7ac0ccf 100644 --- a/test/cases/prims.bqn +++ b/test/cases/prims.bqn @@ -35,28 +35,26 @@ (<1)+<1 %% <2 @-@ %% 0 !"-: Invalid character" % @-1 -!"+: Unexpected argument types" % @+@ -!"×: Unexpected argument types" % @×@ -!"÷: Unexpected argument types" % @÷@ -!"⋆: Unexpected argument types" % @⋆@ -!"√: Unexpected argument types" % @√@ -!"⌊: Unexpected argument types" % @⌊@ -!"⌈: Unexpected argument types" % @⌈@ -!"|: Unexpected argument types" % @|@ -!"∧: Unexpected argument types" % @∧@ -!"∨: Unexpected argument types" % @∨@ +{r←•Repr𝕩 ⋄ (⊢!≡´) (r∾": Unexpected argument types") ⋈ @ 0∘𝕏⎊{𝕊: •CurrentError@} @}¨ ⟨+, ×, ÷, ⋆, √, ⌊, ⌈, |, ∧, ∨, ÷⟩ +{r←•Repr𝕩 ⋄ (⊢!≡´) (r∾": Unexpected argument types") ⋈ 0 0∘𝕏⎊{𝕊: •CurrentError@} @}¨ ⟨ -, ×, ÷, ⋆, √, ⌊, ⌈, |, ∧, ∨, ÷⟩ +{r←•Repr𝕩 ⋄ (⊢!≡´) (r∾": Unexpected argument types") ⋈ @ 0∘𝕏⎊{𝕊: •CurrentError@} 0}¨ ⟨ ×, ÷, ⋆, √, ⌊, ⌈, |, ∧, ∨, ÷⟩ + +%USE var ⋄ a←4⥊@ ⋄ (LV a) {r←•Repr𝕩 ⋄ (⊢!≡´) (r∾": Unexpected argument types") ⋈ @ 0∘𝕏⎊{𝕊: •CurrentError@} 𝕨 V a}⌜ ⟨+, ×, ÷, ⋆, √, ⌊, ⌈, |, ∧, ∨, ÷⟩ +%USE var ⋄ a←4⥊@ ⋄ (LV a) {r←•Repr𝕩 ⋄ (⊢!≡´) (r∾": Unexpected argument types") ⋈ 0 0∘𝕏⎊{𝕊: •CurrentError@} 𝕨 V a}⌜ ⟨ -, ×, ÷, ⋆, √, ⌊, ⌈, |, ∧, ∨, ÷⟩ +%USE var ⋄ a←4⥊0 ⋄ (LV a) {r←•Repr𝕩 ⋄ (⊢!≡´) (r∾": Unexpected argument types") ⋈ @ 0∘𝕏⎊{𝕊: •CurrentError@} 𝕨 V a}⌜ ⟨ ×, ÷, ⋆, √, ⌊, ⌈, |, ∧, ∨, ÷⟩ + +%USE var ⋄ a←4⥊@ ⋄ (LV a) {r←•Repr𝕩 ⋄ (⊢!≡´) (r∾": Unexpected argument types") ⋈ (𝕨 V a) 0∘𝕏⎊{𝕊: •CurrentError@} @}⌜ ⟨+, ×, ÷, ⋆, √, ⌊, ⌈, |, ∧, ∨, ÷⟩ +%USE var ⋄ a←4⥊0 ⋄ (LV a) {r←•Repr𝕩 ⋄ (⊢!≡´) (r∾": Unexpected argument types") ⋈ (𝕨 V a) 0∘𝕏⎊{𝕊: •CurrentError@} @}⌜ ⟨ -, ×, ÷, ⋆, √, ⌊, ⌈, |, ∧, ∨, ÷⟩ +%USE var ⋄ a←4⥊@ ⋄ (LV a) {r←•Repr𝕩 ⋄ (⊢!≡´) (r∾": Unexpected argument types") ⋈ (𝕨 V a) 0∘𝕏⎊{𝕊: •CurrentError@} 0}⌜ ⟨ ×, ÷, ⋆, √, ⌊, ⌈, |, ∧, ∨, ÷⟩ + +%USE var ⋄ a←4⥊@ ⋄ b←4⥊@ ⋄ {r←•Repr f←𝕩 ⋄ {(⊢!≡´) (r∾": Unexpected argument types") ⋈ (𝕨 V a) 0∘F⎊{𝕊: •CurrentError@} 𝕩 V b}⌜○LV´ a‿b}⌜ ⟨+, ×, ÷, ⋆, √, ⌊, ⌈, |, ∧, ∨, ÷⟩ +%USE var ⋄ a←4⥊0 ⋄ b←4⥊@ ⋄ {r←•Repr f←𝕩 ⋄ {(⊢!≡´) (r∾": Unexpected argument types") ⋈ (𝕨 V a) 0∘F⎊{𝕊: •CurrentError@} 𝕩 V b}⌜○LV´ a‿b}⌜ ⟨ -, ×, ÷, ⋆, √, ⌊, ⌈, |, ∧, ∨, ÷⟩ +%USE var ⋄ a←4⥊@ ⋄ b←4⥊0 ⋄ {r←•Repr f←𝕩 ⋄ {(⊢!≡´) (r∾": Unexpected argument types") ⋈ (𝕨 V a) 0∘F⎊{𝕊: •CurrentError@} 𝕩 V b}⌜○LV´ a‿b}⌜ ⟨ ×, ÷, ⋆, √, ⌊, ⌈, |, ∧, ∨, ÷⟩ + !"-: Unexpected argument types" % 0-@ !"÷: Unexpected argument types" % 0÷@ !"+: Argument must consist of numbers" % +@ -!"-: Argument contained non-number" % -@ -!"×: Argument contained non-number" % ×@ -!"÷: Argument contained non-number" % ÷@ -!"⋆: Argument contained non-number" % ⋆@ -!"√: Argument contained non-number" % √@ -!"⌊: Argument contained non-number" % ⌊@ -!"⌈: Argument contained non-number" % ⌈@ -!"|: Argument contained non-number" % |@ -!"¬: Argument contained non-number" % ¬@ +⟨@, "abc", ⟨1,2,+⟩, {⇐}⟩ {(⊢!≡´) (": Argument contained non-number"∾˜•Repr 𝕩) ⋈ 0∘𝕏⎊{𝕊: •CurrentError@} 𝕨}⌜ -‿×‿÷‿⋆‿√‿⌊‿⌈‿|‿¬ !"This function can't be called monadically" % ≤@ !"This function can't be called monadically" % ≥@