Removed binding of comment after package directive

This commit is contained in:
Valentin Kipyatkov
2014-10-03 19:56:07 +04:00
parent c93b78c6dc
commit d6dc2531b0
6 changed files with 38 additions and 5 deletions
@@ -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.
+2 -2
View File
@@ -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
@@ -0,0 +1,2 @@
package p1.p2;/** some */
fun foo(){}
@@ -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)('}')
@@ -7,8 +7,8 @@ JetFile: PackageRecovery.kt
PsiElement(DOT)('.')
PsiErrorElement:Package name must be a '.'-separated identifier list placed on a single line
<empty list>
PsiWhiteSpace(' ')
PsiComment(EOL_COMMENT)('// Hello')
PsiWhiteSpace(' ')
PsiComment(EOL_COMMENT)('// Hello')
PsiWhiteSpace('\n\n')
PROPERTY
PsiElement(val)('val')
@@ -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");