mirror of
https://github.com/davidhalter/jedi.git
synced 2025-12-07 22:44:27 +08:00
invalid.py test changes. Error recovery will be different from the old one.
This commit is contained in:
@@ -215,7 +215,7 @@ class Parser(object):
|
||||
if symbol in ('file_input', 'suite'):
|
||||
break
|
||||
# No success finding a transition
|
||||
print('err', tokenize.tok_name[typ], repr(value), start_pos, len(stack), index)
|
||||
#print('err', tokenize.tok_name[typ], repr(value), start_pos, len(stack), index)
|
||||
self._stack_removal(grammar, stack, index + 1, value, start_pos)
|
||||
# Those can always be new statements.
|
||||
if value in ('import', 'from', 'class', 'def', 'try', 'while', 'return'):
|
||||
@@ -223,6 +223,7 @@ class Parser(object):
|
||||
elif typ == tokenize.DEDENT:
|
||||
if symbol == 'suite':
|
||||
if len(nodes) > 2:
|
||||
# Finish the suite.
|
||||
add_token_callback(typ, value, prefix, start_pos)
|
||||
else:
|
||||
# If a function or anything else contains a suite that is
|
||||
@@ -250,6 +251,7 @@ class Parser(object):
|
||||
if found:
|
||||
symbol = grammar.number2symbol[typ]
|
||||
failed_stack.append((symbol, nodes))
|
||||
if failed_stack:
|
||||
err = ErrorStatement(failed_stack, value, start_pos)
|
||||
self.error_statement_stacks.append(err)
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@ there should never be any errors.
|
||||
##? 5
|
||||
's'()
|
||||
|
||||
#? ['upper']
|
||||
#? []
|
||||
str()).upper
|
||||
|
||||
# -----------------
|
||||
@@ -19,16 +19,24 @@ str()).upper
|
||||
def asdf(a or b): # multiple param names
|
||||
return a
|
||||
|
||||
#? int()
|
||||
#?
|
||||
asdf(2)
|
||||
|
||||
asdf = ''
|
||||
|
||||
from a import (b
|
||||
def blub():
|
||||
return 0
|
||||
def openbrace():
|
||||
def wrong_indents():
|
||||
asdf = 3
|
||||
asdf
|
||||
asdf(
|
||||
# doesn't work because of the indent issues.
|
||||
#? str()
|
||||
asdf
|
||||
def openbrace():
|
||||
asdf = 3
|
||||
asdf(
|
||||
#? int()
|
||||
asdf
|
||||
return 1
|
||||
@@ -58,7 +66,7 @@ normalfunc()
|
||||
# dots in param
|
||||
def f(seq1...=None):
|
||||
return seq1
|
||||
#? int()
|
||||
#?
|
||||
f(1)
|
||||
|
||||
@
|
||||
@@ -97,13 +105,15 @@ try:
|
||||
""
|
||||
|
||||
# wrong ternary expression
|
||||
a = ''
|
||||
a = 1 if
|
||||
#? int()
|
||||
#? str()
|
||||
a
|
||||
|
||||
# No completions for for loops without the right syntax
|
||||
for for_local in :
|
||||
for_local
|
||||
#? ['for_local']
|
||||
#? []
|
||||
for_local
|
||||
#?
|
||||
for_local
|
||||
@@ -122,7 +132,7 @@ a3 = [for xyz in]
|
||||
a3[0]
|
||||
|
||||
a3 = [a4 for in 'b']
|
||||
#? str()
|
||||
#?
|
||||
a3[0]
|
||||
|
||||
a3 = [a4 for a in for x in y]
|
||||
@@ -140,7 +150,7 @@ def break(): pass
|
||||
#? int()
|
||||
a[0]
|
||||
|
||||
#? ['real']
|
||||
#? []
|
||||
int()).real
|
||||
|
||||
# -----------------
|
||||
@@ -165,14 +175,14 @@ import datetime as
|
||||
|
||||
call = ''
|
||||
invalid = .call
|
||||
#? str()
|
||||
#?
|
||||
invalid
|
||||
|
||||
invalid = call?.call
|
||||
#? str()
|
||||
#?
|
||||
invalid
|
||||
|
||||
# comma
|
||||
invalid = ,call
|
||||
#? str()
|
||||
#?
|
||||
invalid
|
||||
|
||||
Reference in New Issue
Block a user