mypy icon indicating copy to clipboard operation
mypy copied to clipboard

`no-untyped-call` false positive when calling lambda with no input parameters

Open DetachHead opened this issue 3 years ago • 0 comments

from typing import Callable
(lambda: 1)()  # no error
a = lambda: 1
b: Callable[[], int] = lambda: 1
reveal_type(a)  # Revealed type is "def () -> builtins.int"
reveal_type(b)  # Revealed type is "def () -> builtins.int"
a()  # error: Call to untyped function (unknown) in typed context  [no-untyped-call]
b()  # no error

playground

kinda related: #5069

DetachHead avatar Jan 20 '23 05:01 DetachHead