File tree Expand file tree Collapse file tree 3 files changed +19
-3
lines changed
typed-racket-lib/typed-racket
typed-racket-test/succeed Expand file tree Collapse file tree 3 files changed +19
-3
lines changed Original file line number Diff line number Diff line change 596
596
597
597
;; variables that are in X and should be constrained
598
598
;; all other variables are compatible only with themselves
599
- [((and ( F: (? (inferable-var? context))) S ) T)
599
+ [((F: (? (inferable-var? context))) T)
600
600
#:return-when
601
601
(match T
602
602
;; fail when v* is an index variable
606
606
;; constrain S to be below T (but don't mention bounds)
607
607
(constrain S T #:above #f )]
608
608
609
- [(S (and ( F: (? (inferable-var? context))) T ))
609
+ [(S (F: (? (inferable-var? context))))
610
610
#:return-when
611
611
(match S
612
612
[(F: v*) (and (bound-index? v*) (not (bound-tvar? v*)))]
623
623
(let ([s (resolve-once s)])
624
624
(and s (cg s t obj)))]
625
625
626
+ [((F: var (? Type? bound)) t)
627
+ (let ([s (resolve-once bound)])
628
+ (and s (cg s t obj)))]
629
+
626
630
;; constrain b1 to be below T, but don't mention the new vars
627
631
[((Poly: v1 b1) T) (cgen (context-add context #:bounds v1) b1 T)]
628
632
Original file line number Diff line number Diff line change 1691
1691
(int-err "Wrong number of names: expected ~a got ~a " n (length names)))
1692
1692
(instantiate-type body
1693
1693
(map (lambda (n)
1694
- (make-F n (hash-ref new-bounds n #f )))
1694
+ (define v (match (hash-ref new-bounds n #f )
1695
+ [(App: rator (list (F: vb _ )))
1696
+ #:when (hash-has-key? new-bounds vb)
1697
+ (make-App rator (list (hash-ref new-bounds vb)))]
1698
+ [_else _else]))
1699
+ (make-F n v))
1695
1700
names))]))
1696
1701
1697
1702
;; PolyDots 'smart' constructor
Original file line number Diff line number Diff line change 17
17
(number->string a))
18
18
19
19
(c-func 10 (foo 10 ))
20
+
21
+ (: d-func (All ([X <: Integer] [Y <: (Foo X)])
22
+ (-> X Y String)))
23
+ (define (d-func a b)
24
+ (number->string (foo-a b)))
25
+
26
+ (d-func 42 (foo 10 ))
You can’t perform that action at this time.
0 commit comments