Ensure that structs don't overlap with simple values.
Reported by Ray Racine.
Please merge to release.
(cherry picked from commit 4a90c6c1fe
)
This commit is contained in:
parent
298dd3e62c
commit
1832c2b712
9
collects/tests/typed-racket/succeed/poly-struct-pred.rkt
Normal file
9
collects/tests/typed-racket/succeed/poly-struct-pred.rkt
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
#lang typed/racket
|
||||||
|
|
||||||
|
(struct: (X) s ([v : X]))
|
||||||
|
|
||||||
|
(: f : (All (X) (U 'foo (s X)) -> (s X)))
|
||||||
|
(define (f t)
|
||||||
|
(match t
|
||||||
|
[(s value) (s value)]
|
||||||
|
[_ (error 'fail)]))
|
|
@ -66,8 +66,10 @@
|
||||||
[(or (list (Pair: _ _) _)
|
[(or (list (Pair: _ _) _)
|
||||||
(list _ (Pair: _ _)))
|
(list _ (Pair: _ _)))
|
||||||
#f]
|
#f]
|
||||||
[(or (list (Value: '()) (Struct: n _ flds _ _ _ _ _))
|
[(or (list (Value: (? (λ (e) (or (null? e) (symbol? e) (number? e) (boolean? e) (pair? e) (keyword? e)))))
|
||||||
(list (Struct: n _ flds _ _ _ _ _) (Value: '())))
|
(Struct: n _ flds _ _ _ _ _))
|
||||||
|
(list (Struct: n _ flds _ _ _ _ _)
|
||||||
|
(Value: (? (λ (e) (or (null? e) (symbol? e) (number? e) (boolean? e) (pair? e) (keyword? e)))))))
|
||||||
#f]
|
#f]
|
||||||
[(list (Struct: n _ flds _ _ _ _ _)
|
[(list (Struct: n _ flds _ _ _ _ _)
|
||||||
(Struct: n* _ flds* _ _ _ _ _)) (=> nevermind)
|
(Struct: n* _ flds* _ _ _ _ _)) (=> nevermind)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user