Fix unannotated defines with bad number of values
This commit is contained in:
parent
d495f74648
commit
efd482c30f
|
@ -218,7 +218,8 @@
|
|||
(cond [(null? clauses) (k)]
|
||||
[else
|
||||
(match-define (lr-clause names expr) (car clauses))
|
||||
(match-define (list (tc-result: ts fs os) ...)
|
||||
(match-define (or (tc-results: (list ts ...) _ (list os ...))
|
||||
(list (tc-result: ts _ os) ...))
|
||||
(get-type/infer names expr
|
||||
(lambda (e) (tc-expr/maybe-expected/t e names))
|
||||
tc-expr/check))
|
||||
|
|
|
@ -174,7 +174,8 @@
|
|||
;; the module (hence we haven't synthesized a type for yet).
|
||||
[_
|
||||
(match (get-type/infer vars #'expr tc-expr tc-expr/check)
|
||||
[(list (tc-result: ts) ...)
|
||||
[(or (list (tc-result: ts) ...)
|
||||
(tc-results: (list ts ...)))
|
||||
(for/list ([i (in-list vars)] [t (in-list ts)])
|
||||
(register-type i t)
|
||||
(free-id-table-set! unann-defs i #t)
|
||||
|
|
|
@ -114,6 +114,11 @@
|
|||
(test-form-exn #rx"either undefined or missing a type annotation"
|
||||
(a-name-that-isnt-bound))
|
||||
|
||||
;; Make sure unannotated definitions with the wrong number of values
|
||||
;; don't produce an internal error
|
||||
(test-form-exn #rx"Expression should produce 1 values"
|
||||
(define zzzzz (values 1 2)))
|
||||
|
||||
(test-form #rx"1"
|
||||
(:type 1))
|
||||
(test-form (regexp-quote "(U Positive-Byte Zero)")
|
||||
|
|
|
@ -3275,6 +3275,11 @@
|
|||
(tr:define (foo) : (Values String String) (values "foo" "bar"))
|
||||
(void))
|
||||
-Void]
|
||||
|
||||
;; Make sure unannotated definitions with the wrong number of values
|
||||
;; don't produce an internal error
|
||||
[tc-err (let () (define x (values 1 2)) (error "dummy"))
|
||||
#:msg #rx"Expression should produce 1 values"]
|
||||
)
|
||||
|
||||
(test-suite
|
||||
|
|
Loading…
Reference in New Issue
Block a user