diff --git a/idea/src/org/jetbrains/jet/lang/parsing/JetParsing.java b/idea/src/org/jetbrains/jet/lang/parsing/JetParsing.java index d6ec63276ca..8229c3f7b1d 100644 --- a/idea/src/org/jetbrains/jet/lang/parsing/JetParsing.java +++ b/idea/src/org/jetbrains/jet/lang/parsing/JetParsing.java @@ -735,7 +735,11 @@ public class JetParsing extends AbstractJetParsing { if (at(EQ)) { advance(); // EQ myExpressionParsing.parseExpression(); - consumeIf(SEMICOLON); + if (!local) { + consumeIf(SEMICOLON); + } else { + // "val a = 1; b" must not be an infix call of b on "val ...;" + } } if (!local) { if (parsePropertyGetterOrSetter()) { diff --git a/idea/testData/psi/IfWithPropery.jet b/idea/testData/psi/IfWithPropery.jet new file mode 100644 index 00000000000..d28dec26581 --- /dev/null +++ b/idea/testData/psi/IfWithPropery.jet @@ -0,0 +1,5 @@ +val a = if(1) {var f = a;a} else {null} +val a = if(1) { + var f = a; + a +} else {null} diff --git a/idea/testData/psi/IfWithPropery.txt b/idea/testData/psi/IfWithPropery.txt new file mode 100644 index 00000000000..d5b18b7ce0c --- /dev/null +++ b/idea/testData/psi/IfWithPropery.txt @@ -0,0 +1,90 @@ +JetFile: IfWithPropery.jet + NAMESPACE + PROPERTY + PsiElement(val)('val') + PsiWhiteSpace(' ') + PsiElement(IDENTIFIER)('a') + PsiWhiteSpace(' ') + PsiElement(EQ)('=') + PsiWhiteSpace(' ') + IF + PsiElement(if)('if') + PsiElement(LPAR)('(') + CONDITION + INTEGER_CONSTANT + PsiElement(INTEGER_LITERAL)('1') + PsiElement(RPAR)(')') + PsiWhiteSpace(' ') + THEN + FUNCTION_LITERAL + PsiElement(LBRACE)('{') + BODY + PROPERTY + PsiElement(var)('var') + PsiWhiteSpace(' ') + PsiElement(IDENTIFIER)('f') + PsiWhiteSpace(' ') + PsiElement(EQ)('=') + PsiWhiteSpace(' ') + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('a') + PsiElement(SEMICOLON)(';') + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('a') + PsiElement(RBRACE)('}') + PsiWhiteSpace(' ') + PsiElement(else)('else') + PsiWhiteSpace(' ') + ELSE + FUNCTION_LITERAL + PsiElement(LBRACE)('{') + BODY + NULL + PsiElement(null)('null') + PsiElement(RBRACE)('}') + PsiWhiteSpace('\n') + PROPERTY + PsiElement(val)('val') + PsiWhiteSpace(' ') + PsiElement(IDENTIFIER)('a') + PsiWhiteSpace(' ') + PsiElement(EQ)('=') + PsiWhiteSpace(' ') + IF + PsiElement(if)('if') + PsiElement(LPAR)('(') + CONDITION + INTEGER_CONSTANT + PsiElement(INTEGER_LITERAL)('1') + PsiElement(RPAR)(')') + PsiWhiteSpace(' ') + THEN + FUNCTION_LITERAL + PsiElement(LBRACE)('{') + PsiWhiteSpace('\n ') + BODY + PROPERTY + PsiElement(var)('var') + PsiWhiteSpace(' ') + PsiElement(IDENTIFIER)('f') + PsiWhiteSpace(' ') + PsiElement(EQ)('=') + PsiWhiteSpace(' ') + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('a') + PsiElement(SEMICOLON)(';') + PsiWhiteSpace('\n ') + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('a') + PsiWhiteSpace('\n') + PsiElement(RBRACE)('}') + PsiWhiteSpace(' ') + PsiElement(else)('else') + PsiWhiteSpace(' ') + ELSE + FUNCTION_LITERAL + PsiElement(LBRACE)('{') + BODY + NULL + PsiElement(null)('null') + PsiElement(RBRACE)('}') \ No newline at end of file diff --git a/idea/testData/psi/ThisType.txt b/idea/testData/psi/ThisType.txt index d44ef2aaa23..9351f37ffca 100644 --- a/idea/testData/psi/ThisType.txt +++ b/idea/testData/psi/ThisType.txt @@ -149,7 +149,7 @@ JetFile: ThisType.jet VALUE_ARGUMENT_LIST PsiElement(LPAR)('(') PsiElement(RPAR)(')') - PsiElement(SEMICOLON)(';') + PsiElement(SEMICOLON)(';') PsiWhiteSpace('\n ') PsiElement(RBRACE)('}') PsiWhiteSpace('\n') diff --git a/idea/testData/psi/examples/AnonymousObjects.txt b/idea/testData/psi/examples/AnonymousObjects.txt index 15506021022..df51c6afd3e 100644 --- a/idea/testData/psi/examples/AnonymousObjects.txt +++ b/idea/testData/psi/examples/AnonymousObjects.txt @@ -203,6 +203,6 @@ JetFile: AnonymousObjects.jet PsiElement(RPAR)(')') PsiWhiteSpace('\n') PsiElement(RBRACE)('}') - PsiElement(SEMICOLON)(';') + PsiElement(SEMICOLON)(';') PsiWhiteSpace('\n\n') PsiElement(RBRACE)('}') \ No newline at end of file diff --git a/idea/testData/psi/examples/UnionFind.txt b/idea/testData/psi/examples/UnionFind.txt index 28dfdf1dd6e..769c7dfb7f7 100644 --- a/idea/testData/psi/examples/UnionFind.txt +++ b/idea/testData/psi/examples/UnionFind.txt @@ -135,7 +135,7 @@ JetFile: UnionFind.jet REFERENCE_EXPRESSION PsiElement(IDENTIFIER)('x') PsiElement(RBRACKET)(']') - PsiElement(SEMICOLON)(';') + PsiElement(SEMICOLON)(';') PsiWhiteSpace('\n ') IF PsiElement(if)('if') @@ -182,7 +182,7 @@ JetFile: UnionFind.jet REFERENCE_EXPRESSION PsiElement(IDENTIFIER)('p') PsiElement(RPAR)(')') - PsiElement(SEMICOLON)(';') + PsiElement(SEMICOLON)(';') PsiWhiteSpace('\n ') BINARY_EXPRESSION ARRAY_ACCESS_EXPRESSION diff --git a/idea/testData/psi/examples/collections/IIterator.txt b/idea/testData/psi/examples/collections/IIterator.txt index 5f554760dca..da96d6b3d7d 100644 --- a/idea/testData/psi/examples/collections/IIterator.txt +++ b/idea/testData/psi/examples/collections/IIterator.txt @@ -297,7 +297,7 @@ JetFile: IIterator.jet PsiWhiteSpace(' ') INTEGER_CONSTANT PsiElement(INTEGER_LITERAL)('0') - PsiElement(SEMICOLON)(';') + PsiElement(SEMICOLON)(';') PsiWhiteSpace('\n ') FOR PsiElement(for)('for')