diff --git a/basis/locals/locals-tests.factor b/basis/locals/locals-tests.factor index eb06d05146..bc1e736b75 100755 --- a/basis/locals/locals-tests.factor +++ b/basis/locals/locals-tests.factor @@ -1,7 +1,7 @@ USING: locals math sequences tools.test hashtables words kernel namespaces arrays strings prettyprint io.streams.string parser accessors generic eval combinators combinators.short-circuit -combinators.short-circuit.smart ; +combinators.short-circuit.smart math.order ; IN: locals.tests :: foo ( a b -- a a ) a a ; @@ -331,4 +331,13 @@ M:: sequence method-with-locals ( a -- y ) a reverse ; [ T{ slice f 0 3 "abc" } ] [ 0 3 "abc" [| from to seq | T{ slice f from to seq } ] call ] unit-test -{ 3 1 } [| from to seq | T{ slice f from to seq } ] must-infer-as \ No newline at end of file +{ 3 1 } [| from to seq | T{ slice f from to seq } ] must-infer-as + +:: compare-case ( obj1 obj2 lt-quot eq-quot gt-quot -- ) + obj1 obj2 <=> { + { +lt+ [ lt-quot call ] } + { +eq+ [ eq-quot call ] } + { +gt+ [ gt-quot call ] } + } case ; inline + +[ [ ] [ ] [ ] compare-case ] must-infer \ No newline at end of file diff --git a/basis/macros/expander/expander-tests.factor b/basis/macros/expander/expander-tests.factor index fe0154b725..8e6d8bc4b4 100644 --- a/basis/macros/expander/expander-tests.factor +++ b/basis/macros/expander/expander-tests.factor @@ -7,3 +7,5 @@ kernel ; [ f ] [ 15 [ { [ integer? ] [ even? ] [ 10 > ] } 1&& ] expand-macros call ] unit-test [ f ] [ 5.0 [ { [ integer? ] [ even? ] [ 10 > ] } 1&& ] expand-macros call ] unit-test + +[ [ no-case ] ] [ [ { } case ] expand-macros ] unit-test diff --git a/basis/macros/expander/expander.factor b/basis/macros/expander/expander.factor index d766430810..d62c6bf466 100644 --- a/basis/macros/expander/expander.factor +++ b/basis/macros/expander/expander.factor @@ -33,8 +33,8 @@ M: wrapper expand-macros* wrapped>> literal ; stack get pop >quotation end (expand-macros) ; : expand-macro? ( word -- quot ? ) - dup [ "macro" word-prop ] [ "transform-quot" word-prop ] bi or dup [ - swap [ stack-effect in>> length ] [ "transform-n" word-prop ] bi or + dup [ "transform-quot" word-prop ] [ "macro" word-prop ] bi or dup [ + swap [ "transform-n" word-prop ] [ stack-effect in>> length ] bi or stack get length <= ] [ 2drop f f ] if ;