forked from VimPlug/jedi
Fix: elifs where not considered for isinstance type inference.
This commit is contained in:
@@ -451,7 +451,6 @@ class Script(object):
|
|||||||
|
|
||||||
if next(context) in ('class', 'def'):
|
if next(context) in ('class', 'def'):
|
||||||
# The cursor is on a class/function name.
|
# The cursor is on a class/function name.
|
||||||
user_scope = self._parser.user_scope()
|
|
||||||
definitions = set([user_scope.name])
|
definitions = set([user_scope.name])
|
||||||
elif isinstance(user_stmt, tree.Import):
|
elif isinstance(user_stmt, tree.Import):
|
||||||
s, name = helpers.get_on_import_stmt(self._evaluator,
|
s, name = helpers.get_on_import_stmt(self._evaluator,
|
||||||
|
|||||||
@@ -433,8 +433,10 @@ def check_flow_information(evaluator, flow, search_name, pos):
|
|||||||
break
|
break
|
||||||
|
|
||||||
if isinstance(flow, (tree.IfStmt, tree.WhileStmt)):
|
if isinstance(flow, (tree.IfStmt, tree.WhileStmt)):
|
||||||
element = flow.children[1]
|
potential_ifs = [c for c in flow.children[1::4] if c != ':']
|
||||||
result = _check_isinstance_type(evaluator, element, search_name)
|
for if_test in reversed(potential_ifs):
|
||||||
|
if search_name.start_pos > if_test.end_pos:
|
||||||
|
return _check_isinstance_type(evaluator, if_test, search_name)
|
||||||
return result
|
return result
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -61,6 +61,9 @@ def isinstance_func(arr):
|
|||||||
# Shouldn't fail, even with the dot.
|
# Shouldn't fail, even with the dot.
|
||||||
#? 17 dict()
|
#? 17 dict()
|
||||||
value.
|
value.
|
||||||
|
elif isinstance(value, int):
|
||||||
|
#? int()
|
||||||
|
value
|
||||||
|
|
||||||
# -----------------
|
# -----------------
|
||||||
# Names with multiple indices.
|
# Names with multiple indices.
|
||||||
|
|||||||
Reference in New Issue
Block a user