:query-result-type -> :query-type/result

Result type is given, not asked for.
This commit is contained in:
Vincent St-Amour 2012-08-07 15:38:00 -04:00
parent 28c85dfd25
commit d87339d414
3 changed files with 5 additions and 5 deletions

View File

@ -200,8 +200,8 @@ This file defines two sorts of primitives. All of them are provided into any mod
(error ":type is only valid at the top-level of an interaction")) (error ":type is only valid at the top-level of an interaction"))
(define-syntax (:print-type stx) (define-syntax (:print-type stx)
(error ":print-type is only valid at the top-level of an interaction")) (error ":print-type is only valid at the top-level of an interaction"))
(define-syntax (:query-result-type stx) (define-syntax (:query-type/result stx)
(error ":query-result-type is only valid at the top-level of an interaction")) (error ":query-type/result is only valid at the top-level of an interaction"))
(define-syntax (require/opaque-type stx) (define-syntax (require/opaque-type stx)
(define-syntax-class name-exists-kw (define-syntax-class name-exists-kw

View File

@ -10,7 +10,7 @@
(typecheck provide-handling tc-toplevel tc-app-helper) (typecheck provide-handling tc-toplevel tc-app-helper)
(rep type-rep) (rep type-rep)
(env env-req) (env env-req)
(for-template (only-in (base-env prims) :type :print-type :query-result-type)) (for-template (only-in (base-env prims) :type :print-type :query-type/result))
(utils utils tc-utils arm) (utils utils tc-utils arm)
"tc-setup.rkt" "utils/debug.rkt") "tc-setup.rkt" "utils/debug.rkt")
@ -62,7 +62,7 @@
[(tc-result1: t f o) t] [(tc-result1: t f o) t]
[(tc-results: t) (cons 'Values t)])))))] [(tc-results: t) (cons 'Values t)])))))]
;; given a function and a desired return type, fill in the blanks ;; given a function and a desired return type, fill in the blanks
[(_ . ((~literal :query-result-type) op:expr desired-type:expr)) [(_ . ((~literal :query-type/result) op:expr desired-type:expr))
(let ([expected (parse-type #'desired-type)]) (let ([expected (parse-type #'desired-type)])
(tc-setup #'stx #'op 'top-level expanded init tc-toplevel-form before type (tc-setup #'stx #'op 'top-level expanded init tc-toplevel-form before type
(match type (match type

View File

@ -14,6 +14,6 @@ The following bindings are only available at the Typed Racket REPL.
@defform[(:print-type e)]{Prints the type of @racket[_e]. This prints the whole @defform[(:print-type e)]{Prints the type of @racket[_e]. This prints the whole
type, which can sometimes be quite large.} type, which can sometimes be quite large.}
@defform[(:query-result-type f t)]{Given a function @racket[f] and a desired @defform[(:query-type/result f t)]{Given a function @racket[f] and a desired
return type @racket[t], shows the arguments types @racket[f] should be given to return type @racket[t], shows the arguments types @racket[f] should be given to
return a value of type @racket[t].} return a value of type @racket[t].}