diff --git a/collects/tests/typed-racket/succeed/struct-top-recursive.rkt b/collects/tests/typed-racket/succeed/struct-top-recursive.rkt new file mode 100644 index 0000000000..21daa5acb9 --- /dev/null +++ b/collects/tests/typed-racket/succeed/struct-top-recursive.rkt @@ -0,0 +1,6 @@ +#lang typed/racket/base + +(struct: (v) a ((x : v)) #:mutable) + +(: z (Struct (Rec b (a (U #f b))))) +(define z (a #f)) diff --git a/collects/typed-racket/types/resolve.rkt b/collects/typed-racket/types/resolve.rkt index 1f2bfc0209..1c87e6571e 100644 --- a/collects/typed-racket/types/resolve.rkt +++ b/collects/typed-racket/types/resolve.rkt @@ -86,7 +86,14 @@ (hash-set! resolver-cache seq r*)) r*))) + +;; Repeatedly unfolds Mu, App, and Name constructors until the top type +;; constructor is not one of them. +;; Type/c? -> Type/c? (define (resolve t) - (if (needs-resolving? t) (resolve-once t) t)) + (let loop ((t t)) + (if (needs-resolving? t) + (loop (resolve-once t)) + t))) ;(trace resolve-app)