You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fromtypingimportUniondeffoo(key: str, val: dict[str, int] =None) ->int:
ifvalisNone:
return0else:
defbar() ->int:
returnval[key] # error: Value of type "Optional[Dict[str, int]]" is not indexable [index]returnbar()
deffoo(val: Union[list[int], int]) ->int:
ifisinstance(val, list):
defbar() ->int:
returnval[0] # error: Value of type "Union[List[int], int]" is not indexable [index]returnbar()
val: Union[list[int], int] = [1]
assertisinstance(val, list)
deffoo() ->int:
returnval[0] # error: Value of type "Union[List[int], int]" is not indexable [index]
Type information established in the local scope in which a function is defined is not propagated to the closure of the function.
The text was updated successfully, but these errors were encountered:
Type information established in the local scope in which a function is defined is not propagated to the closure of the function.
The text was updated successfully, but these errors were encountered: