-
Notifications
You must be signed in to change notification settings - Fork 135
Milestone
Description
It would be great if we could infer return types for functions where it is not annotated
def f(x: int, y: str):
if x > 10:
return x
elif x > 5:
return y
reveal_type(f(some_int, "a")) # ideally: int | str | NoneIt seems like it would simply be a union of all reachable return expressions (and possible None, if the function can implicitly return it — we already have functionality to detect that).
mtshiba, T-256, Avasam, DetachHead, u5184407 and 4 moresterliakov
Metadata
Metadata
Assignees
Labels
No labels