add check for number of result values in ->i (that signals blame)

closes PR 13417
This commit is contained in:
Robby Findler 2013-01-07 09:24:31 -06:00
parent b02d8af305
commit 84c0208d99
2 changed files with 30 additions and 9 deletions

View File

@ -516,15 +516,20 @@
(cond
[(istx-ress an-istx)
(list
#`(λ #,(vector->list wrapper-ress)
#,(add-wrapper-let
(add-post-cond an-istx arg/res-to-indy-var #`(values #,@(vector->list wrapper-ress)))
#f
ordered-ress res-indices
res-proj-vars indy-res-proj-vars
wrapper-ress indy-res-vars
arg/res-to-indy-var
blame-var-table)))]
#`(case-lambda
[#,(vector->list wrapper-ress)
#,(add-wrapper-let
(add-post-cond an-istx arg/res-to-indy-var #`(values #,@(vector->list wrapper-ress)))
#f
ordered-ress res-indices
res-proj-vars indy-res-proj-vars
wrapper-ress indy-res-vars
arg/res-to-indy-var
blame-var-table)]
[args
(bad-number-of-results blame val
#,(vector-length wrapper-ress)
args)]))]
[else
null]))

View File

@ -3325,6 +3325,22 @@
x)
'(body ctc))
(test/pos-blame
'->i-bad-number-of-result-values1
'((contract (->i ((x any/c)) (result (x) any/c))
(λ (x) (values 1 2))
'pos
'neg)
1))
(test/pos-blame
'->i-bad-number-of-result-values2
'((contract (->i ((giraffe any/c)) (elephant any/c))
(λ (x) (values 1 2))
'pos
'neg)
1))
;
;
;