mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
report missing value expression in dict literal as error (PY-2791)
This commit is contained in:
@@ -219,6 +219,7 @@ public class ExpressionParsing extends Parsing {
|
||||
}
|
||||
checkMatches(PyTokenTypes.COLON, message("PARSE.expected.colon"));
|
||||
if (!parseSingleExpression(false)) {
|
||||
myBuilder.error("value expression expected");
|
||||
marker.drop();
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
dl = {key1: value1, key2:}
|
||||
@@ -0,0 +1,24 @@
|
||||
PyFile:DictMissingValue.py
|
||||
PyAssignmentStatement
|
||||
PyTargetExpression: dl
|
||||
PsiElement(Py:IDENTIFIER)('dl')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(Py:EQ)('=')
|
||||
PsiWhiteSpace(' ')
|
||||
PyDictLiteralExpression
|
||||
PsiElement(Py:LBRACE)('{')
|
||||
PyKeyValueExpression
|
||||
PyReferenceExpression: key1
|
||||
PsiElement(Py:IDENTIFIER)('key1')
|
||||
PsiElement(Py:COLON)(':')
|
||||
PsiWhiteSpace(' ')
|
||||
PyReferenceExpression: value1
|
||||
PsiElement(Py:IDENTIFIER)('value1')
|
||||
PsiElement(Py:COMMA)(',')
|
||||
PsiWhiteSpace(' ')
|
||||
PyReferenceExpression: key2
|
||||
PsiElement(Py:IDENTIFIER)('key2')
|
||||
PsiElement(Py:COLON)(':')
|
||||
PsiErrorElement:value expression expected
|
||||
<empty list>
|
||||
PsiElement(Py:RBRACE)('}')
|
||||
@@ -247,6 +247,10 @@ public class PythonParsingTest extends ParsingTestCase {
|
||||
doTest();
|
||||
}
|
||||
|
||||
public void testDictMissingValue() { // PY-2791
|
||||
doTest();
|
||||
}
|
||||
|
||||
public void doTest() {
|
||||
doTest(LanguageLevel.PYTHON25);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user