File tree Expand file tree Collapse file tree 1 file changed +8
-17
lines changed
typed-racket-lib/typed-racket/infer Expand file tree Collapse file tree 1 file changed +8
-17
lines changed Original file line number Diff line number Diff line change 577
577
[(F: v*) (and (bound-index? v*) (not (bound-tvar? v*)))]
578
578
[_ #f ])
579
579
#f
580
+ ;; constrain v to be below T (but don't mention bounds)
580
581
(define maybe-type-bound (hash-ref (context-type-bounds context) v #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
- ;; constrain v to be below T (but don't mention bounds)
588
- (singleton -Bottom v (var-demote T (context-bounds context))))]
582
+ (let ([sing (curryr singleton v (var-demote T (context-bounds context)))])
583
+ (cond
584
+ [(and maybe-type-bound (subtype maybe-type-bound T obj))
585
+ (sing maybe-type-bound)]
586
+ [(not maybe-type-bound) (sing -Bottom)]
587
+ [else #f ]))]
589
588
590
589
[(S (F: (? (inferable-var? context) v)))
591
590
#:return-when
600
599
[(and maybe-type-bound (subtype S maybe-type-bound obj))
601
600
(sing maybe-type-bound)]
602
601
[(not maybe-type-bound) (sing Univ)]
603
- [else #f ]))
604
- #;
605
- (if maybe-type-bound
606
- (if (subtype S maybe-type-bound obj)
607
- (singleton (var-demote S (context-bounds context))
608
- v
609
- maybe-type-bound)
610
- #f )
611
- (singleton (var-promote S (context-bounds context)) v Univ))]
602
+ [else #f ]))]
612
603
613
604
;; recursive names should get resolved as they're seen
614
605
[(s (? Name? t))
You can’t perform that action at this time.
0 commit comments