fix interaction of mixins and contracted classes
This commit is contained in:
parent
72ef0a9323
commit
788ec1d87d
|
@ -2295,6 +2295,23 @@
|
||||||
(with-method ([m (o m)])
|
(with-method ([m (o m)])
|
||||||
(m #f))))
|
(m #f))))
|
||||||
|
|
||||||
|
(test/spec-passed
|
||||||
|
'mixin1
|
||||||
|
'((mixin () () (super-new))
|
||||||
|
(contract (class/c m)
|
||||||
|
(class object% (define/public (m x) x) (super-new))
|
||||||
|
'pos
|
||||||
|
'neg)))
|
||||||
|
|
||||||
|
(test/spec-passed
|
||||||
|
'mixin2
|
||||||
|
'(send (new ((mixin () () (super-new))
|
||||||
|
(contract (class/c [m (->m integer? integer?)])
|
||||||
|
(class object% (define/public (m x) x) (super-new))
|
||||||
|
'pos
|
||||||
|
'neg)))
|
||||||
|
m 1))
|
||||||
|
|
||||||
(let ([expected-given?
|
(let ([expected-given?
|
||||||
(λ (exn) (and (regexp-match? #rx"callback: contract violation" (exn-message exn))
|
(λ (exn) (and (regexp-match? #rx"callback: contract violation" (exn-message exn))
|
||||||
(regexp-match? #rx"expected: boolean[?]" (exn-message exn))
|
(regexp-match? #rx"expected: boolean[?]" (exn-message exn))
|
||||||
|
|
|
@ -4340,7 +4340,7 @@ An example
|
||||||
|
|
||||||
(define (check-mixin-super mixin-name super% from-ids)
|
(define (check-mixin-super mixin-name super% from-ids)
|
||||||
(let ([mixin-name (or mixin-name 'mixin)])
|
(let ([mixin-name (or mixin-name 'mixin)])
|
||||||
(unless (class? super%)
|
(unless (-class? super%)
|
||||||
(obj-error mixin-name
|
(obj-error mixin-name
|
||||||
"argument is not a class"
|
"argument is not a class"
|
||||||
"argument" super%))
|
"argument" super%))
|
||||||
|
|
Loading…
Reference in New Issue
Block a user