We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent b9139a5 commit 7afbe26Copy full SHA for 7afbe26
typed-racket-lib/typed-racket/types/union.rkt
@@ -37,6 +37,14 @@
37
[(_ _) #:when (currently-subtyping?) (cons a b)]
38
[((? (λ _ (subtype a b*))) _) b]
39
[((? (λ _ (subtype b* a))) _) (list a)]
40
+ ;; the union of two box types is a box type where the write type has to satisfy both write types,
41
+ ;; and the read type can satisfy either of the two read types
42
+ [((Box: a-w a-r) (list-no-order (Box: b-w b-r) bs ...))
43
+ (define w
44
+ (cond [(subtype a-w b-w) a-w]
45
+ [(subtype b-w a-w) b-w]
46
+ [else -Bottom]))
47
+ (cons (make-Box w (Un a-r b-r)) bs)]
48
[(_ _) (cons a (filter-not (λ (b-elem) (subtype b-elem a)) b))]))
49
50
;; Type -> List[Type]
0 commit comments