-
-
Notifications
You must be signed in to change notification settings - Fork 3k
Closed
Description
Currently this program produces the error List item 0 has incompatible type "float":
from typing import List
def f(x: List[int]) -> None: ...
f([1.0]) # ErrorThis can be confusing, especially if the types are more complicated. The message doesn't tell what is expected, and the function definition can be hard to find, for example if it's in a stub. A better message would be something like this:
prog.py:3: error: List item 0 has incompatible type "float" (expected "int")
The same issue may also applies to dictionaries:
prog.py:3: error: Dict entry 0 has incompatible type "int": "int"