File tree Expand file tree Collapse file tree 5 files changed +39
-31
lines changed
typed-racket-lib/typed-racket
typed-racket-test/unit-tests Expand file tree Collapse file tree 5 files changed +39
-31
lines changed Original file line number Diff line number Diff line change 915
915
[(? variance:const?) S]
916
916
[(? variance:co?) S]
917
917
[(? variance:contra?) T]
918
- [(? variance:inv?) (let ([gS (generalize S)]) (if (subtype gS T) gS S))]))
918
+ [(? variance:inv?) (define gS (generalize S))
919
+ (if (subtype gS T) gS S)]))
919
920
920
921
;; Since we don't add entries to the empty cset for index variables (since there is no
921
922
;; widest constraint, due to dcon-exacts), we must add substitutions here if no constraint
Original file line number Diff line number Diff line change 328
328
msg-rngs)
329
329
... ))
330
330
_ ))
331
- (let ([fcn-string (name->function-str name)])
332
- (if (and (andmap null? msg-doms)
333
- (null? argtypes))
334
- (tc-error/expr (string-append
335
- "Could not infer types for applying polymorphic "
331
+ (define fcn-string (name->function-str name))
332
+ (if (and (andmap null? msg-doms) (null? argtypes))
333
+ (tc-error/expr
334
+ (string-append "Could not infer types for applying polymorphic " fcn-string "\n " ))
335
+ (domain-mismatches
336
+ f-stx
337
+ args-stx
338
+ t
339
+ msg-doms
340
+ msg-rests
341
+ msg-rngs
342
+ argtypes
343
+ #f
344
+ #f
345
+ #:expected expected
346
+ #:msg-thunk
347
+ (lambda (dom)
348
+ (string-append "Polymorphic "
336
349
fcn-string
337
- "\n " ))
338
- (domain-mismatches f-stx args-stx t msg-doms msg-rests
339
- msg-rngs argtypes #f #f #:expected expected
340
- #:msg-thunk (lambda (dom)
341
- (string-append
342
- "Polymorphic " fcn-string " could not be applied to arguments:\n "
343
- dom
344
- (if (not (subset? (apply set-union (seteq) (map fv/list msg-doms))
345
- (list->seteq msg-vars)))
346
- (string-append "Type Variables: " (stringify msg-vars) "\n " )
347
- "" ))))))]
350
+ " could not be applied to arguments:\n "
351
+ dom
352
+ (if (not (subset? (apply set-union (seteq) (map fv/list msg-doms))
353
+ (list->seteq msg-vars)))
354
+ (string-append "Type Variables: " (stringify msg-vars) "\n " )
355
+ "" )))))]
348
356
[(Poly-names:
349
357
msg-vars
350
358
(DepFun: raw-domain _ raw-rng))
Original file line number Diff line number Diff line change 143
143
(dynamic-wind
144
144
(λ () (save-errors!))
145
145
(λ ()
146
- (let ([ result (tc-expr/check form expected)] )
147
- (and (not (current-type-error?)) result) ))
146
+ (define result (tc-expr/check form expected))
147
+ (and (not (current-type-error?)) result))
148
148
(λ () (restore-errors!))))))
149
149
150
150
(define (tc-expr/check/t? form expected)
Original file line number Diff line number Diff line change 184
184
(define value->HT
185
185
(case-lambda
186
186
[(check-element h tycon expected-kt expected-vt)
187
- (let* ([ kts (hash-map h (lambda (x y) (check-element x expected-kt)))]
188
- [ vts (hash-map h (lambda (x y) (check-element y expected-vt)))]
189
- [ kt (apply Un kts)]
190
- [ vt (apply Un vts)] )
191
- (tycon (check-below kt expected-kt) (check-below vt expected-vt) ))]
187
+ (define kts (hash-map h (lambda (x y) (check-element x expected-kt))))
188
+ ( define vts (hash-map h (lambda (x y) (check-element y expected-vt))))
189
+ ( define kt (apply Un kts))
190
+ ( define vt (apply Un vts))
191
+ (tycon (check-below kt expected-kt) (check-below vt expected-vt))]
192
192
[(check-element h tycon)
193
193
(define kt (generalize (apply Un (map check-element (hash-keys h)))))
194
194
(define vt (generalize (apply Un (map check-element (hash-values h)))))
Original file line number Diff line number Diff line change 32
32
(make-check-info 'trusted trusted-side)
33
33
(make-check-expected expected))
34
34
(λ ()
35
- (let ([opt (optimize argument
36
- #:trusted-positive trusted-positive
37
- #:trusted-negative trusted-negative)])
38
- (with-check-info* (list (make-check-actual opt))
39
- (lambda ()
40
- (unless (equal? opt expected)
41
- (fail-check))))))))
35
+ (define opt
36
+ (optimize argument #:trusted-positive trusted-positive #:trusted-negative trusted-negative))
37
+ (with-check-info* (list (make-check-actual opt))
38
+ (lambda ()
39
+ (unless (equal? opt expected)
40
+ (fail-check)))))))
42
41
43
42
(define-syntax (check-syntax stx)
44
43
(syntax-parse stx
You can’t perform that action at this time.
0 commit comments