From 7fa7ed962f3c0f0e490f95926e6b686c1bf1cfa5 Mon Sep 17 00:00:00 2001 From: Slava Pestov Date: Mon, 11 Feb 2008 15:28:09 -0600 Subject: [PATCH] Fix prettyprinting of invalid curries and tuples --- core/prettyprint/backend/backend.factor | 13 ++++++++++++- core/prettyprint/prettyprint-tests.factor | 4 ++++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/core/prettyprint/backend/backend.factor b/core/prettyprint/backend/backend.factor index d1364a5986..226595aa4d 100755 --- a/core/prettyprint/backend/backend.factor +++ b/core/prettyprint/backend/backend.factor @@ -182,9 +182,20 @@ M: tuple pprint-narrow? drop t ; >pprint-sequence pprint-elements block> r> pprint-word block> ] check-recursion ; - + M: object pprint* pprint-object ; +M: curry pprint* + dup curry-quot callable? [ pprint-object ] [ + "( invalid curry )" swap present-text + ] if ; + +M: compose pprint* + dup compose-first over compose-second [ callable? ] both? + [ pprint-object ] [ + "( invalid compose )" swap present-text + ] if ; + M: wrapper pprint* dup wrapped word? [ diff --git a/core/prettyprint/prettyprint-tests.factor b/core/prettyprint/prettyprint-tests.factor index 5907c22686..a7e087ffad 100755 --- a/core/prettyprint/prettyprint-tests.factor +++ b/core/prettyprint/prettyprint-tests.factor @@ -321,3 +321,7 @@ unit-test [ [ 2 . ] ] [ [ 2 \ break (step-into) . ] (remove-breakpoints) ] unit-test + +[ ] [ 1 \ + curry unparse drop ] unit-test + +[ ] [ 1 \ + compose unparse drop ] unit-test