typed-racket/typed-racket-test/succeed/issue-628.rkt
Ben Greenman 966845304e static-contracts: improve optimizer's test for flat scs
* Add `instantiate/optimize` to the static contracts API
  (new function in `instantiate.rkt`)
* Add optional kwd arg `#:recursive-kinds` to sc optimizer
* SC optimizer uses recursive kinds to tell if a `name/sc` or `recursive-sc`
  will generate a flat contract
* `instantiate/optimize`
  - solves for a recursive kinds table
  - calls `optimize` with the table
  - calls `instantiate` with the same table
2017-11-07 00:35:28 -05:00

23 lines
358 B
Racket

#lang racket/base
;; Test that the `Spec` type can be converted to a contract that
;; successfully **runs**
(module t typed/racket/base
(provide f g)
(define-type Spec
(-> (U Spec String)))
(: f (-> Spec))
(define (f)
(λ () "hello"))
(: g (-> (Rec T (-> (U T String)))))
(define (g)
(λ () "hello")))
(require 't)
(void f g)