mirror of
https://github.com/davidhalter/jedi.git
synced 2025-12-08 06:44:46 +08:00
Fix an error recovery goto issue, fixes davidhalter/jedi-vim#962
This commit is contained in:
@@ -12,7 +12,6 @@ arguments.
|
||||
import os
|
||||
import sys
|
||||
import warnings
|
||||
import keyword
|
||||
|
||||
import parso
|
||||
from parso.python import tree
|
||||
|
||||
@@ -94,7 +94,7 @@ def infer_call_of_leaf(context, leaf, cut_own_trailer=False):
|
||||
base = power.children[start]
|
||||
if base.type != 'trailer':
|
||||
break
|
||||
trailers = power.children[start + 1: index + 1]
|
||||
trailers = power.children[start + 1:cut]
|
||||
else:
|
||||
base = power.children[0]
|
||||
trailers = power.children[1:cut]
|
||||
|
||||
@@ -618,4 +618,3 @@ def follow_error_node_imports_if_possible(context, name):
|
||||
return Importer(
|
||||
context.inference_state, names, context.get_root_context(), level).follow()
|
||||
return None
|
||||
|
||||
|
||||
@@ -607,3 +607,17 @@ DefaultArg().y()
|
||||
DefaultArg.x()
|
||||
#? str()
|
||||
DefaultArg.y()
|
||||
|
||||
|
||||
# -----------------
|
||||
# Error Recovery
|
||||
# -----------------
|
||||
|
||||
from import_tree.pkg.base import MyBase
|
||||
|
||||
class C1(MyBase):
|
||||
def f3(self):
|
||||
#! 13 ['def f1']
|
||||
self.f1() . # hey'''
|
||||
#? 13 MyBase.f1
|
||||
self.f1() . # hey'''
|
||||
|
||||
@@ -37,6 +37,7 @@ foo = 10;print(foo)
|
||||
# classes
|
||||
# -----------------
|
||||
class C(object):
|
||||
x = 3
|
||||
def b(self):
|
||||
#! ['b = math']
|
||||
b
|
||||
@@ -44,8 +45,14 @@ class C(object):
|
||||
self.b
|
||||
#! 14 ['def b']
|
||||
self.b()
|
||||
#! 14 ['def b']
|
||||
self.b.
|
||||
#! 11 ['param self']
|
||||
self.b
|
||||
#! ['x = 3']
|
||||
self.x
|
||||
#! 14 ['x = 3']
|
||||
self.x.
|
||||
return 1
|
||||
|
||||
#! ['def b']
|
||||
|
||||
3
test/completion/import_tree/pkg/base.py
Normal file
3
test/completion/import_tree/pkg/base.py
Normal file
@@ -0,0 +1,3 @@
|
||||
class MyBase:
|
||||
def f1(self):
|
||||
pass
|
||||
@@ -13,7 +13,7 @@ from parso import cache
|
||||
from jedi._compatibility import unicode
|
||||
from jedi import preload_module
|
||||
from jedi.inference.gradual import typeshed
|
||||
from test.helpers import test_dir
|
||||
from test.helpers import test_dir, get_example_dir
|
||||
|
||||
|
||||
@pytest.mark.skipif(sys.version_info[0] == 2, reason="Ignore Python 2, EoL")
|
||||
|
||||
Reference in New Issue
Block a user