Fix object/c contract-stronger?

This commit is contained in:
Daniel Feltey 2017-10-02 15:12:17 -05:00
parent c02d91d174
commit 3b56866fc1
2 changed files with 41 additions and 1 deletions

View File

@ -299,5 +299,39 @@
(class object% (super-new)))
'pos 'neg))
(test/spec-passed/result
'object/c-multi-wrap-just-check-existence/field
'(let ([ctc (object/c (field foo))]
[v (new (class object% (super-new) (field (foo 0))))])
(get-field
foo
(contract
ctc
(contract
ctc
(contract
ctc
v
'p 'n)
'p 'n)
'p 'n)))
0)
(test/spec-passed/result
'object/c-multi-wrap-just-check-existence/method
'(let ([ctc (object/c foo)]
[v (new (class object% (super-new) (define/public (foo) 0)))])
(send
(contract
ctc
(contract
ctc
(contract
ctc
v
'p 'n)
'p 'n)
'p 'n)
foo))
0)
)

View File

@ -1521,7 +1521,13 @@
(for/or ([that-name (in-list (names-sel that))]
[that-ctc (in-list (ctcs-sel that))])
(and (equal? this-name that-name)
(contract-stronger? this-ctc that-ctc))))))
(contract-stronger?
(if (just-check-existence? this-ctc)
any/c
this-ctc)
(if (just-check-existence? that-ctc)
any/c
that-ctc)))))))
(define-struct base-object/c (methods method-contracts fields field-contracts)
#:property prop:custom-write custom-write-property-proc