From cde3c043bf551a9ec994f7380e56c3e653c6ef19 Mon Sep 17 00:00:00 2001 From: Doug Coleman Date: Mon, 28 Nov 2011 20:54:17 -0800 Subject: [PATCH] combinators.smart: Fix infer-known; should be 100% now. It's stack-checker bugs all the way down. --- basis/combinators/smart/smart-tests.factor | 4 ++++ basis/combinators/smart/smart.factor | 13 ++++++++----- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/basis/combinators/smart/smart-tests.factor b/basis/combinators/smart/smart-tests.factor index c7c11401c9..0a28c0ea83 100644 --- a/basis/combinators/smart/smart-tests.factor +++ b/basis/combinators/smart/smart-tests.factor @@ -82,3 +82,7 @@ IN: combinators.smart.tests :: map-reduce-test ( a b c -- d ) [ a b c ] [ a - ] [ b * + ] map-reduce-outputs ; [ ] [ 1 2 3 map-reduce-test ] unit-test + +[ ( x x -- x ) ] [ [ curry inputs ] infer ] unit-test + +[ ( x -- x ) ] [ [ [ curry ] curry inputs ] infer ] unit-test diff --git a/basis/combinators/smart/smart.factor b/basis/combinators/smart/smart.factor index d36fc56557..9742ca72a2 100644 --- a/basis/combinators/smart/smart.factor +++ b/basis/combinators/smart/smart.factor @@ -30,19 +30,22 @@ GENERIC: infer-known* ( known -- effect ) ] if* ] "special" set-word-prop -! TODO: Handle the case where a nested call to infer-known returns f - M: curried infer-known* - quot>> infer-known curry-effect ; + quot>> infer-known dup [ + curry-effect + ] [ + drop f + ] if ; M: composed infer-known* [ quot1>> ] [ quot2>> ] bi - [ infer-known ] bi@ compose-effects ; + [ infer-known ] bi@ + 2dup and [ compose-effects ] [ 2drop f ] if ; M: declared-effect infer-known* known>> infer-known* ; -M: input-parameter infer-known* \ inputs/outputs unknown-macro-input ; +M: input-parameter infer-known* drop f ; M: object infer-known* drop f ;