handle header […]←rank0 properly

This commit is contained in:
dzaima 2024-06-16 13:56:18 +03:00
parent 563c30c596
commit 4ab84c05f6
2 changed files with 8 additions and 1 deletions

View File

@ -503,7 +503,10 @@ NOINLINE Block* compileAll(B bcq, B objs, B allBlocks, B allBodies, B indices, B
FORCE_INLINE bool v_merge(Scope* pscs[], B s, B x, bool upd, bool hdr) {
assert(TY(s) == t_arrMerge);
B o = c(WrappedObj,s)->obj;
if (!isArr(x) || RNK(x)==0) thrF("[…]%c𝕩: 𝕩 cannot have rank 0", upd? U'' : U'');
if (!isArr(x) || RNK(x)==0) {
if (hdr) return false;
else thrF("[…]%c𝕩: 𝕩 cannot have rank 0", upd? U'' : U'');
}
B* op = harr_ptr(o);
usz oia = IA(o);

View File

@ -4,6 +4,10 @@
a"zero""one" !aa{𝕩?1𝕨;0𝕨}¨01
!"No header matched argument" % { 𝕊ab: a+b ; d𝕊abc: a+b+c} 3
!"No header matched argument" % {d𝕊ab: a+b ; 𝕊abc: a+b+c} 2
{[a,b]: 1; 9} @ %% 9
{[a,b]: 1; 9} <4 %% 9
{[a,b]: 1; 9} 4 %% 9
{[a,b]: 1; 9} 42 %% 9
{𝕊ab: a+b ; 𝕊abc: a+b+c} 2 %% 1
{𝕊ab: a+b ; 𝕊abc: a+b+c} 3 %% 3
{4=𝕩? "four" ; "idk: "𝕩}4+3 %% "four"