fix: allow missing fields in object/c-common-fields-stronger?

Change `object/c-common-fields-stronger?` to only compare the fields
common to both objects.
This commit is contained in:
Ben Greenman 2018-05-11 10:36:58 -04:00
parent 8ec3edaa95
commit a539825dc9
2 changed files with 14 additions and 10 deletions

View File

@ -453,6 +453,9 @@
(ctest #t contract-stronger?
(object/c (field (f (<=/c 4))))
(object/c (field (f (<=/c 4)))))
(ctest #t contract-stronger?
(object/c (field (f (<=/c 4))))
(object/c))
(ctest #t contract-stronger?
(object/c (m (-> any/c (<=/c 3)))
(n (-> any/c any/c)))

View File

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