diff --git a/core/optimizer/control/control.factor b/core/optimizer/control/control.factor index 26c74b32b4..de3aeb220a 100755 --- a/core/optimizer/control/control.factor +++ b/core/optimizer/control/control.factor @@ -145,9 +145,6 @@ M: #call-label detect-loops* : clone-node ( node -- newnode ) clone dup [ clone ] modify-values ; -: detach-node-successor ( node -- successor ) - dup node-successor #terminate rot set-node-successor ; - ! BEFORE ! ! #if ----> #merge ----> B ----> #return/#values @@ -261,6 +258,9 @@ M: #dispatch optimize-node* ] if ] when ; +: detach-node-successor ( node -- successor ) + dup node-successor #terminate rot set-node-successor ; + : lift-loop-tail? ( #label -- tail/f ) dup node-successor node-successor [ dup node-param swap node-child find-final-if dup [ diff --git a/core/optimizer/optimizer-tests.factor b/core/optimizer/optimizer-tests.factor index 0984350c6b..e5e0d9fe77 100755 --- a/core/optimizer/optimizer-tests.factor +++ b/core/optimizer/optimizer-tests.factor @@ -301,3 +301,15 @@ TUPLE: silly-tuple a b ; [ t ] [ \ array \ nth-unsafe should-inline? ] unit-test [ t ] [ \ growable \ nth-unsafe should-inline? ] unit-test [ t ] [ \ sbuf \ set-nth-unsafe should-inline? ] unit-test + +! Regression +: lift-throw-tail-regression + dup integer? [ "an integer" ] [ + dup string? [ "a string" ] [ + "error" throw + ] if + ] if ; + +[ t ] [ \ lift-throw-tail-regression compiled? ] unit-test +[ 3 "an integer" ] [ 3 lift-throw-tail-regression ] unit-test +[ "hi" "a string" ] [ "hi" lift-throw-tail-regression ] unit-test