Skip to content

Commit 943258d

Browse files
committed
Refine type of cadr on (Pairof A (Listof B)).
Closes #1026.
1 parent 330527d commit 943258d

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

typed-racket-lib/typed-racket/base-env/base-env.rkt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -525,9 +525,12 @@
525525
[-> (-lst (-lst a)) (-lst a)]))]
526526
[cadr (-poly (a b c)
527527
(cl->* [->acc (list (-pair a (-pair b c))) b (list -car -cdr)]
528+
[-> (-pair a (-lst b)) b]
528529
[-> (-lst a) a]))]
529530
[cddr (-poly (a b c)
530531
(cl->* [->acc (list (-pair a (-pair b c))) c (list -cdr -cdr)]
532+
[-> (-pair a (-lst b)) (-lst b)]
533+
[-> (-pair a (-pair b (-lst c))) (-lst c)]
531534
[-> (-lst a) (-lst a)]))]
532535

533536
[caaar (-poly (a b c d)

typed-racket-test/unit-tests/typecheck-tests.rkt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5319,6 +5319,10 @@
53195319
;; https://github.com/racket/typed-racket/issues/605
53205320
(hash 0 1 2 3 4 5 6 7 8 0)
53215321
(-Immutable-HT -Byte -Byte))
5322+
5323+
5324+
(tc-e (cadr (ann (cons "a" (list 1 2 3)) (Pairof String (Listof Byte))))
5325+
-Byte)
53225326
)
53235327
(if (extflonum-available?)
53245328

0 commit comments

Comments
 (0)