Improve error message for calls to 'sort' when inference fails.
original commit: b124d68f402ce99ddec58482be40ce279f3f4a04
This commit is contained in:
parent
ada104f62e
commit
ffcc7e9f92
5
collects/tests/typed-scheme/fail/sort.rkt
Normal file
5
collects/tests/typed-scheme/fail/sort.rkt
Normal file
|
@ -0,0 +1,5 @@
|
|||
#;
|
||||
(exn-pred exn:fail:syntax? #rx".*Cannot infer.*Please add more type annotations.*")
|
||||
#lang typed/racket
|
||||
(define ss '("one" "two" "three")) ; (Listof String)
|
||||
(sort ss string<?)
|
|
@ -124,6 +124,9 @@
|
|||
;; error type is a perfectly good fcn type
|
||||
[((tc-result1: (Error:)) _) (ret (make-Error))]
|
||||
;; otherwise fail
|
||||
[((tc-result1: (and f-ty (Poly: ns (Function: arrs)))) _)
|
||||
(tc-error/expr #:return (ret (Un))
|
||||
"Cannot infer type instantiation for type ~a. Please add more type annotations" f-ty)]
|
||||
[((tc-result1: f-ty) _)
|
||||
(tc-error/expr #:return (ret (Un))
|
||||
"Cannot apply expression of type ~a, since it is not a function type" f-ty)]))
|
||||
|
|
Loading…
Reference in New Issue
Block a user