mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
complain about missing default value of a function argument (PY-3253)
This commit is contained in:
@@ -148,7 +148,9 @@ public class FunctionParsing extends Parsing {
|
||||
annotationMarker.done(PyElementTypes.ANNOTATION);
|
||||
}
|
||||
if (!isStarParameter && matchToken(PyTokenTypes.EQ)) {
|
||||
getExpressionParser().parseSingleExpression(false);
|
||||
if (!getExpressionParser().parseSingleExpression(false)) {
|
||||
myBuilder.error(message("PARSE.expected.expression"));
|
||||
}
|
||||
}
|
||||
parameter.done(PyElementTypes.NAMED_PARAMETER);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,2 @@
|
||||
def fa(a=):
|
||||
pass
|
||||
@@ -0,0 +1,18 @@
|
||||
PyFile:MissingDefaultValue.py
|
||||
PyFunction('fa')
|
||||
PsiElement(Py:DEF_KEYWORD)('def')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(Py:IDENTIFIER)('fa')
|
||||
PyParameterList
|
||||
PsiElement(Py:LPAR)('(')
|
||||
PyNamedParameter('a')
|
||||
PsiElement(Py:IDENTIFIER)('a')
|
||||
PsiElement(Py:EQ)('=')
|
||||
PsiErrorElement:expression expected
|
||||
<empty list>
|
||||
PsiElement(Py:RPAR)(')')
|
||||
PsiElement(Py:COLON)(':')
|
||||
PsiWhiteSpace('\n ')
|
||||
PyStatementList
|
||||
PyPassStatement
|
||||
PsiElement(Py:PASS_KEYWORD)('pass')
|
||||
@@ -263,6 +263,10 @@ public class PythonParsingTest extends ParsingTestCase {
|
||||
doTest();
|
||||
}
|
||||
|
||||
public void testMissingDefaultValue() { // PY-3253
|
||||
doTest();
|
||||
}
|
||||
|
||||
public void doTest() {
|
||||
doTest(LanguageLevel.PYTHON25);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user