fix bug introduced recently by special cases for ->
This commit is contained in:
parent
88bd4cce6c
commit
297db9b305
|
@ -2030,12 +2030,14 @@ v4 todo:
|
|||
(define-syntax (-> stx)
|
||||
(syntax-case stx (any any/c boolean?)
|
||||
[(_ any/c ... any)
|
||||
(not (syntax-parameter-value #'making-a-method))
|
||||
;; special case the (-> any/c ... any) contracts to be first-order checks only
|
||||
(with-syntax ([dom-len (- (length (syntax->list stx)) 2)]
|
||||
[name (syntax->datum stx)])
|
||||
#'(flat-named-contract 'name (λ (x) (and (procedure? x) (procedure-arity-includes? x dom-len #t)))))]
|
||||
[(_ any/c boolean?)
|
||||
;; special case (-> any/c boolean?) to use predicate/c
|
||||
(not (syntax-parameter-value #'making-a-method))
|
||||
#'-predicate/c]
|
||||
[_
|
||||
#`(syntax-parameterize ((making-a-method #f)) #,(->/proc/main stx))]))
|
||||
|
|
|
@ -6273,6 +6273,32 @@
|
|||
m
|
||||
5))
|
||||
|
||||
(test/spec-passed/result
|
||||
'object-contract/arrow-special-case1
|
||||
'(send (contract (object-contract
|
||||
[m (-> any/c boolean?)])
|
||||
(new (class object%
|
||||
(define/public (m x) #t)
|
||||
(super-new)))
|
||||
'pos
|
||||
'neg)
|
||||
m 1)
|
||||
#t)
|
||||
|
||||
(test/spec-passed/result
|
||||
'object-contract/arrow-special-case2
|
||||
'(send (contract (object-contract
|
||||
[m (-> any/c any)])
|
||||
(new (class object%
|
||||
(define/public (m x) #t)
|
||||
(super-new)))
|
||||
'pos
|
||||
'neg)
|
||||
m 1)
|
||||
#t)
|
||||
|
||||
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;;
|
||||
;; test error message has right format
|
||||
|
|
Loading…
Reference in New Issue
Block a user