Generate channel contracts in TR
original commit: f2ddc66333512cfc7e24f2cb91de43464f5a59c1
This commit is contained in:
parent
a6f0db1fdb
commit
9b08a80030
|
@ -487,6 +487,9 @@
|
|||
[(Hashtable: k v)
|
||||
(when (equal? kind flat-sym) (exit (fail)))
|
||||
#`(hash/c #,(t->c k #:kind chaperone-sym) #,(t->c v) #:immutable 'dont-care)]
|
||||
[(Channel: t)
|
||||
(set-chaperone!)
|
||||
#`(channel/c #,(t->c/both t))]
|
||||
[else
|
||||
(exit (fail #:reason "contract generation not supported for this type"))]))))
|
||||
|
||||
|
|
|
@ -0,0 +1,18 @@
|
|||
#;
|
||||
(exn-pred #rx"expected: Integer.*blaming: top-level")
|
||||
#lang racket/load
|
||||
|
||||
;; Test typed-untyped interaction with channels
|
||||
|
||||
(module typed typed/racket
|
||||
(: ch (Channelof (Boxof Integer)))
|
||||
(define ch (make-channel))
|
||||
(: putter (-> Thread))
|
||||
(define (putter)
|
||||
(thread (λ () (channel-put ch (box 3)))))
|
||||
(provide putter ch))
|
||||
|
||||
(require 'typed)
|
||||
(putter)
|
||||
(set-box! (channel-get ch) "not an integer")
|
||||
|
Loading…
Reference in New Issue
Block a user