|
42 | 42 |
|
43 | 43 | (when check? |
44 | 44 | (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)]) |
71 | 81 | (match rst |
72 | 82 | [(Rest: rst-ts) |
73 | 83 | (for ([a (in-syntax args-stx)] |
|
0 commit comments