further improve error message for invalid quotation inputs using a table display with the actual quotation effects determined so far

db4
Joe Groff 2010-03-07 18:40:58 -08:00
parent ea4545e366
commit 1512ed12f3
4 changed files with 11 additions and 5 deletions

View File

@ -34,5 +34,5 @@ ERROR: transform-expansion-error < inference-error error continuation word ;
ERROR: bad-declaration-error < inference-error declaration ;
ERROR: invalid-quotation-input < inference-error word quots branches ;
ERROR: invalid-quotation-input < inference-error word quots declareds actuals ;

View File

@ -71,5 +71,6 @@ M: invalid-quotation-input summary
M: invalid-quotation-input error.
dup summary print
[ quots>> ] [ branches>> ] bi quots-and-branches. ;
[ quots>> ] [ declareds>> ] [ actuals>> ] tri 3array flip
{ "Input" "Expected" "Got" } prefix simple-table. ;

View File

@ -83,10 +83,12 @@ IN: stack-checker.row-polymorphism
[ word>> ] [
branches>> <reversed>
[ [ known>callable ] { } map-as ]
[ [ effect>> ] { } map-as ] bi
[ [ effect>> ] { } map-as ]
[ [ actual>> ] { } map-as ] tri
] bi invalid-quotation-input ;
: check-declared-effect ( known effect -- )
[ >>actual ] keep
2dup [ [ variables>> ] [ effect>> ] bi ] dip check-variables
[ 2drop ] [ drop invalid-quotation-input* ] if ;

View File

@ -100,9 +100,12 @@ M: input-parameter (literal) current-word get unknown-macro-input ;
! Argument corresponding to polymorphic declared input of inline combinator
TUPLE: declared-effect known word effect variables branches ;
TUPLE: declared-effect known word effect variables branches actual ;
C: <declared-effect> declared-effect
C: (declared-effect) declared-effect
: <declared-effect> ( known word effect variables branches -- declared-effect )
f (declared-effect) ; inline
M: declared-effect (input-value?) known>> (input-value?) ;