fix stream/c using generics chaperone property support

This commit is contained in:
Matthew Flatt 2015-02-19 09:43:33 -07:00
parent d69af6af30
commit aae35ea3ac
2 changed files with 9 additions and 7 deletions

View File

@ -962,7 +962,9 @@ lists are checked immediately, as if @racket[c] had been used with
If a contract is applied to a stream, and that stream is subsequently used as
the tail of another stream (as the second parameter to @racket[stream-cons]),
the new elements will not be checked with the contract, but the tail's elements
will still be enforced.}
will still be enforced.
@history[#:added "6.1.1.8"]}
@close-eval[sequence-evaluator]

View File

@ -191,8 +191,7 @@
(define (impersonate-stream s first-proc rest-proc . props)
(impersonate-generics
gen:stream
; the struct-info param is a hack, see PR 14970
(apply impersonate-struct s struct-info (λ (a b) (values a b)) props)
s
[stream-first
(λ (stream-first)
(impersonate-procedure stream-first
@ -200,13 +199,13 @@
[stream-rest
(λ (stream-rest)
(impersonate-procedure stream-rest
(λ (s) (values (λ (v) (rest-proc v)) s))))]))
(λ (s) (values (λ (v) (rest-proc v)) s))))]
#:properties props))
(define (chaperone-stream s first-proc rest-proc . props)
(chaperone-generics
gen:stream
; the struct-info param is a hack, see PR 14970
(apply chaperone-struct s struct-info (λ (a b) (values a b)) props)
s
[stream-first
(λ (stream-first)
(chaperone-procedure stream-first
@ -214,7 +213,8 @@
[stream-rest
(λ (stream-rest)
(chaperone-procedure stream-rest
(λ (s) (values (λ (v) (rest-proc v)) s))))]))
(λ (s) (values (λ (v) (rest-proc v)) s))))]
#:properties props))
;; Stream contracts ----------------------------------------------------------------------------------