Pylance outputs incorrect inferred type list | Any
even when the type annotation is list
#4936
Labels
needs repro
Issue has not been reproduced yet
Environment data
Code Snippet
Repro Steps
result
in functiontolist_func
.result
in functiontolist_func_with_any
.Expected behavior
I expect all of the inferred types of the two variables to be
list
.Actual behavior
For the function
tolist_func
, the variableresult
's inferred type isAny | list
, while the second one islist
.This is strange for me. As far as I know, when not annotated, the
array
will implicitly hasAny
type, so the two inferred types should consent. And I think the correct inferred type should belist
.Logs
The text was updated successfully, but these errors were encountered: