From 8b324b1fb5bed7bf971b947d36908703cd593ab6 Mon Sep 17 00:00:00 2001 From: Eric Dobson Date: Sat, 25 May 2013 14:24:07 -0700 Subject: [PATCH] Make resolve actually do all the necessary resolutions. original commit: 84d3051feeaca7451c8bfc7f8e0f7abad7475830 --- .../tests/typed-racket/succeed/struct-top-recursive.rkt | 6 ++++++ collects/typed-racket/types/resolve.rkt | 9 ++++++++- 2 files changed, 14 insertions(+), 1 deletion(-) create mode 100644 collects/tests/typed-racket/succeed/struct-top-recursive.rkt 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 00000000..21daa5ac --- /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 1f2bfc02..1c87e657 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)