Clean up some contract errors and type->contract. Closes PR11756.
original commit: bf72db0f7b5120f9de8aa3c4a912de935256f605
This commit is contained in:
parent
aa247c5d10
commit
2393ae1033
10
collects/tests/typed-scheme/succeed/pr11756.rkt
Normal file
10
collects/tests/typed-scheme/succeed/pr11756.rkt
Normal file
|
@ -0,0 +1,10 @@
|
|||
#lang typed/racket/base
|
||||
|
||||
(: test : (All (X) X -> (All (Y) Y -> X)))
|
||||
(define (test n)
|
||||
(: helper : (All (Z) Z -> X))
|
||||
(define (helper m) n)
|
||||
helper)
|
||||
|
||||
; if the below is commented out the code runs without errors
|
||||
(provide test)
|
|
@ -204,7 +204,7 @@
|
|||
[(Poly: vs b)
|
||||
(if from-typed?
|
||||
;; in positive position, no checking needed for the variables
|
||||
(parameterize ([vars (append (for/list ([v vs]) (list v #'any/c)))])
|
||||
(parameterize ([vars (append (for/list ([v vs]) (list v #'any/c)) (vars))])
|
||||
(t->c b))
|
||||
;; in negative position, use `parameteric/c'
|
||||
(match-let ([(Poly-names: vs-nm _) ty])
|
||||
|
|
|
@ -33,23 +33,25 @@
|
|||
;; if this needs to be checked
|
||||
#:when (syntax-property form 'typechecker:with-type)
|
||||
;; the form should be already ascribed the relevant type
|
||||
(tc-expr form)]
|
||||
(tc-expr form)]
|
||||
[stx
|
||||
;; this is a handler function
|
||||
#:when (syntax-property form 'typechecker:exn-handler)
|
||||
(let ([t (tc-expr form)])
|
||||
(match t
|
||||
[(tc-result1:
|
||||
(and t
|
||||
(Function: (list (arr: (list _) _ _ _ (list (Keyword: _ _ #f) ...)) ...))))
|
||||
(set! handler-tys (cons (get-result-ty t) handler-tys))]
|
||||
[(tc-results: t)
|
||||
(tc-error "Exception handler must be a single-argument function, got \n~a" t)]))]
|
||||
[(tc-result1:
|
||||
(and t
|
||||
(Function: (list (arr: (list _) _ _ _ (list (Keyword: _ _ #f) ...)) ...))))
|
||||
(set! handler-tys (cons (get-result-ty t) handler-tys))]
|
||||
[(tc-results: t)
|
||||
(tc-error "Exception handler must be a single-argument function, got \n~a" t)]))]
|
||||
[stx
|
||||
;; this is the body of the with-handlers
|
||||
#:when (syntax-property form 'typechecker:exn-body)
|
||||
(match-let ([(tc-results: ts) (tc-expr form)])
|
||||
(set! body-ty (-values ts)))]
|
||||
(match (tc-expr form)
|
||||
[(tc-result1: t) (set! body-ty t)]
|
||||
[(tc-results: ts) (tc-expr form)
|
||||
(tc-error "Exception handler body must return a single value, got \n~a" (length ts))])]
|
||||
[(a . b)
|
||||
(loop #'a)
|
||||
(loop #'b)]
|
||||
|
|
Loading…
Reference in New Issue
Block a user