From f2d724cf82d243efa337853086aa2b6e5854792f Mon Sep 17 00:00:00 2001 From: Sam Tobin-Hochstadt Date: Sat, 21 Feb 2009 15:23:42 +0000 Subject: [PATCH] Type rep compiles svn: r13768 original commit: 70e174c0e1fbe917d117e36dd9b7b894497fd115 --- collects/typed-scheme/rep/rep-utils.ss | 3 +- collects/typed-scheme/rep/type-rep.ss | 46 +++++++++++++------------- 2 files changed, 25 insertions(+), 24 deletions(-) diff --git a/collects/typed-scheme/rep/rep-utils.ss b/collects/typed-scheme/rep/rep-utils.ss index ea867648..ebad2a33 100644 --- a/collects/typed-scheme/rep/rep-utils.ss +++ b/collects/typed-scheme/rep/rep-utils.ss @@ -108,6 +108,7 @@ [() (mk #'#f)] [(f) (mk #'f)] [_ (mk #'(list . flds.fs))]))] + [(ign-pats ...) (if key? #'(_ _) #'(_))] [frees-def (if #'frees #'frees.def #'(begin))] [frees (with-syntax ([(f1 f2) (if #'frees @@ -132,7 +133,7 @@ (lambda (s) (syntax-parse s [(_ . fs) - #:with pat (syntax/loc s (_ _ . fs)) + #:with pat (syntax/loc s (ign-pats ... . fs)) (syntax/loc s (struct nm pat))]))) (begin-for-syntax (hash-set! ht-stx 'kw-stx (list #'ex #'flds.fs bfs-fold-rhs #'#,stx))) diff --git a/collects/typed-scheme/rep/type-rep.ss b/collects/typed-scheme/rep/type-rep.ss index b837cd14..e6cdd5c5 100644 --- a/collects/typed-scheme/rep/type-rep.ss +++ b/collects/typed-scheme/rep/type-rep.ss @@ -320,21 +320,26 @@ (car l) (*Values l))) +(define ((sub-lf st) e) + (latentfilter-case (#:Type st + #:LatentFilter (sub-lf st)) + e)) -#| ;; abstract-many : Names Type -> Scope^n ;; where n is the length of names (define (abstract-many names ty) (define (nameTo name count type) (let loop ([outer 0] [ty type]) (define (sb t) (loop outer t)) + (define slf (sub-lf sb)) (type-case - sb ty + (#:Type sb #:LatentFilter (sub-lf sb)) + ty [#:F name* (if (eq? name name*) (*B (+ count outer)) ty)] ;; necessary to avoid infinite loops [#:Union elems (*Union (remove-dups (sort (map sb elems) type