fix the 'just check existence' part of object/c contracts

This commit is contained in:
Robby Findler 2016-04-19 14:05:01 -05:00
parent 3b1b4a0d26
commit fa4a6d4c13
2 changed files with 21 additions and 4 deletions

View File

@ -283,5 +283,21 @@
(send x3 p))) (send x3 p)))
(test/spec-passed
'object/c-just-check-existence
'(contract (object/c m)
(new
(class object%
(super-new)
(define/public (m) 42)))
'pos 'neg))
(test/pos-blame
'object/c-just-check-existence
'(contract (object/c m)
(new
(class object% (super-new)))
'pos 'neg))
) )

View File

@ -1662,10 +1662,11 @@
(for ([m (in-list methods)] (for ([m (in-list methods)]
[c (in-list method-contracts)]) [c (in-list method-contracts)])
(when c (when c
(let ([i (hash-ref method-ht m)] (unless (just-check-existence? c)
[p ((contract-late-neg-projection c) (define i (hash-ref method-ht m))
(define p ((contract-late-neg-projection c)
(blame-add-context blame (format "the ~a method in" m) (blame-add-context blame (format "the ~a method in" m)
#:important m))]) #:important m)))
(vector-set! meths i (make-method (p (vector-ref meths i) neg-party) m)))))) (vector-set! meths i (make-method (p (vector-ref meths i) neg-party) m))))))
;; Handle external field contracts ;; Handle external field contracts