Skip to content

Commit a14222e

Browse files
authored
Repair errors uncovered by racket/typed-racket#1367. (#129)
Some arguments were not type checked correctly, meaning some type errors slipped through. The most significant change is that the jitter parameters become `Nonnegative-Real`, which is backwards-incompatible. Other choices there are possible, but this is the simplest.
1 parent 5de5490 commit a14222e

File tree

4 files changed

+7
-7
lines changed

4 files changed

+7
-7
lines changed

plot-lib/plot/private/common/parameters.rkt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -212,9 +212,9 @@
212212

213213
(defparam point-sym Point-Sym 'circle)
214214
(defparam point-color Plot-Color 0)
215-
(defparam point-x-jitter Real 0)
216-
(defparam point-y-jitter Real 0)
217-
(defparam point-z-jitter Real 0)
215+
(defparam point-x-jitter Nonnegative-Real 0)
216+
(defparam point-y-jitter Nonnegative-Real 0)
217+
(defparam point-z-jitter Nonnegative-Real 0)
218218
(defparam2 point-size Real Nonnegative-Real 6 (nonnegative-rational 'point-size))
219219
(defparam2 point-line-width Real Nonnegative-Real 1 (nonnegative-rational 'point-line-width))
220220
(defparam2 point-alpha Real Nonnegative-Real 1 (unit-ivl 'point-alpha))

plot-lib/plot/private/common/plot-device.rkt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -651,11 +651,11 @@
651651
(hash-update height i (λ ([v : Exact-Rational]) (max h v)) (λ () 0))))])
652652
(define widths
653653
((inst map Exact-Rational (Pairof Integer Exact-Rational))
654-
cdr ((inst sort (Pairof Integer Exact-Rational))
654+
cdr ((inst sort (Pairof Integer Exact-Rational) Integer)
655655
(hash->list width) < #:key car)))
656656
(define heights
657657
((inst map Exact-Rational (Pairof Integer Exact-Rational))
658-
cdr ((inst sort (Pairof Integer Exact-Rational))
658+
cdr ((inst sort (Pairof Integer Exact-Rational) Integer)
659659
(hash->list height) < #:key car)))
660660
(cond
661661
[compact? (values widths heights)]

plot-lib/plot/private/plot2d/point.rkt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@
7171
[(empty? vs) empty-renderer2d]
7272
[else
7373
(unless (= 0 x-jitter y-jitter)
74-
(points-apply-jitters vs (vector x-jitter y-jitter) #:ivls (vector (ivl x-min x-max) (ivl y-min y-max))))
74+
(points-apply-jitters vs ((inst vector Nonnegative-Real) x-jitter y-jitter) #:ivls (vector (ivl x-min x-max) (ivl y-min y-max))))
7575
(match-define (list (vector #{xs : (Listof Real)} #{ys : (Listof Real)}) ...) vs)
7676
(let ([x-min (if x-min x-min (apply min* xs))]
7777
[x-max (if x-max x-max (apply max* xs))]

plot-lib/plot/private/plot3d/point.rkt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@
7474
(cond [(empty? vs) empty-renderer3d]
7575
[else
7676
(unless (= 0 x-jitter y-jitter z-jitter)
77-
(points-apply-jitters vs (vector x-jitter y-jitter z-jitter)
77+
(points-apply-jitters vs ((inst vector Nonnegative-Real) x-jitter y-jitter z-jitter)
7878
#:ivls (vector (ivl x-min x-max)
7979
(ivl y-min y-max)
8080
(ivl z-min z-max))))

0 commit comments

Comments
 (0)