-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Open
Labels
Description
Hello, concerning the function below:
from typing import List
def foo() -> List[int]:
listings = None
if 2 != 2:
listings = list()
listings.append(1)
return listings
I expected:
Incompatible return value type (got "Optional[List[int]]", expected "List[int]")
I got no error
This one does throw the expected error (same config):
from typing import List
def foo() -> List[int]:
listings = None
if 2 != 2:
listings = [1]
return listings
running mypy 0.770 on python 3.8
I would appreciate it if you could tell me if I am doing something wrong :)
Have a good day !
Reactions are currently unavailable