diff --git a/pkgs/typed-racket-pkgs/typed-racket-lib/typed-racket/static-contracts/combinators/derived.rkt b/pkgs/typed-racket-pkgs/typed-racket-lib/typed-racket/static-contracts/combinators/derived.rkt index d95a361879..fcef3a14f2 100644 --- a/pkgs/typed-racket-pkgs/typed-racket-lib/typed-racket/static-contracts/combinators/derived.rkt +++ b/pkgs/typed-racket-pkgs/typed-racket-lib/typed-racket/static-contracts/combinators/derived.rkt @@ -5,7 +5,7 @@ ;; Ex: (listof/sc any/sc) => list?/sc (require "simple.rkt" "structural.rkt" - (for-template racket/base racket/set racket/promise)) + (for-template racket/base racket/list racket/set racket/promise)) (provide (all-defined-out)) (define identifier?/sc (flat/sc #'identifier?)) @@ -13,6 +13,7 @@ (define syntax?/sc (flat/sc #'syntax?)) (define promise?/sc (flat/sc #'promise?)) +(define cons?/sc (flat/sc #'cons?)) (define list?/sc (flat/sc #'list?)) (define set?/sc (flat/sc #'set?)) diff --git a/pkgs/typed-racket-pkgs/typed-racket-lib/typed-racket/static-contracts/optimize.rkt b/pkgs/typed-racket-pkgs/typed-racket-lib/typed-racket/static-contracts/optimize.rkt index a51eb39383..0bee1d0fbf 100644 --- a/pkgs/typed-racket-pkgs/typed-racket-lib/typed-racket/static-contracts/optimize.rkt +++ b/pkgs/typed-racket-pkgs/typed-racket-lib/typed-racket/static-contracts/optimize.rkt @@ -39,6 +39,7 @@ ;[(hash/sc: key/sc (none/sc:)) empty-hash/sc] ;; any/sc cases + [(cons/sc: (any/sc:) (any/sc:)) cons?/sc] [(listof/sc: (any/sc:)) list?/sc] [(list/sc: (and scs (any/sc:)) ...) (list-length/sc (length scs))] [(vectorof/sc: (any/sc:)) vector?/sc] diff --git a/pkgs/typed-racket-pkgs/typed-racket-test/tests/typed-racket/unit-tests/static-contract-optimizer-tests.rkt b/pkgs/typed-racket-pkgs/typed-racket-test/tests/typed-racket/unit-tests/static-contract-optimizer-tests.rkt index 78022dd324..947aa6fd50 100644 --- a/pkgs/typed-racket-pkgs/typed-racket-test/tests/typed-racket/unit-tests/static-contract-optimizer-tests.rkt +++ b/pkgs/typed-racket-pkgs/typed-racket-test/tests/typed-racket/unit-tests/static-contract-optimizer-tests.rkt @@ -271,4 +271,8 @@ #:pos any/sc #:neg list?/sc) + (check-optimize (cons/sc any/sc list?/sc) + #:pos any/sc + #:neg (cons/sc any/sc list?/sc)) + ))