non-polymorphic input parameter check was too strict: wouldn't allow ( x -- ) for ( x x -- x ), for example

db4
Joe Groff 2010-03-09 15:57:00 -08:00
parent 8a52aec6da
commit 34b29af245
2 changed files with 10 additions and 1 deletions

View File

@ -37,7 +37,7 @@ IN: stack-checker.row-polymorphism
[ variable vars at - ] [ variable vars at - ]
[ variable vars set-at 0 ] if [ variable vars set-at 0 ] if
t t
] [ dup zero? ] if ; ] [ dup 0 <= ] if ;
: adjust-variable ( diff var vars -- ) : adjust-variable ( diff var vars -- )
pick 0 >= pick 0 >=

View File

@ -431,9 +431,18 @@ DEFER: eee'
: strict-each ( seq quot: ( x -- ) -- ) : strict-each ( seq quot: ( x -- ) -- )
each ; inline each ; inline
: strict-map ( seq quot: ( x -- x' ) -- seq' )
map ; inline
: strict-2map ( xs ys quot: ( x y -- z ) -- zs )
2map ; inline
{ 1 0 } [ [ drop ] strict-each ] must-infer-as { 1 0 } [ [ drop ] strict-each ] must-infer-as
{ 1 1 } [ [ 1 + ] strict-map ] must-infer-as
{ 1 1 } [ [ ] strict-map ] must-infer-as
{ 2 1 } [ [ + ] strict-2map ] must-infer-as
{ 2 1 } [ [ drop ] strict-2map ] must-infer-as
[ [ [ append ] strict-each ] infer ] [ unbalanced-branches-error? ] must-fail-with [ [ [ append ] strict-each ] infer ] [ unbalanced-branches-error? ] must-fail-with
[ [ [ 1 + ] strict-2map ] infer ] [ unbalanced-branches-error? ] must-fail-with
! ensure that polymorphic checking works on recursive combinators ! ensure that polymorphic checking works on recursive combinators
FROM: splitting.private => split, ; FROM: splitting.private => split, ;