Skip to content

Commit 1268ceb

Browse files
committed
fix #543: d:.(); d
1 parent c62db03 commit 1268ceb

File tree

2 files changed

+12
-7
lines changed

2 files changed

+12
-7
lines changed

src/kx.c

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -406,15 +406,18 @@ K vf_ex(V q, K g)
406406
if(!g) R 0; //??? R w converted to type7...or ?
407407
K z=0; U(g=promote(g)) I gn=g->n,k=sva(q),n=-1,j=0;
408408
if(!k&&!(*(V*)q)){ cd(g); R 0; } // (2="2") 2 err
409-
if(q>(V)DT_SIZE)
410-
{ K h=(K)(*(V*)q);
411-
if(h->t==7 && h->n==1 && kK(h)[CODE] && (UI)kK(kK(h)[CODE])[0]>DT_SIZE)
412-
{ if(kK(h)[CODE]->n==3 && (*(K*)(kS(kK(h)[CODE])[0]))->t==0 ) { z=dot(*(K*)(kS(kK(h)[CODE])[0]),g); GC; }
413-
if((UI)kK(kK(h)[CODE])[1]==0x3a && g->t==0 ){ z=dot( *(K*)(kS(kK(h)[CODE])[0]), kK(g)[0] ); GC; } } }
414409
n=valence(q); I ee=0;
415410
if(q>(V)DT_SIZE)
416-
{ K e=*(K*)q;
417-
if(e->t==7 && e->n==1 && (V)kS(kK(e)[CODE])[0]>(V)DT_SIZE && (*(K*)kS(kK(e)[CODE])[0])->t==7){ n=2; ee=1; } }
411+
{ K h=*(K*)q;
412+
if(h->t==7)
413+
{ if(h->n==1)
414+
{ if(kK(h)[CODE] && (UI)kK(kK(h)[CODE])[0]>DT_SIZE)
415+
{ if(kK(h)[CODE]->n==3 && (*(K*)(kS(kK(h)[CODE])[0]))->t==0 ) { z=dot(*(K*)(kS(kK(h)[CODE])[0]),g); GC; }
416+
if((UI)kK(kK(h)[CODE])[1]==0x3a && g->t==0 ){ z=dot( *(K*)(kS(kK(h)[CODE])[0]), kK(g)[0] ); GC; } }
417+
if((V)kS(kK(h)[CODE])[0]>(V)DT_SIZE && (*(K*)kS(kK(h)[CODE])[0])->t==7){ n=2; ee=1; } }
418+
if(-4==(kK(h)[2])->t && 2==(kK(h)[2])->n && kV(kK(h)[2])[0]==(V)0x3a && 0==g->t )
419+
{ if(NULL==kV(g)[0]){ z=ci(*(K*)q); kV(z)[5]=(V)ci(g); GC; }
420+
if(6==kK(g)[0]->t){ z=ci(*(K*)q); kV(z)[5]=(V)ci(kK(z)[4]); kK(z)[2][0]=kK(z)[2][1]; ci(kK(z)[2]); GC; } } } }
418421
if(ee && !kV(g)[0] && kV(g)[1]) fom=1;
419422
if( ((k || (*(K*)q)->t==7) && ( ((UI)q<DT_SIZE || (*(V*)q)) && gn>n && !(!n && 1>=gn))) || (ee && kV(g)[0] && kV(g)[1]) )
420423
{ if(kK(g)[0]==NULL){ VE; GC; }

src/tests.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -314,6 +314,8 @@ Z I tests02()
314314
TC_( "1 2", "(1 2 1)\\1" ) // issue 572
315315
TC_( "12 6 3", "0 1 1 3 2 5 3 7 4 9 5 11 6\\ 12" ) // issue 572
316316
TC( 1, d:.((`a;0);(`b;1)); `d .`b ) // issue 571
317+
TC( .[;;;;], .[;;;;] ) // issue 543 testing for leaks
318+
TC( .[], .[] ) // issue 543 testing for leaks
317319

318320
//Error trap: {[a;b][c;d] a+b} -> parse error ; { {[a][b] }} -> parse error
319321
TC(.[*; (3;4); :], (0;12) )

0 commit comments

Comments
 (0)