|
22 | 22 | "signatures.rkt" "fail.rkt"
|
23 | 23 | "promote-demote.rkt"
|
24 | 24 | racket/match
|
| 25 | + (only-in racket/function curry curryr) |
25 | 26 | ;racket/trace
|
26 | 27 | (contract-req)
|
27 | 28 | (for-syntax
|
|
576 | 577 | [(F: v*) (and (bound-index? v*) (not (bound-tvar? v*)))]
|
577 | 578 | [_ #f])
|
578 | 579 | #f
|
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 | 581 | (if maybe-type-bound
|
582 | 582 | (if (subtype maybe-type-bound T obj)
|
583 | 583 | (singleton maybe-type-bound
|
584 | 584 | v
|
585 | 585 | (var-demote T (context-bounds context)))
|
586 | 586 | #f)
|
587 |
| - (singleton -Bottom |
588 |
| - v |
589 |
| - (var-demote T (context-bounds context))))] |
| 587 | + ;; constrain v to be below T (but don't mention bounds) |
| 588 | + (singleton -Bottom v (var-demote T (context-bounds context))))] |
590 | 589 |
|
591 | 590 | [(S (F: (? (inferable-var? context) v)))
|
592 | 591 | #:return-when
|
593 | 592 | (match S
|
594 | 593 | [(F: v*) (and (bound-index? v*) (not (bound-tvar? v*)))]
|
595 | 594 | [_ #f])
|
596 | 595 | #f
|
597 |
| - (define maybe-type-bound (hash-ref (context-type-bounds context) v #f)) |
598 | 596 | ;; constrain v to be above S (but don't mention bounds)
|
| 597 | + (define maybe-type-bound (hash-ref (context-type-bounds context) v #f)) |
| 598 | + (let ([sing (curry singleton (var-promote S (context-bounds context)) v)]) |
| 599 | + (cond |
| 600 | + [(and maybe-type-bound (subtype S maybe-type-bound obj)) |
| 601 | + (sing maybe-type-bound)] |
| 602 | + [(not maybe-type-bound) (sing Univ)] |
| 603 | + [else #f])) |
| 604 | + #; |
599 | 605 | (if maybe-type-bound
|
600 | 606 | (if (subtype S maybe-type-bound obj)
|
601 | 607 | (singleton (var-demote S (context-bounds context))
|
602 | 608 | v
|
603 | 609 | maybe-type-bound)
|
604 | 610 | #f)
|
605 |
| - (singleton (var-demote S (context-bounds context)) |
606 |
| - v |
607 |
| - Univ))] |
| 611 | + (singleton (var-promote S (context-bounds context)) v Univ))] |
608 | 612 |
|
609 | 613 | ;; recursive names should get resolved as they're seen
|
610 | 614 | [(s (? Name? t))
|
|
0 commit comments