diff --git a/compiler/frontend/src/org/jetbrains/jet/lang/parsing/JetParsing.java b/compiler/frontend/src/org/jetbrains/jet/lang/parsing/JetParsing.java index f770ffb3423..2f7f6666f6f 100644 --- a/compiler/frontend/src/org/jetbrains/jet/lang/parsing/JetParsing.java +++ b/compiler/frontend/src/org/jetbrains/jet/lang/parsing/JetParsing.java @@ -201,7 +201,6 @@ public class JetParsing extends AbstractJetParsing { consumeIf(SEMICOLON); packageDirective.done(PACKAGE_DIRECTIVE); - packageDirective.setCustomEdgeTokenBinders(null, TrailingWhitespacesAndCommentsBinder.INSTANCE$); } else { // When package directive is omitted we should not report error on non-file annotations at the beginning of the file. diff --git a/compiler/testData/psi/CommentsBinding.txt b/compiler/testData/psi/CommentsBinding.txt index 9afef7a861a..c1870851f80 100644 --- a/compiler/testData/psi/CommentsBinding.txt +++ b/compiler/testData/psi/CommentsBinding.txt @@ -10,8 +10,8 @@ JetFile: CommentsBinding.kt PsiElement(DOT)('.') REFERENCE_EXPRESSION PsiElement(IDENTIFIER)('bar') - PsiWhiteSpace(' ') - PsiComment(EOL_COMMENT)('// package directive') + PsiWhiteSpace(' ') + PsiComment(EOL_COMMENT)('// package directive') PsiWhiteSpace('\n\n') IMPORT_LIST IMPORT_DIRECTIVE diff --git a/compiler/testData/psi/DocCommentOnPackageDirectiveLine.kt b/compiler/testData/psi/DocCommentOnPackageDirectiveLine.kt new file mode 100644 index 00000000000..934959db6d3 --- /dev/null +++ b/compiler/testData/psi/DocCommentOnPackageDirectiveLine.kt @@ -0,0 +1,2 @@ +package p1.p2;/** some */ +fun foo(){} \ No newline at end of file diff --git a/compiler/testData/psi/DocCommentOnPackageDirectiveLine.txt b/compiler/testData/psi/DocCommentOnPackageDirectiveLine.txt new file mode 100644 index 00000000000..a21d9b42285 --- /dev/null +++ b/compiler/testData/psi/DocCommentOnPackageDirectiveLine.txt @@ -0,0 +1,26 @@ +JetFile: DocCommentOnPackageDirectiveLine.kt + PACKAGE_DIRECTIVE + PsiElement(package)('package') + PsiWhiteSpace(' ') + DOT_QUALIFIED_EXPRESSION + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('p1') + PsiElement(DOT)('.') + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('p2') + PsiElement(SEMICOLON)(';') + FUN + KDoc + PsiElement(KDOC_START)('/**') + PsiElement(KDOC_TEXT)(' some ') + PsiElement(KDOC_END)('*/') + PsiWhiteSpace('\n') + PsiElement(fun)('fun') + PsiWhiteSpace(' ') + PsiElement(IDENTIFIER)('foo') + VALUE_PARAMETER_LIST + PsiElement(LPAR)('(') + PsiElement(RPAR)(')') + BLOCK + PsiElement(LBRACE)('{') + PsiElement(RBRACE)('}') \ No newline at end of file diff --git a/compiler/testData/psi/recovery/PackageRecovery.txt b/compiler/testData/psi/recovery/PackageRecovery.txt index 604d60b39b0..09f8b1341eb 100644 --- a/compiler/testData/psi/recovery/PackageRecovery.txt +++ b/compiler/testData/psi/recovery/PackageRecovery.txt @@ -7,8 +7,8 @@ JetFile: PackageRecovery.kt PsiElement(DOT)('.') PsiErrorElement:Package name must be a '.'-separated identifier list placed on a single line - PsiWhiteSpace(' ') - PsiComment(EOL_COMMENT)('// Hello') + PsiWhiteSpace(' ') + PsiComment(EOL_COMMENT)('// Hello') PsiWhiteSpace('\n\n') PROPERTY PsiElement(val)('val') diff --git a/compiler/tests/org/jetbrains/jet/parsing/JetParsingTestGenerated.java b/compiler/tests/org/jetbrains/jet/parsing/JetParsingTestGenerated.java index b7665d6774a..c19b587ee0f 100644 --- a/compiler/tests/org/jetbrains/jet/parsing/JetParsingTestGenerated.java +++ b/compiler/tests/org/jetbrains/jet/parsing/JetParsingTestGenerated.java @@ -148,6 +148,12 @@ public class JetParsingTestGenerated extends AbstractJetParsingTest { doParsingTest(fileName); } + @TestMetadata("DocCommentOnPackageDirectiveLine.kt") + public void testDocCommentOnPackageDirectiveLine() throws Exception { + String fileName = JetTestUtils.navigationMetadata("compiler/testData/psi/DocCommentOnPackageDirectiveLine.kt"); + doParsingTest(fileName); + } + @TestMetadata("DoubleColon.kt") public void testDoubleColon() throws Exception { String fileName = JetTestUtils.navigationMetadata("compiler/testData/psi/DoubleColon.kt");