KT-4392 #Fixed

This commit is contained in:
Alexey Sedunov
2014-01-09 15:00:41 +04:00
parent e693820fb4
commit 446941257b
5 changed files with 93 additions and 1 deletions
@@ -1712,7 +1712,10 @@ public class JetParsing extends AbstractJetParsing {
if (at(COMMA)) {
advance(); // COMMA
}
else if (!atSet(VALUE_PARAMETER_FIRST)) break;
else {
if (!at(RPAR)) error("Expecting comma or ')'");
if (!atSet(VALUE_PARAMETER_FIRST)) break;
}
}
}
@@ -0,0 +1,3 @@
class Test(private val a: Int b: Int private val c: Int) {
fun toString() = "$a $c"
}
@@ -0,0 +1,79 @@
JetFile: MissingCommaInConstructorValueParameterList.kt
NAMESPACE_HEADER
<empty list>
CLASS
PsiElement(class)('class')
PsiWhiteSpace(' ')
PsiElement(IDENTIFIER)('Test')
VALUE_PARAMETER_LIST
PsiElement(LPAR)('(')
VALUE_PARAMETER
MODIFIER_LIST
PsiElement(private)('private')
PsiWhiteSpace(' ')
PsiElement(val)('val')
PsiWhiteSpace(' ')
PsiElement(IDENTIFIER)('a')
PsiElement(COLON)(':')
PsiWhiteSpace(' ')
TYPE_REFERENCE
USER_TYPE
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('Int')
PsiErrorElement:Expecting comma
<empty list>
PsiWhiteSpace(' ')
VALUE_PARAMETER
PsiElement(IDENTIFIER)('b')
PsiElement(COLON)(':')
PsiWhiteSpace(' ')
TYPE_REFERENCE
USER_TYPE
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('Int')
PsiErrorElement:Expecting comma
<empty list>
PsiWhiteSpace(' ')
VALUE_PARAMETER
MODIFIER_LIST
PsiElement(private)('private')
PsiWhiteSpace(' ')
PsiElement(val)('val')
PsiWhiteSpace(' ')
PsiElement(IDENTIFIER)('c')
PsiElement(COLON)(':')
PsiWhiteSpace(' ')
TYPE_REFERENCE
USER_TYPE
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('Int')
PsiElement(RPAR)(')')
PsiWhiteSpace(' ')
CLASS_BODY
PsiElement(LBRACE)('{')
PsiWhiteSpace('\n ')
FUN
PsiElement(fun)('fun')
PsiWhiteSpace(' ')
PsiElement(IDENTIFIER)('toString')
VALUE_PARAMETER_LIST
PsiElement(LPAR)('(')
PsiElement(RPAR)(')')
PsiWhiteSpace(' ')
PsiElement(EQ)('=')
PsiWhiteSpace(' ')
STRING_TEMPLATE
PsiElement(OPEN_QUOTE)('"')
SHORT_STRING_TEMPLATE_ENTRY
PsiElement(SHORT_TEMPLATE_ENTRY_START)('$')
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('a')
LITERAL_STRING_TEMPLATE_ENTRY
PsiElement(REGULAR_STRING_PART)(' ')
SHORT_STRING_TEMPLATE_ENTRY
PsiElement(SHORT_TEMPLATE_ENTRY_START)('$')
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('c')
PsiElement(CLOSING_QUOTE)('"')
PsiWhiteSpace('\n')
PsiElement(RBRACE)('}')
@@ -26,6 +26,8 @@ JetFile: MissingCommaInValueParameterList.kt
USER_TYPE
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('Int')
PsiErrorElement:Expecting comma
<empty list>
PsiWhiteSpace('\n ')
VALUE_PARAMETER
PsiElement(IDENTIFIER)('c')
@@ -883,6 +883,11 @@ public class JetParsingTestGenerated extends AbstractJetParsingTest {
doParsingTest("compiler/testData/psi/recovery/kt2172.kt");
}
@TestMetadata("MissingCommaInConstructorValueParameterList.kt")
public void testMissingCommaInConstructorValueParameterList() throws Exception {
doParsingTest("compiler/testData/psi/recovery/MissingCommaInConstructorValueParameterList.kt");
}
@TestMetadata("MissingCommaInValueArgumentList.kt")
public void testMissingCommaInValueArgumentList() throws Exception {
doParsingTest("compiler/testData/psi/recovery/MissingCommaInValueArgumentList.kt");