Make keyword methods type-check

Note: send does not work with keyword methods yet
This commit is contained in:
Asumu Takikawa 2013-05-23 16:07:47 -04:00
parent 4e5d0846ba
commit 5da60f7067
2 changed files with 24 additions and 0 deletions

View File

@ -794,6 +794,20 @@
(#%plain-lambda (#,annotated-self-param id ...)
body ...)])
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")]))
;; Set<Symbol> Set<Symbol> String -> Void

View File

@ -516,6 +516,16 @@
(inherit m)
(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
(check-ok
(define c% (class: object% (super-new)