forked from VimPlug/jedi
Do a bit better class matching, it's not good yet, but we'll get there.
This commit is contained in:
@@ -306,10 +306,12 @@ class OverloadedFunctionContext(object):
|
||||
for f in self._overloaded_functions:
|
||||
signature = parser_utils.get_call_signature(f.tree_node)
|
||||
if signature_matches(f, arguments):
|
||||
debug.dbg("Overloading - signature %s matches", signature, color='BLUE')
|
||||
debug.dbg("Overloading - signature %s@%s matches",
|
||||
signature, f.tree_node.start_pos[0], color='BLUE')
|
||||
context_set |= f.py__call__(arguments=arguments)
|
||||
else:
|
||||
debug.dbg("Overloading - signature %s doesn't match", signature, color='BLUE')
|
||||
debug.dbg("Overloading - signature %s@%s doesn't match with (%s)",
|
||||
signature, f.tree_node.start_pos[0], arguments, color='BLUE')
|
||||
return context_set
|
||||
|
||||
def __getattr__(self, name):
|
||||
@@ -339,6 +341,12 @@ def signature_matches(function_context, arguments):
|
||||
|
||||
|
||||
def has_same_class(context_set1, context_set2):
|
||||
for c1 in context_set1:
|
||||
for c2 in context_set2:
|
||||
if c1.name.string_name == c2.name.string_name:
|
||||
# TODO This is wrong, it doesn't account for a lot of things.
|
||||
return True
|
||||
|
||||
return bool(context_set1 & context_set2)
|
||||
|
||||
|
||||
|
||||
@@ -490,3 +490,6 @@ class InstanceArguments(AbstractArguments):
|
||||
return self._var_args.get_executed_params(execution_context)
|
||||
|
||||
return super(InstanceArguments, self).get_executed_params(execution_context)
|
||||
|
||||
def __repr__(self):
|
||||
return '<%s: %s>' % (self.__class__.__name__, self._var_args)
|
||||
|
||||
@@ -212,7 +212,9 @@ def _find_type_alias_class(evaluator, module_context, module_name, class_name):
|
||||
classes = module.py__getattribute__(class_name)
|
||||
# There should only be one, because it's code that we control.
|
||||
assert len(classes) == 1, classes
|
||||
return next(iter(classes))
|
||||
cls = next(iter(classes))
|
||||
assert isinstance(cls, ClassContext), cls
|
||||
return cls
|
||||
|
||||
|
||||
class _ContainerBase(_WithIndexBase):
|
||||
|
||||
@@ -40,6 +40,8 @@ def we_can_has_sequence(p, q, r, s, t, u):
|
||||
t[1]
|
||||
#? ["append"]
|
||||
u.a
|
||||
#?
|
||||
u[1.0]
|
||||
#? float()
|
||||
u[1]
|
||||
|
||||
|
||||
Reference in New Issue
Block a user