Fix stream contracts to work with impersonator contracts

This commit is contained in:
Alexis King 2018-11-02 11:24:39 -05:00
parent 62a674fa80
commit 93def1f753
3 changed files with 11 additions and 6 deletions

View File

@ -1266,10 +1266,9 @@ If the @racket[c] argument is a flat contract or a chaperone contract, then the
result will be a chaperone contract. Otherwise, the result will be an
impersonator contract.
When an @racket[stream/c] contract is applied to an asynchronous channel,
the result is not @racket[eq?] to the input. The result will be either a
@tech{chaperone} or @tech{impersonator} of the input depending on the type of
contract.
When an @racket[stream/c] contract is applied to a stream, the result is not
@racket[eq?] to the input. The result will be either a @tech{chaperone} or
@tech{impersonator} of the input depending on the type of contract.
Contracts on streams are evaluated lazily by necessity (since streams may be
infinite). Contract violations will not be raised until the value in violation

View File

@ -41,4 +41,8 @@
(test/pos-blame
'stream/c9
'(stream-first (stream-rest (contract (stream/c (and/c integer? (first-or/c 0 positive?)))
(stream 0 -1) 'pos 'neg)))))
(stream 0 -1) 'pos 'neg))))
(test/spec-passed
'stream/impersonator-ctc
'(contract (stream/c (make-contract #:first-order (lambda (x) #t))) empty-stream 'pos 'neg)))

View File

@ -421,7 +421,9 @@
" (procedure-arity-includes/c 1)\n"
" (procedure-arity-includes/c 1))")
v))
(vector->immutable-vector v))))
(vector->immutable-vector v))
'()
#t))
;; new-style sequence property, where the property value is a procedure
;; to get the sequence-driving value and procedures;