Skip to content

call with keyword incorrectly checks function type #942

@bdeket

Description

@bdeket

What version of Racket are you using?

7.7.0.9 (also tested with 7.7.0.7)

What program did you run?

#lang typed/racket/base

(define (root-split [alg : Integer]
                    [make-mid : (-> Integer Integer Integer)]
                    #:checkΔ [Δfct : (-> Integer)#;(λ () 1)]
                    ) : Integer
  (make-mid 0 0)
  1)

(define (test)
  (root-split 1
              (λ ([lst : (Listof (List Integer Integer))]): Integer 1)
              #:checkΔ (λ () 1)))

What should have happened?

Type Checker: type mismatch

extra

Removing argument alg (definition and call) does trigger the typechecker to fail,
Removing the kw of the third argument also triggers the error

adding or removing the optional part of this kw-argument or writing the type with:
(: root-split (->* (Integer (-> Integer Integer Integer) #:check (-> Integer))() Integer))
or
(: root-split (->* (Integer (-> Integer Integer Integer))(#:check (-> Integer)) Integer))
have no effect (ie it type checks)

the call to root-split doesn't need to be in (test), but if not then running the file will immediately trigger a runtime error

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions