Added annotations to plain for and for* in typed code.
This commit is contained in:
parent
b386f01ee4
commit
d3ee52d451
|
@ -2,7 +2,7 @@
|
|||
|
||||
|
||||
|
||||
(providing (libs (except scheme/base #%module-begin #%top-interaction with-handlers lambda #%app)
|
||||
(providing (libs (except scheme/base #%module-begin #%top-interaction with-handlers lambda #%app for for*)
|
||||
(except "private/prims.rkt")
|
||||
(except "private/base-types.rkt")
|
||||
(except "private/base-types-extra.rkt"))
|
||||
|
@ -18,4 +18,4 @@
|
|||
(for-syntax "private/base-types-extra.rkt"))
|
||||
(provide (rename-out [with-handlers: with-handlers])
|
||||
(for-syntax (all-from-out "private/base-types-extra.rkt"))
|
||||
assert with-type)
|
||||
assert with-type for for*)
|
||||
|
|
|
@ -23,7 +23,9 @@ This file defines two sorts of primitives. All of them are provided into any mod
|
|||
:
|
||||
(rename-out [define-typed-struct define-struct:]
|
||||
[lambda: λ:]
|
||||
[define-typed-struct/exec define-struct/exec:]))
|
||||
[define-typed-struct/exec define-struct/exec:]
|
||||
[for/annotation for]
|
||||
[for*/annotation for*]))
|
||||
|
||||
(require "../utils/utils.rkt"
|
||||
racket/base
|
||||
|
@ -427,6 +429,18 @@ This file defines two sorts of primitives. All of them are provided into any mod
|
|||
c ...)
|
||||
ty))]))
|
||||
|
||||
;; wrap the original for with a type annotation
|
||||
(define-syntax (for/annotation stx)
|
||||
(syntax-parse stx
|
||||
[(_ x ...)
|
||||
(syntax/loc stx
|
||||
(ann (for x ...) Void))]))
|
||||
(define-syntax (for*/annotation stx)
|
||||
(syntax-parse stx
|
||||
[(_ x ...)
|
||||
(syntax/loc stx
|
||||
(ann (for* x ...) Void))]))
|
||||
|
||||
;; we need handle #:when clauses manually because we need to annotate
|
||||
;; the type of each nested for
|
||||
(define-syntax (for: stx)
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
|
||||
|
||||
(providing (libs (except racket/base #%module-begin #%top-interaction with-handlers lambda #%app define-struct)
|
||||
(providing (libs (except racket/base #%module-begin #%top-interaction with-handlers lambda #%app define-struct for for*)
|
||||
(except typed-scheme/private/prims)
|
||||
(except typed-scheme/private/base-types)
|
||||
(except typed-scheme/private/base-types-extra))
|
||||
|
@ -18,5 +18,5 @@
|
|||
(for-syntax typed-scheme/private/base-types-extra))
|
||||
(provide (rename-out [with-handlers: with-handlers]
|
||||
[define-type-alias define-type])
|
||||
assert with-type
|
||||
assert with-type for for*
|
||||
(for-syntax (all-from-out typed-scheme/private/base-types-extra)))
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
|
||||
|
||||
(providing (libs (except scheme/base #%module-begin #%top-interaction with-handlers lambda #%app define-struct)
|
||||
(providing (libs (except scheme/base #%module-begin #%top-interaction with-handlers lambda #%app define-struct for for*)
|
||||
(except typed-scheme/private/prims)
|
||||
(except typed-scheme/private/base-types)
|
||||
(except typed-scheme/private/base-types-extra))
|
||||
|
@ -18,5 +18,5 @@
|
|||
(for-syntax typed-scheme/private/base-types-extra))
|
||||
(provide (rename-out [with-handlers: with-handlers]
|
||||
[define-type-alias define-type])
|
||||
assert with-type
|
||||
assert with-type for for*
|
||||
(for-syntax (all-from-out typed-scheme/private/base-types-extra)))
|
||||
|
|
Loading…
Reference in New Issue
Block a user