Improve TR's overlap checking for StructTop types

Closes PR 14458

original commit: eb006a0e9ec78d0d0657fbf8587ba8b5106419aa
This commit is contained in:
Asumu Takikawa 2014-04-30 13:56:34 -04:00
parent fe6cdbc35b
commit 63e2fa1bda
2 changed files with 14 additions and 2 deletions

View File

@ -79,8 +79,8 @@
(Value: (? simple-datum? v2)))
(equal? v1 v2)]
[(or (list (Value: (? simple-datum?))
(Struct: n _ flds _ _ _))
(list (Struct: n _ flds _ _ _)
(or (? Struct?) (? StructTop?)))
(list (or (? Struct?) (? StructTop?))
(Value: (? simple-datum?))))
#f]
[(list (Struct: n _ flds _ _ _)

View File

@ -0,0 +1,12 @@
#lang typed/racket
;; Test for PR 14458. Make sure that overlap checking on
;; invariant struct types works against simple data types.
(struct: (X) S ([z : (Vectorof X)]))
(define-type (T X) (U 'Leaf (S X)))
(: f ( (X) (T X) Any))
(define (f s)
(match s
[(S _) 42]))