For abstracts, the super method just calls void.
Since mixins rely on super calls to possibly abstract methods, we want to ensure that the super call will not error when it gets to an abstract method. However, external method calls should still raise an error for abstract methods.
This commit is contained in:
parent
11c589af31
commit
f4f6f8c52c
|
@ -2411,6 +2411,11 @@
|
|||
(append new-augonly-indices new-final-indices
|
||||
new-abstract-indices new-normal-indices)
|
||||
new-methods)
|
||||
;; Add only abstracts, making sure the super method just calls (void)
|
||||
(let ([dummy (lambda args (void))])
|
||||
(for-each (lambda (index)
|
||||
(vector-set! super-methods index dummy))
|
||||
new-abstract-indices))
|
||||
;; Override old methods:
|
||||
(for-each (lambda (index method id)
|
||||
(when (eq? 'final (vector-ref meth-flags index))
|
||||
|
|
|
@ -825,13 +825,13 @@
|
|||
(test 11 'abstract (send o bar))
|
||||
(test 15 'abstract (send o baz)))
|
||||
|
||||
;; super calls to an abstract should raise an error
|
||||
;; super calls to an abstract should just be (void)
|
||||
(let ([foo% (class (class object%
|
||||
(super-new)
|
||||
(abstract m))
|
||||
(super-new)
|
||||
(define/override (m) (super m)))])
|
||||
(err/rt-test (send (new foo%) m) exn:fail:object?))
|
||||
(test (void) 'super (send (new foo%) m)))
|
||||
|
||||
;; failing to implement abstract methods
|
||||
(define bad-leaf% (class bt% (inherit-field number)))
|
||||
|
|
Loading…
Reference in New Issue
Block a user