Change TR's "untyped identifier" error messages
This commit is contained in:
parent
343ac52607
commit
d62eedaa47
|
@ -36,15 +36,31 @@
|
||||||
;; error for unbound variables
|
;; error for unbound variables
|
||||||
(define (lookup-fail e)
|
(define (lookup-fail e)
|
||||||
(match (identifier-binding e)
|
(match (identifier-binding e)
|
||||||
['lexical (tc-error/expr "untyped identifier ~a" (syntax-e e))]
|
['lexical (tc-error/expr/fields "missing type for identifier"
|
||||||
|
#:more "consider adding a type annotation with `:'"
|
||||||
|
"identifier" (syntax-e e))]
|
||||||
[#f (tc-error/expr "untyped top-level identifier ~a" (syntax-e e))]
|
[#f (tc-error/expr "untyped top-level identifier ~a" (syntax-e e))]
|
||||||
[(list _ _ nominal-source-mod nominal-source-id _ _ _)
|
[(list _ _ nominal-source-mod nominal-source-id _ _ _)
|
||||||
(let-values ([(x y) (module-path-index-split nominal-source-mod)])
|
(define-values (mod-path base-path)
|
||||||
(cond [(and (not x) (not y))
|
(module-path-index-split nominal-source-mod))
|
||||||
(tc-error/expr "untyped identifier ~a" (syntax-e e))]
|
(cond [(and (not mod-path) (not base-path))
|
||||||
[else
|
(tc-error/expr/fields "missing type for identifier"
|
||||||
(tc-error/expr "untyped identifier ~a imported from module <~a>"
|
#:more "consider adding a type annotation with `:'"
|
||||||
(syntax-e e) x)]))]))
|
"identifier" (syntax-e e))]
|
||||||
|
[(equal? mod-path '(lib "typed/racket"))
|
||||||
|
(tc-error/expr/fields
|
||||||
|
"missing type for identifier"
|
||||||
|
#:more
|
||||||
|
(string-append "The `racket' language does not seem"
|
||||||
|
" to have a type for this identifier;"
|
||||||
|
" please file a bug report")
|
||||||
|
"identifier" (syntax-e e)
|
||||||
|
"from module" mod-path)]
|
||||||
|
[else
|
||||||
|
(tc-error/expr/fields "missing type for identifier"
|
||||||
|
#:more "consider using `require/typed' to import it"
|
||||||
|
"identifier" (syntax-e e)
|
||||||
|
"from module" mod-path)])]))
|
||||||
|
|
||||||
(define (lookup-type-fail i)
|
(define (lookup-type-fail i)
|
||||||
(tc-error/expr "~a is not bound as a type" (syntax-e i)))
|
(tc-error/expr "~a is not bound as a type" (syntax-e i)))
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
#;
|
#;
|
||||||
(exn-pred ".*untyped identifier map.*" ".*srfi.*")
|
(exn-pred ".*identifier: map.*" ".*srfi.*")
|
||||||
#lang typed-scheme
|
#lang typed-scheme
|
||||||
|
|
||||||
(require srfi/1)
|
(require srfi/1)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user