Put Instance types in the seen list for subtyping

Since we resolve under Instance types for subtyping we
need to put them in the current-seen list too. Fixes
an infinite loop bug in subtyping.
This commit is contained in:
Asumu Takikawa 2014-11-20 20:39:37 -05:00
parent 9b4e3befa3
commit 826a08d80c
2 changed files with 18 additions and 1 deletions

View File

@ -17,6 +17,7 @@
(define (remember s t A) (define (remember s t A)
(if (or (Mu? s) (Mu? t) (if (or (Mu? s) (Mu? t)
(Name? s) (Name? t) (Name? s) (Name? t)
(Instance? s) (Instance? t)
(Struct? s) (Struct? t) (Struct? s) (Struct? t)
(App? s) (App? t)) (App? s) (App? t))
(cons (seen-before s t) A) (cons (seen-before s t) A)

View File

@ -1651,4 +1651,20 @@
(: d% D) (: d% D)
(define d% (class object% (super-new) (define/public (m) (void)))) (define d% (class object% (super-new) (define/public (m) (void))))
(send (new d%) m)) (send (new d%) m))
Univ])) Univ]
;; Test for an infinite loop bug during subtyping for classes
[tc-e (let ()
(define-type-alias A% (Class [get-this (-> (Instance A%))]))
(define-type-alias B% (Class [get-this (-> (Instance B%))]))
(: a% A%)
(define a%
(class object%
(super-new)
(define/public (get-this) this)))
(: b% B%)
(define b%
(class a%
(super-new)
(define/override (get-this) this)))
(void))
-Void]))