Fixed subtyping for StructTop. Closes PR11099.

This commit is contained in:
Eric Dobson 2011-09-05 16:58:47 -07:00 committed by Sam Tobin-Hochstadt
parent 32becc2e0a
commit c62f09ac5b
3 changed files with 14 additions and 2 deletions

View File

@ -0,0 +1,11 @@
#lang typed/racket
(struct: (X) b ([bar : (Vectorof X)]))
(define: b-val : (b Integer)
(b (ann (vector 1) (Vectorof Integer))))
(if (b? b-val)
(b-bar b-val)
#f)

View File

@ -196,7 +196,7 @@
[(Name: stx) (fp "~a" (syntax-e stx))] [(Name: stx) (fp "~a" (syntax-e stx))]
[(app has-name? (? values name)) [(app has-name? (? values name))
(fp "~a" name)] (fp "~a" name)]
[(StructTop: st) (fp "~a" st)] [(StructTop: st) (fp "(struct-top: ~a)" st)]
[(BoxTop:) (fp "Box")] [(BoxTop:) (fp "Box")]
[(ChannelTop:) (fp "Channel")] [(ChannelTop:) (fp "Channel")]
[(ThreadCellTop:) (fp "ThreadCell")] [(ThreadCellTop:) (fp "ThreadCell")]

View File

@ -383,7 +383,8 @@
[proc* (fail! proc proc*)] [proc* (fail! proc proc*)]
[else A0])]) [else A0])])
(subtype/flds* A flds flds*))] (subtype/flds* A flds flds*))]
[((Struct: _ _ _ _ _ _ _ _) (StructTop: (== s type-equal?))) [((Struct: nm _ _ _ _ _ _ _) (StructTop: (Struct: nm* _ _ _ _ _ _ _))) (=> nevermind)
(unless (free-identifier=? nm nm*) (nevermind))
A0] A0]
;ephemerons are covariant ;ephemerons are covariant
[((Ephemeron: s) (Ephemeron: t)) [((Ephemeron: s) (Ephemeron: t))