diff --git a/basis/compiler/tests/optimizer.factor b/basis/compiler/tests/optimizer.factor index fa1248435b..72618db456 100644 --- a/basis/compiler/tests/optimizer.factor +++ b/basis/compiler/tests/optimizer.factor @@ -395,4 +395,20 @@ DEFER: loop-bbb : modular-arithmetic-bug ( a -- b ) >integer 256 mod ; [ 1 ] [ 257 modular-arithmetic-bug ] unit-test -[ -10 ] [ -10 modular-arithmetic-bug ] unit-test \ No newline at end of file +[ -10 ] [ -10 modular-arithmetic-bug ] unit-test + +! Optimizer needs to ignore invalid generics +GENERIC# bad-dispatch-position-test* 3 ( -- ) + +M: object bad-dispatch-position-test* ; + +: bad-dispatch-position-test ( -- ) bad-dispatch-position-test* ; + +[ 1 2 3 4 bad-dispatch-position-test ] must-fail + +[ ] [ + [ + \ bad-dispatch-position-test forget + \ bad-dispatch-position-test* forget + ] with-compilation-unit +] unit-test \ No newline at end of file diff --git a/basis/compiler/tree/propagation/inlining/inlining.factor b/basis/compiler/tree/propagation/inlining/inlining.factor index ee9abf00ec..6be3bed8d3 100755 --- a/basis/compiler/tree/propagation/inlining/inlining.factor +++ b/basis/compiler/tree/propagation/inlining/inlining.factor @@ -59,9 +59,11 @@ M: callable splicing-nodes splicing-body ; : inlining-standard-method ( #call word -- class/f method/f ) dup "methods" word-prop assoc-empty? [ 2drop f f ] [ - [ in-d>> ] [ [ dispatch# ] keep ] bi* - [ swap nth value-info class>> dup ] dip - specific-method + 2dup [ in-d>> length ] [ dispatch# ] bi* <= [ 2drop f f ] [ + [ in-d>> ] [ [ dispatch# ] keep ] bi* + [ swap nth value-info class>> dup ] dip + specific-method + ] if ] if ; : inline-standard-method ( #call word -- ? )