Fix () to be a 0-ary tuple, not empty PARENTHESIZED
This commit is contained in:
@@ -1233,11 +1233,11 @@ public class JetExpressionParsing extends AbstractJetParsing {
|
|||||||
|
|
||||||
myBuilder.disableNewlines();
|
myBuilder.disableNewlines();
|
||||||
advance(); // LPAR
|
advance(); // LPAR
|
||||||
int commaPassed = 0;
|
boolean tuple = false;
|
||||||
if (!at(RPAR)) {
|
if (!at(RPAR)) {
|
||||||
while (true) {
|
while (true) {
|
||||||
while (at(COMMA)) {
|
while (at(COMMA)) {
|
||||||
commaPassed++;
|
tuple = true;
|
||||||
errorAndAdvance("Expecting a tuple entry (expression)");
|
errorAndAdvance("Expecting a tuple entry (expression)");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1245,19 +1245,21 @@ public class JetExpressionParsing extends AbstractJetParsing {
|
|||||||
|
|
||||||
if (!at(COMMA)) break;
|
if (!at(COMMA)) break;
|
||||||
advance(); // COMMA
|
advance(); // COMMA
|
||||||
commaPassed++;
|
tuple = true;
|
||||||
|
|
||||||
if (at(RPAR)) {
|
if (at(RPAR)) {
|
||||||
error("Expecting a tuple entry (expression)");
|
error("Expecting a tuple entry (expression)");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
tuple = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
expect(RPAR, "Expecting ')'");
|
expect(RPAR, "Expecting ')'");
|
||||||
myBuilder.restoreNewlinesState();
|
myBuilder.restoreNewlinesState();
|
||||||
|
|
||||||
mark.done(commaPassed > 0 ? TUPLE : PARENTHESIZED);
|
mark.done(tuple ? TUPLE : PARENTHESIZED);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
@@ -324,7 +324,7 @@ JetFile: NewlinesInParentheses.jet
|
|||||||
REFERENCE_EXPRESSION
|
REFERENCE_EXPRESSION
|
||||||
PsiElement(IDENTIFIER)('T')
|
PsiElement(IDENTIFIER)('T')
|
||||||
PsiWhiteSpace('\n ')
|
PsiWhiteSpace('\n ')
|
||||||
PARENTHESIZED
|
TUPLE
|
||||||
PsiElement(LPAR)('(')
|
PsiElement(LPAR)('(')
|
||||||
PsiElement(RPAR)(')')
|
PsiElement(RPAR)(')')
|
||||||
PsiWhiteSpace('\n')
|
PsiWhiteSpace('\n')
|
||||||
|
|||||||
@@ -32,4 +32,4 @@ fun foo() {
|
|||||||
a || b && c
|
a || b && c
|
||||||
a = b -> c
|
a = b -> c
|
||||||
a = b || c
|
a = b || c
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ JetFile: SimpleExpressions.jet
|
|||||||
PsiWhiteSpace(' ')
|
PsiWhiteSpace(' ')
|
||||||
PsiElement(EQ)('=')
|
PsiElement(EQ)('=')
|
||||||
PsiWhiteSpace(' ')
|
PsiWhiteSpace(' ')
|
||||||
PARENTHESIZED
|
TUPLE
|
||||||
PsiElement(LPAR)('(')
|
PsiElement(LPAR)('(')
|
||||||
PsiElement(RPAR)(')')
|
PsiElement(RPAR)(')')
|
||||||
PsiElement(COMMA)(',')
|
PsiElement(COMMA)(',')
|
||||||
|
|||||||
Reference in New Issue
Block a user