Skip to content

Commit 4639c5d

Browse files
committed
fix printing message for F:
1 parent 8e1fd55 commit 4639c5d

File tree

2 files changed

+9
-6
lines changed

2 files changed

+9
-6
lines changed

typed-racket-lib/typed-racket/infer/infer-unit.rkt

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -578,8 +578,9 @@
578578
#f
579579
;; constrain v to be below T (but don't mention bounds)
580580
(eprintf "hi...........~a ~n" v)
581-
(if (subtype (hash-ref (context-type-bounds context) v) T obj)
582-
(singleton -Bottom v (var-demote T (context-bounds context)))
581+
(define maybe-type-bound (hash-ref (context-type-bounds context) v #f))
582+
(if (and maybe-type-bound (subtype maybe-type-bound T obj))
583+
(singleton maybe-type-bound v (var-demote T (context-bounds context)))
583584
#f)]
584585

585586
[(S (F: (? (inferable-var? context) v)))
@@ -588,10 +589,11 @@
588589
[(F: v*) (and (bound-index? v*) (not (bound-tvar? v*)))]
589590
[_ #f])
590591
#f
591-
(eprintf "bye...........~a ~a <: ~a ~n" v S (hash-ref (context-type-bounds context) v))
592+
(define maybe-type-bound (hash-ref (context-type-bounds context) v #f))
593+
(eprintf "bye...........~a ~a <: ~a ~n" v S maybe-type-bound)
592594
;; constrain v to be above S (but don't mention bounds)
593-
(if (subtype S (hash-ref (context-type-bounds context) v) obj)
594-
(singleton (var-promote S (context-bounds context)) v (hash-ref (context-type-bounds context) v))
595+
(if (and maybe-type-bound (subtype S maybe-type-bound obj))
596+
(singleton (var-promote S (context-bounds context)) v maybe-type-bound)
595597
#f)]
596598

597599
;; recursive names should get resolved as they're seen

typed-racket-lib/typed-racket/types/printer.rkt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -714,10 +714,11 @@
714714
[(? Base?) (Base-name type)]
715715
[(Pair: l r) `(Pairof ,(t->s l) ,(t->s r))]
716716
[(ListDots: dty dbound) `(List ,(t->s dty) ... ,dbound)]
717-
[(F: nm)
717+
[(F: nm bound)
718718
(cond
719719
[(eq? nm imp-var) "Imp"]
720720
[(eq? nm self-var) "Self"]
721+
[(Type? bound) (format "~a <: ~a" nm (t->s bound))]
721722
[else nm])]
722723
[(Param: in out)
723724
(if (equal? in out)

0 commit comments

Comments
 (0)