File tree Expand file tree Collapse file tree 2 files changed +24
-15
lines changed
typed-racket-lib/typed-racket Expand file tree Collapse file tree 2 files changed +24
-15
lines changed Original file line number Diff line number Diff line change 578
578
#f
579
579
;; constrain v to be below T (but don't mention bounds)
580
580
(define maybe-type-bound (hash-ref (context-type-bounds context) v #f ))
581
- (if (and maybe-type-bound (subtype maybe-type-bound T obj))
582
- (singleton maybe-type-bound v (var-demote T (context-bounds context)))
583
- #f )]
581
+ (if maybe-type-bound
582
+ (if (subtype maybe-type-bound T obj)
583
+ (singleton maybe-type-bound
584
+ v
585
+ (var-demote T (context-bounds context)))
586
+ #f )
587
+ (singleton -Bottom
588
+ v
589
+ (var-demote T (context-bounds context))))]
584
590
585
591
[(S (F: (? (inferable-var? context) v)))
586
592
#:return-when
590
596
#f
591
597
(define maybe-type-bound (hash-ref (context-type-bounds context) v #f ))
592
598
;; constrain v to be above S (but don't mention bounds)
593
- (if (and maybe-type-bound (subtype S maybe-type-bound obj))
594
- (singleton (var-promote S (context-bounds context)) v maybe-type-bound)
595
- #f )]
599
+ (if maybe-type-bound
600
+ (if (subtype S maybe-type-bound obj)
601
+ (singleton (var-demote S (context-bounds context))
602
+ v
603
+ maybe-type-bound)
604
+ #f )
605
+ (singleton (var-demote S (context-bounds context))
606
+ v
607
+ Univ))]
596
608
597
609
;; recursive names should get resolved as they're seen
598
610
[(s (? Name? t))
1010
1022
(let ()
1011
1023
(define/cond-contract (infer X Y S T R [expected #f ]
1012
1024
#:multiple? [multiple-substitutions? #f ]
1013
- #:bounds [bounds '#()]
1025
+ #:bounds [bounds '#hash ()]
1014
1026
#:objs [objs '() ])
1015
1027
(((listof symbol?) (listof symbol?) (listof Type?) (listof Type?)
1016
1028
(or/c #f Values/c AnyValues? ValuesDots?))
Original file line number Diff line number Diff line change 1499
1499
(make-PolyRow constraints (rec/lvl body (add1 lvl)))]
1500
1500
[(PolyDots: n body)
1501
1501
(make-PolyDots n (rec/lvl body (+ n lvl)))]
1502
- [(Poly: n bound body)
1503
- (make-Poly n (rec/lvl body (+ n lvl)))]
1502
+ [(Poly: n bounds body)
1503
+ (make-Poly n bounds (rec/lvl body (+ n lvl)))]
1504
1504
[_ (Rep-fmap cur rec)])))
1505
1505
1506
1506
1678
1678
(values (list-ref names idx) v)))
1679
1679
(unless (= (length names) n)
1680
1680
(int-err "Wrong number of names: expected ~a got ~a " n (length names)))
1681
- (eprintf "new bounds is ~a ~n " new-bounds)
1682
1681
(instantiate-type body
1683
1682
(map (lambda (n)
1684
1683
(make-F n (hash-ref new-bounds n #f )))
1685
- names)
1686
- #;
1687
- (map F* names))]))
1684
+ names))]))
1688
1685
1689
1686
;; PolyDots 'smart' constructor
1690
1687
(define (PolyDots* names body)
1717
1714
(define (PolyRow-body* names t)
1718
1715
(match t
1719
1716
[(PolyRow: constraints body)
1720
- (instantiate-type body (map names))]))
1717
+ (instantiate-type body (map F* names))]))
1721
1718
1722
1719
1723
1720
;;***************************************************************
1982
1979
[(Some: n body)
1983
1980
(unless (= (length names) n)
1984
1981
(int-err "Wrong number of names: expected ~a got ~a " n (length names)))
1985
- (instantiate-type body (map names))]))
1982
+ (instantiate-type body (map F* names))]))
1986
1983
1987
1984
1988
1985
(define-match-expander Some-names:
You can’t perform that action at this time.
0 commit comments