diff --git a/compiler/frontend/src/org/jetbrains/jet/lang/parsing/JetExpressionParsing.java b/compiler/frontend/src/org/jetbrains/jet/lang/parsing/JetExpressionParsing.java index e7c807549ac..092c077c105 100644 --- a/compiler/frontend/src/org/jetbrains/jet/lang/parsing/JetExpressionParsing.java +++ b/compiler/frontend/src/org/jetbrains/jet/lang/parsing/JetExpressionParsing.java @@ -1344,7 +1344,7 @@ public class JetExpressionParsing extends AbstractJetParsing { } if (at(COLON)) { advance(); // COLON - myJetParsing.parseTypeRef(); + myJetParsing.parseTypeRef(TokenSet.create(IN_KEYWORD)); } parameter.done(LOOP_PARAMETER); } diff --git a/compiler/testData/psi/recovery/ForRecovery.kt b/compiler/testData/psi/recovery/ForRecovery.kt new file mode 100644 index 00000000000..8e29aa4bfa5 --- /dev/null +++ b/compiler/testData/psi/recovery/ForRecovery.kt @@ -0,0 +1,3 @@ +fun f() { + for (v: in 1..2) {} +} \ No newline at end of file diff --git a/compiler/testData/psi/recovery/ForRecovery.txt b/compiler/testData/psi/recovery/ForRecovery.txt new file mode 100644 index 00000000000..2aa4037f288 --- /dev/null +++ b/compiler/testData/psi/recovery/ForRecovery.txt @@ -0,0 +1,43 @@ +JetFile: ForRecovery.kt + NAMESPACE_HEADER + + FUN + PsiElement(fun)('fun') + PsiWhiteSpace(' ') + PsiElement(IDENTIFIER)('f') + VALUE_PARAMETER_LIST + PsiElement(LPAR)('(') + PsiElement(RPAR)(')') + PsiWhiteSpace(' ') + BLOCK + PsiElement(LBRACE)('{') + PsiWhiteSpace('\n ') + FOR + PsiElement(for)('for') + PsiWhiteSpace(' ') + PsiElement(LPAR)('(') + LOOP_PARAMETER + PsiElement(IDENTIFIER)('v') + PsiElement(COLON)(':') + PsiWhiteSpace(' ') + TYPE_REFERENCE + PsiErrorElement:Type expected + + PsiElement(in)('in') + PsiWhiteSpace(' ') + LOOP_RANGE + BINARY_EXPRESSION + INTEGER_CONSTANT + PsiElement(INTEGER_LITERAL)('1') + OPERATION_REFERENCE + PsiElement(RANGE)('..') + INTEGER_CONSTANT + PsiElement(INTEGER_LITERAL)('2') + PsiElement(RPAR)(')') + PsiWhiteSpace(' ') + BODY + BLOCK + PsiElement(LBRACE)('{') + PsiElement(RBRACE)('}') + PsiWhiteSpace('\n') + PsiElement(RBRACE)('}') \ No newline at end of file