From fd3a56819156f74900d569bee39f3b212811750b Mon Sep 17 00:00:00 2001 From: Slava Pestov Date: Tue, 12 May 2009 20:47:20 -0500 Subject: [PATCH] Fix GENERIC# with out of bounds dispatch position --- core/generic/single/single-tests.factor | 7 ++++++- core/generic/standard/standard.factor | 6 +++++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/core/generic/single/single-tests.factor b/core/generic/single/single-tests.factor index e48d404b92..61ae4e1ba1 100644 --- a/core/generic/single/single-tests.factor +++ b/core/generic/single/single-tests.factor @@ -274,4 +274,9 @@ M: growable call-next-hooker call-next-method "growable " prepend ; [ ] [ "IN: generic.single.tests MATH: xyz ( a b -- c )" eval( -- ) ] unit-test [ f ] [ "xyz" "generic.single.tests" lookup pic-def>> ] unit-test -[ f ] [ "xyz" "generic.single.tests" lookup "decision-tree" word-prop ] unit-test \ No newline at end of file +[ f ] [ "xyz" "generic.single.tests" lookup "decision-tree" word-prop ] unit-test + +! Corner case +[ "IN: generic.single.tests GENERIC# broken-generic# -1 ( a -- b )" eval( -- ) ] +[ error>> bad-dispatch-position? ] +must-fail-with \ No newline at end of file diff --git a/core/generic/standard/standard.factor b/core/generic/standard/standard.factor index b76bcaa582..0d1220beac 100644 --- a/core/generic/standard/standard.factor +++ b/core/generic/standard/standard.factor @@ -6,9 +6,13 @@ generic.single.private quotations kernel.private assocs arrays layouts make ; IN: generic.standard +ERROR: bad-dispatch-position # ; + TUPLE: standard-combination < single-combination # ; -C: standard-combination +: ( # -- standard-combination ) + dup 0 < [ bad-dispatch-position ] when + standard-combination boa ; PREDICATE: standard-generic < generic "combination" word-prop standard-combination? ;