fix the contract context messages for the case of ->*'s #:rest arguments
This commit is contained in:
parent
eeb3da0c23
commit
7156b0391b
|
@ -476,8 +476,11 @@ v4 todo:
|
||||||
(for/list ([dom (in-list doms-proj)]
|
(for/list ([dom (in-list doms-proj)]
|
||||||
[n (in-naturals 1)])
|
[n (in-naturals 1)])
|
||||||
(dom (blame-add-context orig-blame
|
(dom (blame-add-context orig-blame
|
||||||
|
(if (and has-rest?
|
||||||
|
(n . > . dom-length))
|
||||||
|
"the rest argument of"
|
||||||
(format "the ~a argument of"
|
(format "the ~a argument of"
|
||||||
(n->th n))
|
(n->th n)))
|
||||||
#:swap? #t))))
|
#:swap? #t))))
|
||||||
(define partial-optional-doms
|
(define partial-optional-doms
|
||||||
(for/list ([dom (in-list doms-optional-proj)]
|
(for/list ([dom (in-list doms-optional-proj)]
|
||||||
|
|
|
@ -12837,6 +12837,31 @@ so that propagation occurs.
|
||||||
0)
|
0)
|
||||||
1)))
|
1)))
|
||||||
|
|
||||||
|
(ctest '("an element of" "the rest argument of")
|
||||||
|
extract-context-lines
|
||||||
|
(λ ()
|
||||||
|
((contract (->* () #:rest (listof number?) number?)
|
||||||
|
+
|
||||||
|
'pos 'neg)
|
||||||
|
1 "a")))
|
||||||
|
|
||||||
|
(ctest '("the 2nd argument of")
|
||||||
|
extract-context-lines
|
||||||
|
(λ ()
|
||||||
|
((contract (->* (number? number?) #:rest (listof number?) number?)
|
||||||
|
+
|
||||||
|
'pos 'neg)
|
||||||
|
1 "a")))
|
||||||
|
|
||||||
|
(ctest '("an element of" "the rest argument of")
|
||||||
|
extract-context-lines
|
||||||
|
(λ ()
|
||||||
|
((contract (->* (number?) #:rest (listof number?) number?)
|
||||||
|
+
|
||||||
|
'pos 'neg)
|
||||||
|
1 "a")))
|
||||||
|
|
||||||
|
|
||||||
(let* ([blame-pos (contract-eval '(make-blame #'here #f (λ () 'integer?) 'positive 'negative #t))]
|
(let* ([blame-pos (contract-eval '(make-blame #'here #f (λ () 'integer?) 'positive 'negative #t))]
|
||||||
[blame-neg (contract-eval `(blame-swap ,blame-pos))])
|
[blame-neg (contract-eval `(blame-swap ,blame-pos))])
|
||||||
(ctest "something ~a" blame-fmt->-string ,blame-neg "something ~a")
|
(ctest "something ~a" blame-fmt->-string ,blame-neg "something ~a")
|
||||||
|
|
Loading…
Reference in New Issue
Block a user