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 ...)
|
||||
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
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Reference in New Issue
Block a user