-
-
Notifications
You must be signed in to change notification settings - Fork 104
Open
Description
On Racket 8.9 CS, this program:
#lang typed/racket
(: f (case->
(-> 'a 'b)
(-> 'x 'y)))
(define (f arg)
(if (eq? 'a arg)
'b
'y))
(: a->b (-> 'a 'b))
(define a->b f)
(: x->y (-> 'x 'y))
(define x->y f)
(: x/y->a/b (-> (U 'a 'x) (U 'b 'y)))
(define x/y->a/b f)
fails to typecheck with the error:
Type Checker: type mismatch
expected: (-> (U 'a 'x) (U 'b 'y))
given: (case-> (-> 'a 'b) (-> 'x 'y)) in: f
Adding an additional case->
clause can get the program to typecheck:
#lang typed/racket
(: f (case->
(-> 'a 'b)
(-> 'x 'y)
(-> (U 'a 'x) (U 'b 'y))))
(define (f arg)
(if (eq? 'a arg)
'b
'y))
(: a->b (-> 'a 'b))
(define a->b f)
(: x->y (-> 'x 'y))
(define x->y f)
(: x/y->a/b (-> (U 'a 'x) (U 'b 'y)))
(define x/y->a/b f)
I think (-> (U 'a 'x) (U 'b 'y))
should be recognized as a subtype of (case-> (-> 'a 'b) (-> 'x 'y))
. I don't know if the implementation issues are related, but the symptoms resemble #1321.
Metadata
Metadata
Assignees
Labels
No labels