Make keyword methods type-check
Note: send does not work with keyword methods yet
This commit is contained in:
parent
4e5d0846ba
commit
5da60f7067
|
@ -794,6 +794,20 @@
|
||||||
(#%plain-lambda (#,annotated-self-param id ...)
|
(#%plain-lambda (#,annotated-self-param id ...)
|
||||||
body ...)])
|
body ...)])
|
||||||
m)]
|
m)]
|
||||||
|
[(let-values ([(meth-name:id)
|
||||||
|
(let-values (((core:id)
|
||||||
|
(#%plain-lambda (param:id ...)
|
||||||
|
core-body ...)))
|
||||||
|
method-body ...)])
|
||||||
|
m)
|
||||||
|
#`(let-values ([(#,(syntax-property #'meth-name 'type-label method-type))
|
||||||
|
#,(syntax-property
|
||||||
|
#'(let-values (((core)
|
||||||
|
(#%plain-lambda (param ...)
|
||||||
|
core-body ...)))
|
||||||
|
method-body ...)
|
||||||
|
'kw-lambda #t)])
|
||||||
|
m)]
|
||||||
[_ (tc-error "annotate-method: internal error")]))
|
[_ (tc-error "annotate-method: internal error")]))
|
||||||
|
|
||||||
;; Set<Symbol> Set<Symbol> String -> Void
|
;; Set<Symbol> Set<Symbol> String -> Void
|
||||||
|
|
|
@ -516,6 +516,16 @@
|
||||||
(inherit m)
|
(inherit m)
|
||||||
(m "foo")))
|
(m "foo")))
|
||||||
|
|
||||||
|
;; test that keyword methods type-check
|
||||||
|
;; FIXME: send with keywords does not work yet
|
||||||
|
(check-ok
|
||||||
|
(: c% (Class [n (Integer #:foo Integer -> Integer)]))
|
||||||
|
(define c%
|
||||||
|
(class: object%
|
||||||
|
(super-new)
|
||||||
|
(define/public (n x #:foo foo)
|
||||||
|
(+ foo x)))))
|
||||||
|
|
||||||
;; test different internal/external names
|
;; test different internal/external names
|
||||||
(check-ok
|
(check-ok
|
||||||
(define c% (class: object% (super-new)
|
(define c% (class: object% (super-new)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user