fix object/c & fields that just have to exist
closes PR 14437
This commit is contained in:
parent
74a2b677e8
commit
a3d77986cb
|
@ -158,4 +158,32 @@
|
|||
'pos
|
||||
'neg)])
|
||||
(set-field! n pre-o #t)
|
||||
(get-field n o))))
|
||||
(get-field n o)))
|
||||
|
||||
(test/spec-passed/result
|
||||
'object/c-field-existence
|
||||
'(send (contract
|
||||
(object/c
|
||||
(field foo bar)
|
||||
(baz (->m integer? integer?)))
|
||||
(new (class object%
|
||||
(super-new)
|
||||
(field (foo 0) (bar 0))
|
||||
(define/public (baz n) n)))
|
||||
'pos 'neg)
|
||||
baz 1)
|
||||
1)
|
||||
|
||||
(test/spec-passed/result
|
||||
'object/c-field-existence2
|
||||
'(send (contract
|
||||
(object/c
|
||||
(field foo bar)
|
||||
(baz (->m integer? (listof integer?))))
|
||||
(new (class object%
|
||||
(super-new)
|
||||
(field (foo 0) (bar 1))
|
||||
(define/public (baz n) (list foo bar))))
|
||||
'pos 'neg)
|
||||
baz 1)
|
||||
'(0 1)))
|
||||
|
|
|
@ -1307,7 +1307,7 @@
|
|||
(unless (null? fields)
|
||||
(for ([f (in-list fields)]
|
||||
[c (in-list field-contracts)])
|
||||
(when c
|
||||
(unless (just-check-existence? c)
|
||||
(define fi (hash-ref field-ht f))
|
||||
(define p-pos ((contract-projection c) (blame-add-field-context blame f #:swap? #f)))
|
||||
(define p-neg ((contract-projection c) (blame-add-field-context blame f #:swap? #t)))
|
||||
|
|
Loading…
Reference in New Issue
Block a user