diff --git a/jedi/evaluate/dynamic.py b/jedi/evaluate/dynamic.py index 5e0777e9..7dfdc530 100644 --- a/jedi/evaluate/dynamic.py +++ b/jedi/evaluate/dynamic.py @@ -88,13 +88,13 @@ def search_params(evaluator, param): if trailer is not None: types = evaluator.goto_definition(name) - # TODO why not a direct comparison? functions seem to be - # decorated in types and not in compare... - undecorated = [escope.decorates or escope for escope in types - if escope.isinstance(er.Function, er.Class)] - c = [getattr(escope, 'base_func', None) or escope.base - for escope in undecorated] - if compare in c: + # We have to remove decorators, because they are not the + # "original" functions, this way we can easily compare. + # At the same time we also have to remove InstanceElements. + undec = [escope.decorates or + (escope.var if isinstance(escope, er.InstanceElement) else escope) + for escope in types if escope.isinstance(er.Function, er.Class)] + if er.wrap(evaluator, compare) in undec: # Only if we have the correct function we execute # it, otherwise just ignore it. evaluator.eval_trailer(types, trailer) diff --git a/jedi/evaluate/representation.py b/jedi/evaluate/representation.py index 309171ea..9b54bb25 100644 --- a/jedi/evaluate/representation.py +++ b/jedi/evaluate/representation.py @@ -504,7 +504,7 @@ class Function(use_metaclass(CachedMetaClass, Wrapper)): debug.dbg('decorator end %s', f) if isinstance(f, pr.Function): - f = Function(self._evaluator, f, True) + return self return f def get_decorated_func(self):