Small improvements to contract→type

This commit is contained in:
Georges Dupéron 2017-05-05 03:34:17 +02:00
parent dcfb3ff987
commit cbd0addb8e
3 changed files with 17 additions and 2 deletions

View File

@ -36,6 +36,9 @@
[(_ {~literal c:boolean?}) #'Boolean]
[(_ {~literal c:bytes?}) #'Bytes]
[(_ {~literal c:void?}) #'Void]
[(_ {~literal c:null?}) #'Null]
[(_ {~literal c:empty?}) #'Null]
[(_ {~literal c:list?}) #'(Listof Any)]
[(_ {~literal c:exact-nonnegative-integer?}) #'Exact-Nonnegative-Integer]
[(_ {~literal c:exact-positive-integer?}) #'Exact-Positive-Integer]
[(_ ({~literal c:syntax/c} τ)) #'(Syntaxof (c→t τ))]

View File

@ -16,7 +16,8 @@
@racket[listof], @racket[list/c], @racket[*list/c], @racket[vectorof],
@racket[vector/c], @racket[cons/c], @racket[number?], @racket[integer?],
@racket[string?], @racket[symbol?], @racket[char?], @racket[boolean?],
@racket[bytes?], @racket[void?], @racket[exact-nonnegative-integer?],
@racket[bytes?], @racket[void?], @racket[null?], @racket[empty?],
@racket[list?], @racket[exact-nonnegative-integer?],
@racket[exact-positive-integer?], @racket[syntax/c], @racket[parameter/c],
@racket[promise/c], @racket[suggest/c], @racket[flat-rec-contract], some uses
of @racket[->] and @racket[->*], @racket['quoted-datum],

View File

@ -42,4 +42,15 @@
'(->* (Integer Boolean) () Symbol))
(check-written=? (:contract→type
(flat-rec-contract W (cons/c W W) number? string?))
'(Rec W (U (Pairof W W) Number String)))
'(Rec W (U (Pairof W W) Number String)))
(check-written=? (:contract→type
(flat-rec-contract W
(cons/c (flat-rec-contract R
(cons/c W R)
null?)
W)
number?
string?))
'(Rec W (U (Pairof '(Rec R (U (Pairof R W) Null)) W)
Number
String)))