Skip to content

Commit 34ca0be

Browse files
committed
use intersect in merging for normalized Box types
1 parent d877e0f commit 34ca0be

File tree

1 file changed

+2
-7
lines changed

1 file changed

+2
-7
lines changed

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

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
(rep type-rep rep-utils)
55
(prefix-in c: (contract-req))
66
(types subtype base-abbrev resolve current-seen)
7+
(only-in (infer infer) intersect)
78
racket/match
89
racket/list)
910

@@ -36,13 +37,7 @@
3637
[(and (Box? t) (ormap Box? ts))
3738
(match* (t ts)
3839
[((Box: a-w a-r) (list-no-order (Box: b-w b-r) bs ...))
39-
(define w
40-
;; should this use some sort of intersection, or would that
41-
;; complicate things too much?
42-
(cond [(subtype a-w b-w) a-w]
43-
[(subtype b-w a-w) b-w]
44-
[else -Bottom]))
45-
(cons (make-Box w (union a-r b-r)) bs)])]
40+
(cons (make-Box (intersect a-w b-w) (union a-r b-r)) bs)])]
4641
[else (cons t (filter-not (λ (ts-elem) (subtype ts-elem t)) ts))])))
4742

4843
;; Recursively reduce unions so that they do not contain

0 commit comments

Comments
 (0)