From cc953ffff08c05e7327f86ec1b23fa9034dfb651 Mon Sep 17 00:00:00 2001 From: Dave Halter Date: Wed, 13 Jul 2016 19:15:28 +0200 Subject: [PATCH] Goto on trailers wasn't correct. Fixes #571. --- jedi/evaluate/__init__.py | 2 +- test/completion/goto.py | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/jedi/evaluate/__init__.py b/jedi/evaluate/__init__.py index 0e6b2986..c1532ae1 100644 --- a/jedi/evaluate/__init__.py +++ b/jedi/evaluate/__init__.py @@ -516,7 +516,7 @@ class Evaluator(object): )) scope = name.get_parent_scope() - if tree.is_node(name.parent, 'trailer'): + if tree.is_node(name.parent, 'trailer') and name.parent.children[0] == '.': call = helpers.call_of_leaf(name, cut_own_trailer=True) types = self.eval_element(call) return resolve_implicit_imports(iterable.unite( diff --git a/test/completion/goto.py b/test/completion/goto.py index 84bcc2c8..4e178af1 100644 --- a/test/completion/goto.py +++ b/test/completion/goto.py @@ -30,6 +30,12 @@ b = math #! ['b = math'] b +#! 18 ['foo = 10'] +foo = 10;print(foo) + +# ----------------- +# classes +# ----------------- class C(object): def b(self): #! ['b = math']