Ported more code to new contract tools.

svn: r17733
This commit is contained in:
Carl Eastlund 2010-01-19 03:42:45 +00:00
parent 3921e16aa1
commit 722fae41a8
5 changed files with 23 additions and 13 deletions

View File

@ -335,8 +335,10 @@ profile todo:
;; =User= ;; =User=
(define (print-planet-icon-to-stderr exn) (define (print-planet-icon-to-stderr exn)
(when (exn:fail:contract2? exn) (when (exn:fail:contract:blame? exn)
(let ([table (parse-gp exn (guilty-party exn))]) (let ([table (parse-gp exn
(blame-guilty
(exn:fail:contract:blame-object exn)))])
(when table (when table
(let ([gp-url (bug-info->ticket-url table)]) (let ([gp-url (bug-info->ticket-url table)])
(when planet-note% (when planet-note%

View File

@ -4,6 +4,7 @@
scheme/list scheme/list
scheme/runtime-path scheme/runtime-path
scheme/contract scheme/contract
unstable/location
setup/getinfo setup/getinfo
mred mred
framework framework
@ -326,7 +327,8 @@
name name
'drscheme 'drscheme
tool-name tool-name
(quote-syntax name))])) (quote name)
(quote-srcloc name))]))
name name
ctc) ctc)
body)] body)]

View File

@ -33,7 +33,7 @@
(let ([proj-x (contract-projection rngs-x)] ...) (let ([proj-x (contract-projection rngs-x)] ...)
(simple-contract (simple-contract
#:name #:name
(build-compound-type-name 'unconstrained-domain-> ((name-get rngs-x) rngs-x) ...) (build-compound-type-name 'unconstrained-domain-> (contract-name rngs-x) ...)
#:projection #:projection
(λ (blame) (λ (blame)
(let ([p-app-x (proj-x blame)] ...) (let ([p-app-x (proj-x blame)] ...)

View File

@ -2,9 +2,11 @@
(provide define/contract) (provide define/contract)
(require (for-syntax scheme/base) (require (for-syntax scheme/base
unstable/srcloc
(prefix-in a: scheme/contract/private/helpers))
(only-in scheme/contract contract) (only-in scheme/contract contract)
(for-syntax (prefix-in a: scheme/contract/private/helpers))) unstable/location)
;; First, we have the old define/contract implementation, which ;; First, we have the old define/contract implementation, which
;; is still used in mzlib/contract. ;; is still used in mzlib/contract.
@ -12,7 +14,7 @@
(define-for-syntax (make-define/contract-transformer contract-id id) (define-for-syntax (make-define/contract-transformer contract-id id)
(make-set!-transformer (make-set!-transformer
(λ (stx) (λ (stx)
(with-syntax ([neg-blame-str (a:build-src-loc-string stx)] (with-syntax ([neg-blame-str (source-location->string stx)]
[contract-id contract-id] [contract-id contract-id]
[id id]) [id id])
(syntax-case stx (set!) (syntax-case stx (set!)
@ -27,7 +29,8 @@
id id
(syntax->datum (quote-syntax f)) (syntax->datum (quote-syntax f))
neg-blame-str neg-blame-str
(quote-syntax f)) (quote f)
(quote-srcloc f))
arg arg
...))] ...))]
[ident [ident
@ -37,7 +40,8 @@
id id
(syntax->datum (quote-syntax ident)) (syntax->datum (quote-syntax ident))
neg-blame-str neg-blame-str
(quote-syntax ident)))]))))) (quote ident)
(quote-srcloc ident)))])))))
;; (define/contract id contract expr) ;; (define/contract id contract expr)
;; defines `id' with `contract'; initially binding ;; defines `id' with `contract'; initially binding

View File

@ -5,7 +5,8 @@
syntax/stx syntax/stx
syntax/kerncase syntax/kerncase
scheme/struct-info scheme/struct-info
scheme/contract/private/helpers unstable/srcloc
unstable/location
(for-syntax scheme/base (for-syntax scheme/base
syntax/kerncase syntax/kerncase
"rep.ss" "rep.ss"
@ -110,9 +111,10 @@
(pattern x:expr (pattern x:expr
#:with c #`(contract #,ctc #:with c #`(contract #,ctc
x x
(quote #,(string->symbol (or (build-src-loc-string #'x) ""))) (quote #,(source-location->string #'x))
(quote #,(or '<this-macro>)) '<this-macro>
(quote-syntax #,(syntax/loc #'x (<there>)))))) #f
(quote-srcloc x))))
;; Literal sets ;; Literal sets