Skip to content

Commit

Permalink
Repair errors uncovered by racket/typed-racket#1367. (#129)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
samth authored Apr 1, 2024
1 parent 5de5490 commit a14222e
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 7 deletions.
6 changes: 3 additions & 3 deletions plot-lib/plot/private/common/parameters.rkt
Original file line number Diff line number Diff line change
Expand Up @@ -212,9 +212,9 @@

(defparam point-sym Point-Sym 'circle)
(defparam point-color Plot-Color 0)
(defparam point-x-jitter Real 0)
(defparam point-y-jitter Real 0)
(defparam point-z-jitter Real 0)
(defparam point-x-jitter Nonnegative-Real 0)
(defparam point-y-jitter Nonnegative-Real 0)
(defparam point-z-jitter Nonnegative-Real 0)
(defparam2 point-size Real Nonnegative-Real 6 (nonnegative-rational 'point-size))
(defparam2 point-line-width Real Nonnegative-Real 1 (nonnegative-rational 'point-line-width))
(defparam2 point-alpha Real Nonnegative-Real 1 (unit-ivl 'point-alpha))
Expand Down
4 changes: 2 additions & 2 deletions plot-lib/plot/private/common/plot-device.rkt
Original file line number Diff line number Diff line change
Expand Up @@ -651,11 +651,11 @@
(hash-update height i (λ ([v : Exact-Rational]) (max h v)) (λ () 0))))])
(define widths
((inst map Exact-Rational (Pairof Integer Exact-Rational))
cdr ((inst sort (Pairof Integer Exact-Rational))
cdr ((inst sort (Pairof Integer Exact-Rational) Integer)
(hash->list width) < #:key car)))
(define heights
((inst map Exact-Rational (Pairof Integer Exact-Rational))
cdr ((inst sort (Pairof Integer Exact-Rational))
cdr ((inst sort (Pairof Integer Exact-Rational) Integer)
(hash->list height) < #:key car)))
(cond
[compact? (values widths heights)]
Expand Down
2 changes: 1 addition & 1 deletion plot-lib/plot/private/plot2d/point.rkt
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@
[(empty? vs) empty-renderer2d]
[else
(unless (= 0 x-jitter y-jitter)
(points-apply-jitters vs (vector x-jitter y-jitter) #:ivls (vector (ivl x-min x-max) (ivl y-min y-max))))
(points-apply-jitters vs ((inst vector Nonnegative-Real) x-jitter y-jitter) #:ivls (vector (ivl x-min x-max) (ivl y-min y-max))))
(match-define (list (vector #{xs : (Listof Real)} #{ys : (Listof Real)}) ...) vs)
(let ([x-min (if x-min x-min (apply min* xs))]
[x-max (if x-max x-max (apply max* xs))]
Expand Down
2 changes: 1 addition & 1 deletion plot-lib/plot/private/plot3d/point.rkt
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@
(cond [(empty? vs) empty-renderer3d]
[else
(unless (= 0 x-jitter y-jitter z-jitter)
(points-apply-jitters vs (vector x-jitter y-jitter z-jitter)
(points-apply-jitters vs ((inst vector Nonnegative-Real) x-jitter y-jitter z-jitter)
#:ivls (vector (ivl x-min x-max)
(ivl y-min y-max)
(ivl z-min z-max))))
Expand Down

0 comments on commit a14222e

Please sign in to comment.