Skip to content

TR fails to type check optional lambdas with type annotations #997

Open
@capfredf

Description

@capfredf

What version of Racket are you using?

Racket[cs] 7.9.0.5 on 56560736379fba7b4d72d97f29f46fa0cbf15b85

What program did you run?

(: append-bar (->* () (Natural) #:rest Any String))
(define (append-bar [how-many 1] . rst)
    (apply string-append "hi" (make-list how-many "bar"))

What should have happened?

The program should typecheck

If you got an error message, please include it here.

Type Checker: Expected a function of type (-> Nothing String), but got a function with the wrong arity
;   in: (define (append-bar (how-many 1) . rst) (apply string-append "hi" (make-list how-many "bar")))

OTOH, the same function with in-line annotation makes the typechecker happy.

(define (append-bar2 [how-many : Natural 1] . [rst : Any *]) : String
    (apply string-append "hi" (make-list how-many "bar")))

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions