Make inst fail on results that are not single valued.

original commit: 62ff915a56694203bd22b91d7eb69dfeba5bbc51
This commit is contained in:
Eric Dobson 2014-05-13 22:58:44 -07:00
parent d9c7180a00
commit a42b7a0792
2 changed files with 14 additions and 10 deletions

View File

@ -42,23 +42,18 @@
(define (do-inst tc-res inst)
(define inst-type
(if (row-syntax? inst) do-row-inst do-normal-inst))
(define (error-case tys)
(define (error-case number)
(tc-error/expr
"Cannot instantiate expression that produces ~a values"
(if (null? tys) 0 "multiple")))
number))
(match tc-res
[(tc-results: tys fs os)
(match tys
[(list ty)
(ret (list (inst-type ty inst)) fs os)]
[_
(error-case tys)])]
[(tc-results: tys fs os dty dbound)
(match tys
[(list ty)
(ret (list (inst-type ty inst)) fs os dty dbound)]
[_
(error-case tys)])]))
[_ (error-case (if (null? tys) 0 "multiple"))])]
[_ (error-case "multiple")]))
;; row-syntax? Syntax -> Boolean
;; This checks if the syntax object resulted from a row instantiation

View File

@ -2969,6 +2969,15 @@
(ret (-polydots (a ...)
(->... (list) (a a) (-values (list
(t:-> Univ (-values-dots (list) (t:-> Univ -Boolean : (-FS (-filter -Symbol (list 1 0)) -top)) 'a)))))))]
[tc-err
(inst (eval '3) Any)
#:ret (ret -Bottom)]
[tc-err
(lambda xs (inst (apply values (plambda: (b) ([x : b]) x) xs) Symbol))
#:ret (ret (-polydots (a ...) (->... (list) (a a) (-values-dots (list (t:-> -Symbol -Symbol)) a 'a))))
#:expected (ret (-polydots (a ...) (->... (list) (a a) (-values-dots (list (t:-> -Symbol -Symbol)) a 'a))))]
)
(test-suite
"tc-literal tests"