fix *list/c so that it returns a flat contract when given flat contracts and a chaperone contract when given chaperone contracts

This commit is contained in:
Robby Findler 2021-04-09 22:17:38 -05:00
parent 16bc937e7f
commit 1244396d01
3 changed files with 10 additions and 5 deletions

View File

@ -168,6 +168,7 @@
(test-flat-contract '(listof boolean?) (list #t #f) (list #f 3 #t))
(test-flat-contract '(listof any/c) (list #t #f) 3)
(test-flat-contract '(*list/c boolean? integer?) (list #t #f 1) (list #t #f))
(test-flat-contract '(vectorof boolean? #:flat? #t) (vector #t #f) (vector #f 3 #t))
(test-flat-contract '(vectorof any/c #:flat? #t) (vector #t #f) 3)

View File

@ -205,5 +205,9 @@
'((caddr (contract (*list/c (-> integer? integer?) (-> boolean? boolean?) (-> char? char?))
(list (λ (x) x) (λ (y) y) (λ (y) 'not-a-bool) (λ (y) y)) 'pos 'neg))
#f))
(test/spec-passed/result
'*list/c8
'(chaperone-contract? (*list/c (-> integer? integer?) boolean?))
#t)
)
)

View File

@ -1025,8 +1025,8 @@
#:property prop:custom-write custom-write-property-proc)
(struct flat-*list/c *list-ctc ()
#:property prop:contract
(build-contract-property
#:property prop:flat-contract
(build-flat-contract-property
#:trusted trust-me
#:name *list/c-name-proc
#:first-order *list/c-first-order
@ -1037,8 +1037,8 @@
#:late-neg-projection (λ (ctc) (*list/c-late-neg-projection ctc #f #t))
#:list-contract? (λ (c) #t)))
(struct chaperone-*list/c *list-ctc ()
#:property prop:contract
(build-contract-property
#:property prop:chaperone-contract
(build-chaperone-contract-property
#:trusted trust-me
#:name *list/c-name-proc
#:first-order *list/c-first-order