diff --git a/jedi/inference/base_value.py b/jedi/inference/base_value.py index 60971e4d..57f74c1a 100644 --- a/jedi/inference/base_value.py +++ b/jedi/inference/base_value.py @@ -252,7 +252,7 @@ class Value(HelperValueMixin, BaseValue): return self.parent_context.is_stub() def _as_context(self): - raise NotImplementedError('Not all values need to be converted to contexts') + raise NotImplementedError('Not all values need to be converted to contexts: %s', self) def iterate_values(values, contextualized_node=None, is_async=False): diff --git a/jedi/inference/names.py b/jedi/inference/names.py index 67826be2..69d466e7 100644 --- a/jedi/inference/names.py +++ b/jedi/inference/names.py @@ -165,7 +165,7 @@ class AbstractTreeName(AbstractNameDefinition): new_dotted.children[index - 1:] = [] values = context.infer_node(new_dotted) return unite( - value.goto(name, name_context=value.as_context()) + value.goto(name, name_context=context) for value in values ) diff --git a/test/completion/decorators.py b/test/completion/decorators.py index a61487a3..7fce91da 100644 --- a/test/completion/decorators.py +++ b/test/completion/decorators.py @@ -330,3 +330,16 @@ import abc #? ['abstractmethod'] @abc.abstractmethod + +# ----------------- +# Goto +# ----------------- +x = 1 + +#! 5 [] +@x.foo() +def f(): pass + +#! 1 ['x = 1'] +@x.foo() +def f(): pass