Skip to content

Commit f8da3b2

Browse files
resyntax-ci[bot]samth
authored andcommitted
Fix 2 occurrences of explicit-cond-else-void
Add an explicit `[else (void)]` clause to make the default behavior clear.
1 parent 9a579d2 commit f8da3b2

File tree

2 files changed

+42
-35
lines changed

2 files changed

+42
-35
lines changed

typed-racket-lib/typed-racket/typecheck/check-below.rkt

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -129,19 +129,16 @@
129129
[((tc-result1: t1 p1 o1) (tc-result1: t2 p2 o2))
130130
(define (perform-check!)
131131
(cond
132-
[(not (subtype t1 t2 o1))
133-
(expected-but-got t2 t1)]
134-
[(and (not (prop-set-better? p1 p2))
135-
(object-better? o1 o2))
132+
[(not (subtype t1 t2 o1)) (expected-but-got t2 t1)]
133+
[(and (not (prop-set-better? p1 p2)) (object-better? o1 o2))
136134
(type-mismatch p2 p1 "mismatch in proposition")]
137-
[(and (prop-set-better? p1 p2)
138-
(not (object-better? o1 o2)))
135+
[(and (prop-set-better? p1 p2) (not (object-better? o1 o2)))
139136
(type-mismatch (print-object o2) (print-object o1) "mismatch in object")]
140-
[(and (not (prop-set-better? p1 p2))
141-
(not (object-better? o1 o2)))
137+
[(and (not (prop-set-better? p1 p2)) (not (object-better? o1 o2)))
142138
(type-mismatch (format "`~a' and `~a'" p2 (print-object o2))
143139
(format "`~a' and `~a'" p1 (print-object o1))
144-
"mismatch in proposition and object")])
140+
"mismatch in proposition and object")]
141+
[else (void)])
145142
(ret (upgrade-trusted-rng t1 t2) (fix-props p2 p1) (fix-object o2 o1)))
146143
(cond
147144
[(with-refinements?)

typed-racket-lib/typed-racket/typecheck/tc-app-helper.rkt

Lines changed: 36 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -42,32 +42,42 @@
4242

4343
(when check?
4444
(define extra-arg-count (- (length t-a) (length dom)))
45-
(cond [(and (not rst) (not (eqv? 0 extra-arg-count)))
46-
(tc-error/fields "could not apply function"
47-
#:more "wrong number of arguments provided"
48-
"expected" (length dom)
49-
"given" (length t-a)
50-
#:delayed? #t)]
51-
[(and rst (negative? extra-arg-count))
52-
(tc-error/fields "could not apply function"
53-
#:more "wrong number of arguments provided"
54-
"expected at least" (length dom)
55-
"given" (length t-a)
56-
#:delayed? #t)]
57-
[(and (Rest? rst)
58-
(positive? extra-arg-count)
59-
(not (zero? (remainder extra-arg-count (length (Rest-tys rst))))))
60-
(cond
61-
[(eqv? 2 (length (Rest-tys rst)))
62-
(tc-error/fields "could not apply function"
63-
#:more "wrong number of rest arguments provided"
64-
"expected an even number, given" extra-arg-count
65-
#:delayed? #t)]
66-
[else (tc-error/fields "could not apply function"
67-
#:more "wrong number of rest arguments provided"
68-
"expected a multiple of " (length (Rest-tys rst))
69-
"given" extra-arg-count
70-
#:delayed? #t)])])
45+
(cond
46+
[(and (not rst) (not (eqv? 0 extra-arg-count)))
47+
(tc-error/fields "could not apply function"
48+
#:more "wrong number of arguments provided"
49+
"expected"
50+
(length dom)
51+
"given"
52+
(length t-a)
53+
#:delayed? #t)]
54+
[(and rst (negative? extra-arg-count))
55+
(tc-error/fields "could not apply function"
56+
#:more "wrong number of arguments provided"
57+
"expected at least"
58+
(length dom)
59+
"given"
60+
(length t-a)
61+
#:delayed? #t)]
62+
[(and (Rest? rst)
63+
(positive? extra-arg-count)
64+
(not (zero? (remainder extra-arg-count (length (Rest-tys rst))))))
65+
(cond
66+
[(eqv? 2 (length (Rest-tys rst)))
67+
(tc-error/fields "could not apply function"
68+
#:more "wrong number of rest arguments provided"
69+
"expected an even number, given"
70+
extra-arg-count
71+
#:delayed? #t)]
72+
[else
73+
(tc-error/fields "could not apply function"
74+
#:more "wrong number of rest arguments provided"
75+
"expected a multiple of "
76+
(length (Rest-tys rst))
77+
"given"
78+
extra-arg-count
79+
#:delayed? #t)])]
80+
[else (void)])
7181
(match rst
7282
[(Rest: rst-ts)
7383
(for ([a (in-syntax args-stx)]

0 commit comments

Comments
 (0)