Fix TR treatment of parent row in class types

This bug manifested in having extraneous class
members in a type for a class whose superclass
expression was a mixin application.

original commit: c1a27951a38733419702b6647b97f1547ed24ae3
This commit is contained in:
Asumu Takikawa 2014-10-20 18:13:12 -04:00
parent eb79b59d1e
commit 38ceb044cd
2 changed files with 19 additions and 1 deletions

View File

@ -1348,7 +1348,12 @@
(cond [(not init-rest-name) super-init-rest]
[(dict-ref annotation-table init-rest-name #f)]
[else (-lst Univ)]))
(make-Instance (make-Class super-row init-types field-types
(make-Instance (make-Class ;; only inherit parent row if it's a variable
;; FIXME: fix this when substitution with rows
;; is made more sensible
(and (or (F? super-row) (B? super-row))
super-row)
init-types field-types
public-types augment-types init-rest-type)))
;; function->method : Function Type -> Function

View File

@ -1035,6 +1035,19 @@
#:row (make-Row null `([x ,-Integer]) null null #f)
#:field ([x -Integer])))
-true-filter)]
;; test bad manipulation of rows for inheritance
[tc-e (let ()
(: c% (Class (init [x String] [y String])))
(define c% (class object% (super-new) (init x y)))
(: f (All (r #:row) (-> (Class #:row-var r) (Class #:row-var r))))
(define (f x) x)
;; should have the same type as c%
(define c2% (f c%))
(: d% (Class (init [y String])))
;; should be the same as inheriting from c%
(define d% (class c2% (super-new [x "foo"])))
(void))
-Void]
;; Check simple use of pubment
[tc-e (let ()
(define c%