File tree Expand file tree Collapse file tree 4 files changed +57
-6
lines changed
typed-racket-lib/typed-racket/static-contracts
typed-racket-test/succeed Expand file tree Collapse file tree 4 files changed +57
-6
lines changed Original file line number Diff line number Diff line change 9696 (set! bound (cons name* bound))
9797 ;; traverse what `name` refers to
9898 (define r (ref name*))
99- ;; ref returns a rib, get the one definition we want
100- (define target (for/first ([k (in-list (car r))]
101- [v (in-list (cdr r))]
102- #:when (free-identifier=? name* k))
103- v))
104- (loop target #f ))]
99+ ;; r can be #f if the name is not in all-name-defs
100+ (when r
101+ ;; ref returns a rib, get the one definition we want
102+ (define target (for/first ([k (in-list (car r))]
103+ [v (in-list (cdr r))]
104+ #:when (free-identifier=? name* k))
105+ v))
106+ (when target
107+ (loop target #f ))))]
105108 [else (sc-traverse sc loop)]))
106109 (for*/hash ([b (in-list bound)]
107110 [v (in-value (ref b))]
Original file line number Diff line number Diff line change 1+ #lang typed/racket/base
2+
3+ ;; Issue #1158: Regression test - previously caused car: contract violation
4+ ;; during contract generation with recursive MListof.
5+ ;; Fixed by adding null checks in compute-defs in static-contracts/instantiate.rkt
6+
7+ (provide func-1 func-2)
8+
9+ (define-type MNulls (MListof MNulls))
10+
11+ (: func-1 [-> MNulls Any]) (define (func-1 ns) 1 )
12+ (: func-2 [-> MNulls Any]) (define (func-2 ns) 2 )
13+
14+ (displayln (func-1 '() ))
15+ (displayln (func-2 '() ))
Original file line number Diff line number Diff line change 1+ #lang typed/racket/base
2+
3+ ;; Issue #848: Regression test - previously caused car: contract violation
4+ ;; with recursive case-> types during contract generation.
5+ ;; Fixed by adding null checks in compute-defs in static-contracts/instantiate.rkt
6+
7+ (provide
8+ new-T
9+ consume-T)
10+
11+ (define-type T
12+ (case->
13+ ['a -> Any]
14+ ['b -> (-> T)]))
15+
16+ (: new-T : -> T)
17+ (define (new-T) (new-T))
18+
19+ (: consume-T : T -> Nothing)
20+ (define (consume-T t) (consume-T t))
Original file line number Diff line number Diff line change 1+ #lang racket
2+
3+ ;; Issue #858: Previously caused "recursive-contract: contract violation"
4+ ;; with recursive types. Fixed by null checks in compute-defs.
5+
6+ (module a typed/racket
7+ (define-type T (Rec T (-> (U T String))))
8+ (provide f)
9+ (: f (-> T T))
10+ (define (f x) x))
11+
12+ (require 'a )
13+ (f (lambda () "" ))
You can’t perform that action at this time.
0 commit comments