Improve several type error messages
In particular, improve the syntax reported when the method arity is wrong.
This commit is contained in:
parent
0d498e18e7
commit
6cdc5fb720
|
@ -186,7 +186,7 @@
|
||||||
super-methods super-augments))
|
super-methods super-augments))
|
||||||
(values super-inits super-fields super-methods super-augments)]
|
(values super-inits super-fields super-methods super-augments)]
|
||||||
[(tc-result1: t)
|
[(tc-result1: t)
|
||||||
(tc-error/expr "expected a superclass but got ~a" t
|
(tc-error/expr "expected a superclass but got value of type ~a" t
|
||||||
#:stx #'cls.superclass-expr)
|
#:stx #'cls.superclass-expr)
|
||||||
;; FIXME: is this the right thing to do?
|
;; FIXME: is this the right thing to do?
|
||||||
(values null null null null)]))
|
(values null null null null)]))
|
||||||
|
@ -994,8 +994,11 @@
|
||||||
(define annotated-self-param
|
(define annotated-self-param
|
||||||
(type-ascription-property #'self-param self-type))
|
(type-ascription-property #'self-param self-type))
|
||||||
#`(let-values ([(#,(syntax-property #'meth-name 'type-label method-type))
|
#`(let-values ([(#,(syntax-property #'meth-name 'type-label method-type))
|
||||||
(#%plain-lambda (#,annotated-self-param id ...)
|
;; attach source location to the lambda in order to
|
||||||
body ...)])
|
;; obtain better error messages for arity errors
|
||||||
|
#,(quasisyntax/loc stx
|
||||||
|
(#%plain-lambda (#,annotated-self-param id ...)
|
||||||
|
body ...))])
|
||||||
m)]
|
m)]
|
||||||
[(let-values ([(meth-name:id)
|
[(let-values ([(meth-name:id)
|
||||||
(let-values (((core:id)
|
(let-values (((core:id)
|
||||||
|
@ -1005,9 +1008,11 @@
|
||||||
m)
|
m)
|
||||||
#`(let-values ([(#,(syntax-property #'meth-name 'type-label method-type))
|
#`(let-values ([(#,(syntax-property #'meth-name 'type-label method-type))
|
||||||
#,(syntax-property
|
#,(syntax-property
|
||||||
#'(let-values (((core)
|
#`(let-values (((core)
|
||||||
(#%plain-lambda (param ...)
|
;; see comment above
|
||||||
core-body ...)))
|
#,(quasisyntax/loc stx
|
||||||
|
(#%plain-lambda (param ...)
|
||||||
|
core-body ...))))
|
||||||
method-body ...)
|
method-body ...)
|
||||||
'kw-lambda #t)])
|
'kw-lambda #t)])
|
||||||
m)]
|
m)]
|
||||||
|
|
Loading…
Reference in New Issue
Block a user