forked from VimPlug/jedi
Fix contextualizing of subscriptlist
This commit is contained in:
@@ -406,7 +406,7 @@ def _infer_expr_stmt(context, stmt, seek_name=None):
|
|||||||
|
|
||||||
if is_setitem:
|
if is_setitem:
|
||||||
def to_mod(v):
|
def to_mod(v):
|
||||||
c = ContextualizedNode(context, subscriptlist)
|
c = ContextualizedSubscriptListNode(context, subscriptlist)
|
||||||
if v.array_type == 'dict':
|
if v.array_type == 'dict':
|
||||||
return DictModification(v, value_set, c)
|
return DictModification(v, value_set, c)
|
||||||
elif v.array_type == 'list':
|
elif v.array_type == 'list':
|
||||||
@@ -803,6 +803,11 @@ def check_tuple_assignments(name, value_set):
|
|||||||
return value_set
|
return value_set
|
||||||
|
|
||||||
|
|
||||||
|
class ContextualizedSubscriptListNode(ContextualizedNode):
|
||||||
|
def infer(self):
|
||||||
|
return _infer_subscript_list(self.context, self.node)
|
||||||
|
|
||||||
|
|
||||||
def _infer_subscript_list(context, index):
|
def _infer_subscript_list(context, index):
|
||||||
"""
|
"""
|
||||||
Handles slices in subscript nodes.
|
Handles slices in subscript nodes.
|
||||||
|
|||||||
@@ -335,6 +335,11 @@ some_lst2[3]
|
|||||||
#? int() str()
|
#? int() str()
|
||||||
some_lst2[2]
|
some_lst2[2]
|
||||||
|
|
||||||
|
some_lst3 = []
|
||||||
|
some_lst3[0] = 3
|
||||||
|
some_lst3[:] = '' # Is ignored for now.
|
||||||
|
#? int()
|
||||||
|
some_lst3[0]
|
||||||
# -----------------
|
# -----------------
|
||||||
# set setitem/other modifications (should not work)
|
# set setitem/other modifications (should not work)
|
||||||
# -----------------
|
# -----------------
|
||||||
|
|||||||
Reference in New Issue
Block a user