diff --git a/pkgs/typed-racket-pkgs/typed-racket-lib/typed-racket/types/remove-intersect.rkt b/pkgs/typed-racket-pkgs/typed-racket-lib/typed-racket/types/remove-intersect.rkt index 078f544b..3f6a6b54 100644 --- a/pkgs/typed-racket-pkgs/typed-racket-lib/typed-racket/types/remove-intersect.rkt +++ b/pkgs/typed-racket-pkgs/typed-racket-lib/typed-racket/types/remove-intersect.rkt @@ -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 _ _ _) diff --git a/pkgs/typed-racket-pkgs/typed-racket-test/tests/typed-racket/succeed/pr14458.rkt b/pkgs/typed-racket-pkgs/typed-racket-test/tests/typed-racket/succeed/pr14458.rkt new file mode 100644 index 00000000..958d820b --- /dev/null +++ b/pkgs/typed-racket-pkgs/typed-racket-test/tests/typed-racket/succeed/pr14458.rkt @@ -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]))