diff --git a/collects/typed-scheme/private/parse-type.ss b/collects/typed-scheme/private/parse-type.ss index c3d7fbbf..f7418729 100644 --- a/collects/typed-scheme/private/parse-type.ss +++ b/collects/typed-scheme/private/parse-type.ss @@ -62,7 +62,6 @@ t:Vectorof t:mu t:Rec t:U t:All t:Opaque t:Parameter quote) [t #:declare t (3d Type?) - (printf "3d type ~a~n" #'t.datum) (attribute t.datum)] [(fst . rst) #:fail-unless (not (syntax->list #'rst)) #f diff --git a/collects/typed-scheme/rep/rep-utils.ss b/collects/typed-scheme/rep/rep-utils.ss index 95ac46a9..c56bf5b0 100644 --- a/collects/typed-scheme/rep/rep-utils.ss +++ b/collects/typed-scheme/rep/rep-utils.ss @@ -172,15 +172,15 @@ (define-syntax-class clause (pattern (k:keyword #:matcher mtch pats ... e:expr) - #:with kw (attribute k.datum) - #:with val (list #'mtch + #:attr kw (attribute k.datum) + #:attr val (list #'mtch (syntax/loc this-syntax (pats ...)) (lambda () #'e) this-syntax)) (pattern (k:keyword pats ... e:expr) - #:with kw (syntax-e #'k) - #:with val (list (mk-matcher #'kw) + #:attr kw (syntax-e #'k) + #:attr val (list (mk-matcher (attribute kw)) (syntax/loc this-syntax (pats ...)) (lambda () #'e) this-syntax))) @@ -193,13 +193,13 @@ #:attributes (datum) (pattern k:keyword #:fail-unless (memq (attribute k.datum) kws) #f - #:with datum (attribute k.datum))) + #:attr datum (attribute k.datum))) (define-syntax-class (sized-list kws) #:description (format "keyword expr pairs matching with keywords in the list ~a" kws) (pattern ((~or (~seq k e:expr)) ...) #:declare k (keyword-in kws) #:fail-unless (equal? (length (attribute k.datum)) (length (remove-duplicates (attribute k.datum)))) #f - #:with mapping (for/hash ([k* (attribute k.datum)] + #:attr mapping (for/hash ([k* (attribute k.datum)] [e* (attribute e)]) (values k* e*)) )) @@ -229,21 +229,21 @@ #:attributes (i lower-s first-letter key? (fld-names 1)) #:transparent (pattern i:id - #:with lower-s (string-downcase (symbol->string (attribute i.datum))) + #:attr lower-s (string-downcase (symbol->string (attribute i.datum))) #:with (fld-names ...) default-flds #:with key? #'#f - #:with first-letter (string-ref #'lower-s 0)) + #:attr first-letter (string-ref (attribute lower-s) 0)) (pattern [i:id #:d d-name:id] #:with (fld-names ...) default-flds - #:with lower-s (string-downcase (symbol->string (attribute i.datum))) + #:attr lower-s (string-downcase (symbol->string (attribute i.datum))) #:with key? #'#f - #:with first-letter (symbol->string (attribute d-name.datum))) + #:attr first-letter (symbol->string (attribute d-name.datum))) (pattern [i:id #:key] #:with (fld-names ...) (datum->syntax #f (append (syntax->list default-flds) (syntax->list #'(key)))) - #:with lower-s (string-downcase (symbol->string (attribute i.datum))) + #:attr lower-s (string-downcase (symbol->string (attribute i.datum))) #:with key? #'#t - #:with first-letter (string-ref #'lower-s 0))) + #:attr first-letter (string-ref (attribute lower-s) 0))) (define-syntax-class type-name #:transparent #:auto-nested-attributes diff --git a/collects/typed-scheme/typecheck/tc-expr-unit.ss b/collects/typed-scheme/typecheck/tc-expr-unit.ss index 77710237..52c32ba8 100644 --- a/collects/typed-scheme/typecheck/tc-expr-unit.ss +++ b/collects/typed-scheme/typecheck/tc-expr-unit.ss @@ -26,8 +26,8 @@ (define-syntax-class exp (pattern i #:fail-unless expected #f - #:with datum (syntax-e #'i) - #:fail-unless (subtype (-val #'datum) expected) #f)) + #:attr datum (syntax-e #'i) + #:fail-unless (subtype (-val (attribute datum)) expected) #f)) (syntax-parse v-stx [i:exp expected] [i:boolean (-val (syntax-e #'i))] diff --git a/collects/typed-scheme/utils/stxclass-util.ss b/collects/typed-scheme/utils/stxclass-util.ss index 893851d7..430efe36 100644 --- a/collects/typed-scheme/utils/stxclass-util.ss +++ b/collects/typed-scheme/utils/stxclass-util.ss @@ -24,14 +24,14 @@ (define-syntax-class (3d pred) (pattern s - #:with datum (syntax-e #'s) - #:fail-unless (pred #'datum) #f)) + #:attr datum (syntax-e #'s) + #:fail-unless (pred (attribute datum)) #f)) (define-syntax-rule (define-pred-stxclass name pred) (define-syntax-class name #:attributes (datum) (pattern x #:fail-unless (pred (syntax-e #'x)) #f - #:with datum (syntax-e #'x)))) + #:attr datum (syntax-e #'x)))) (define-pred-stxclass atom atom?) (define-pred-stxclass byte-pregexp byte-pregexp?) diff --git a/collects/typed-scheme/utils/utils.ss b/collects/typed-scheme/utils/utils.ss index 276f6d33..40564564 100644 --- a/collects/typed-scheme/utils/utils.ss +++ b/collects/typed-scheme/utils/utils.ss @@ -233,7 +233,8 @@ at least theoretically. (cond [(string? v) v] [(symbol? v) (symbol->string v)] [(char? v) (string v)] - [(identifier? v) (symbol->string (syntax-e v))])) + [(identifier? v) (symbol->string (syntax-e v))] + [else (error "not coerceable:" v)])) (datum->syntax kw (string->symbol (apply string-append (map f args)))))