Skip to content

Commit 7af943e

Browse files
committed
Handle inference of list dots under regular lists.
1 parent b87e6a4 commit 7af943e

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

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

+3-2
Original file line numberDiff line numberDiff line change
@@ -582,8 +582,9 @@
582582
;; ListDots can be below a Listof
583583
;; must be above mu unfolding
584584
[((ListDots: s-dty dbound) (Listof: t-elem))
585-
#:return-when (memq dbound Y) #f
586-
(cgen V X Y (substitute Univ dbound s-dty) t-elem)]
585+
(if (memq dbound Y)
586+
(% move-rest-to-dmap (cgen V (cons dbound X) Y s-dty t-elem) dbound)
587+
(cgen V X Y (substitute Univ dbound s-dty) t-elem))]
587588
;; two ListDots with the same bound, just check the element type
588589
;; This is conservative because we don't try to infer a constraint on dbound.
589590
[((ListDots: s-dty dbound) (ListDots: t-dty dbound))

pkgs/typed-racket-pkgs/typed-racket-test/tests/typed-racket/unit-tests/infer-tests.rkt

+2-1
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,8 @@
100100
(infer-t (-v a) (-v b) #:vars '(b))
101101

102102
(infer-t (make-ListDots -Symbol 'b) (-lst -Symbol) #:indices '(b))
103+
(infer-t (make-ListDots (-v a) 'b) (-lst -Symbol) #:vars '(a) #:indices '(b))
104+
(infer-t (make-ListDots (-v b) 'b) (-lst -Symbol) #:indices '(b))
103105
(infer-t (make-ListDots (-v b) 'b) (-lst Univ) #:indices '(b))
104106
(infer-t (make-ListDots (-v a) 'b) (make-ListDots -Symbol 'b) #:vars '(a))
105107
(infer-t (make-ListDots -Symbol 'b) (make-ListDots Univ 'b) #:indices '(b))
@@ -128,7 +130,6 @@
128130
[infer-t (-lst* -String) (make-ListDots -Symbol 'b) #:indices '(b) #:fail]
129131

130132
;; Currently Broken
131-
;(infer-t (make-ListDots (-v b) 'b) (-lst -Symbol) #:indices '(b))
132133
;(infer-t (-lst -Symbol) (make-ListDots -Symbol 'b) #:indices '(b))
133134
;(infer-t (make-ListDots (-v b) 'b) (make-ListDots -Symbol 'b) #:indices '(b))
134135
;(infer-t (make-ListDots -Symbol 'b) (make-ListDots (-v b) 'b) #:indices '(b))

0 commit comments

Comments
 (0)