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 577577 [(F: v*) (and (bound-index? v*) (not (bound-tvar? v*)))]
578578 [_ #f ])
579579 #f
580+ ;; constrain v to be below T (but don't mention bounds)
580581 (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 ]))]
589588
590589 [(S (F: (? (inferable-var? context) v)))
591590 #:return-when
600599 [(and maybe-type-bound (subtype S maybe-type-bound obj))
601600 (sing maybe-type-bound)]
602601 [(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 ]))]
612603
613604 ;; recursive names should get resolved as they're seen
614605 [(s (? Name? t))
You can’t perform that action at this time.
0 commit comments