typed-racket icon indicating copy to clipboard operation
typed-racket copied to clipboard

`Nothing` should be used to populate the type of the polymorphic function which has rest arguments.

Open NoahStoryM opened this issue 3 years ago • 0 comments

What version of Racket are you using?

v8.4 [cs]

What program did you run?

> '()
- : Null
'()
> (list)
- : Null
'()
> (apply list '())
- : (Listof Nothing)
'()
> #hash()
- : (Immutable-HashTable Any Any)
'#hash()
> (hash)
- : (Immutable-HashTable Any Any)
'#hash()
> (apply hash '())
- : (Immutable-HashTable Nothing Nothing)
'#hash()

What should have happened?

> #hash()
- : (Immutable-HashTable Nothing Nothing)
'#hash()
> (hash)
- : (Immutable-HashTable Nothing Nothing)
'#hash()

More.

The problem should be in the call to the polymorphic function which has rest arguments.

> (: test0 (All (A) [-> A * (Listof A)]))
> (define test0
    (λ args
      (apply list args)))
> (test0)
- : (Listof Any)
'()
> (apply test0 '())
- : (Listof Nothing)
'()

NoahStoryM avatar Mar 01 '22 03:03 NoahStoryM