diff --git a/compiler/frontend/src/org/jetbrains/kotlin/parsing/JetParsing.java b/compiler/frontend/src/org/jetbrains/kotlin/parsing/JetParsing.java index 4797597d30c..0739ac47fdb 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/parsing/JetParsing.java +++ b/compiler/frontend/src/org/jetbrains/kotlin/parsing/JetParsing.java @@ -1320,8 +1320,12 @@ public class JetParsing extends AbstractJetParsing { setterParameter.done(VALUE_PARAMETER); parameterList.done(VALUE_PARAMETER_LIST); } - if (!at(RPAR)) errorUntil("Expecting ')'", TokenSet.create(RPAR, COLON, LBRACE, RBRACE, EQ, EOL_OR_SEMICOLON)); - expect(RPAR, "Expecting ')'", TokenSet.create(RPAR, COLON, LBRACE, EQ)); + if (!at(RPAR)) { + errorUntil("Expecting ')'", TokenSet.create(RPAR, COLON, LBRACE, RBRACE, EQ, EOL_OR_SEMICOLON)); + } + if (at(RPAR)) { + advance(); + } myBuilder.restoreNewlinesState(); if (at(COLON)) { diff --git a/compiler/testData/psi/recovery/IncompleteAccessor1.txt b/compiler/testData/psi/recovery/IncompleteAccessor1.txt index f37d5037525..a75a591f719 100644 --- a/compiler/testData/psi/recovery/IncompleteAccessor1.txt +++ b/compiler/testData/psi/recovery/IncompleteAccessor1.txt @@ -25,7 +25,7 @@ JetFile: IncompleteAccessor1.kt PsiElement(LPAR)('(') PsiErrorElement:Expecting ')' - PsiErrorElement:Expecting ')' + PsiErrorElement:Expecting function body PsiWhiteSpace('\n') PsiElement(RBRACE)('}')