Ensure that structs don't overlap with simple values.

Reported by Ray Racine.

Please merge to release.

original commit: 4a90c6c1fea75fac3132de7df70e5e7e8207b311
This commit is contained in:
Sam Tobin-Hochstadt 2012-07-20 12:51:54 -04:00
parent 2f6213c56f
commit 460b1fe7b3
2 changed files with 13 additions and 2 deletions

View 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)]))

View File

@ -66,8 +66,10 @@
[(or (list (Pair: _ _) _)
(list _ (Pair: _ _)))
#f]
[(or (list (Value: '()) (Struct: n _ flds _ _ _ _ _))
(list (Struct: n _ flds _ _ _ _ _) (Value: '())))
[(or (list (Value: (? (λ (e) (or (null? e) (symbol? e) (number? e) (boolean? e) (pair? e) (keyword? e)))))
(Struct: n _ flds _ _ _ _ _))
(list (Struct: n _ flds _ _ _ _ _)
(Value: (? (λ (e) (or (null? e) (symbol? e) (number? e) (boolean? e) (pair? e) (keyword? e)))))))
#f]
[(list (Struct: n _ flds _ _ _ _ _)
(Struct: n* _ flds* _ _ _ _ _)) (=> nevermind)