Parser: Do not produce qualified expressions without receiver in package directives. Add assertion on JetQualifiedExpression
#KT-6907 Fixed
This commit is contained in:
@@ -0,0 +1,4 @@
|
||||
package foobar {
|
||||
val a = 1
|
||||
val b = foobar.a
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
JetFile: PackageBlockFirst.kt
|
||||
PACKAGE_DIRECTIVE
|
||||
PsiElement(package)('package')
|
||||
PsiWhiteSpace(' ')
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('foobar')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiErrorElement:Expecting a top level declaration
|
||||
PsiElement(LBRACE)('{')
|
||||
PsiWhiteSpace('\n ')
|
||||
PROPERTY
|
||||
PsiElement(val)('val')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(IDENTIFIER)('a')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(EQ)('=')
|
||||
PsiWhiteSpace(' ')
|
||||
INTEGER_CONSTANT
|
||||
PsiElement(INTEGER_LITERAL)('1')
|
||||
PsiWhiteSpace('\n ')
|
||||
PROPERTY
|
||||
PsiElement(val)('val')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(IDENTIFIER)('b')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(EQ)('=')
|
||||
PsiWhiteSpace(' ')
|
||||
DOT_QUALIFIED_EXPRESSION
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('foobar')
|
||||
PsiElement(DOT)('.')
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('a')
|
||||
PsiWhiteSpace('\n')
|
||||
PsiErrorElement:Expecting a top level declaration
|
||||
PsiElement(RBRACE)('}')
|
||||
@@ -0,0 +1 @@
|
||||
package .a b
|
||||
@@ -0,0 +1,18 @@
|
||||
JetFile: PackageLeadingDotDoubleID.kt
|
||||
PACKAGE_DIRECTIVE
|
||||
PsiElement(package)('package')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiErrorElement:Package name must be a '.'-separated identifier list
|
||||
PsiElement(DOT)('.')
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('a')
|
||||
PsiWhiteSpace(' ')
|
||||
MODIFIER_LIST
|
||||
ANNOTATION_ENTRY
|
||||
CONSTRUCTOR_CALLEE
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('b')
|
||||
PsiErrorElement:Expecting a top level declaration
|
||||
<empty list>
|
||||
@@ -0,0 +1 @@
|
||||
package .a.b.c.
|
||||
@@ -0,0 +1,19 @@
|
||||
JetFile: PackageLongNameBetweenDots.kt
|
||||
PACKAGE_DIRECTIVE
|
||||
PsiElement(package)('package')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiErrorElement:Package name must be a '.'-separated identifier list
|
||||
PsiElement(DOT)('.')
|
||||
DOT_QUALIFIED_EXPRESSION
|
||||
DOT_QUALIFIED_EXPRESSION
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('a')
|
||||
PsiElement(DOT)('.')
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('b')
|
||||
PsiElement(DOT)('.')
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('c')
|
||||
PsiElement(DOT)('.')
|
||||
PsiErrorElement:Package name must be a '.'-separated identifier list placed on a single line
|
||||
<empty list>
|
||||
@@ -0,0 +1 @@
|
||||
package a b
|
||||
@@ -0,0 +1,16 @@
|
||||
JetFile: PackageLongNameDoubleID.kt
|
||||
PACKAGE_DIRECTIVE
|
||||
PsiElement(package)('package')
|
||||
PsiWhiteSpace(' ')
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('a')
|
||||
PsiWhiteSpace(' ')
|
||||
MODIFIER_LIST
|
||||
ANNOTATION_ENTRY
|
||||
CONSTRUCTOR_CALLEE
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('b')
|
||||
PsiErrorElement:Expecting a top level declaration
|
||||
<empty list>
|
||||
@@ -0,0 +1 @@
|
||||
package .a.b.c
|
||||
@@ -0,0 +1,16 @@
|
||||
JetFile: PackageLongNameLeadingDot.kt
|
||||
PACKAGE_DIRECTIVE
|
||||
PsiElement(package)('package')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiErrorElement:Package name must be a '.'-separated identifier list
|
||||
PsiElement(DOT)('.')
|
||||
DOT_QUALIFIED_EXPRESSION
|
||||
DOT_QUALIFIED_EXPRESSION
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('a')
|
||||
PsiElement(DOT)('.')
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('b')
|
||||
PsiElement(DOT)('.')
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('c')
|
||||
@@ -0,0 +1 @@
|
||||
package . .a.b.c
|
||||
@@ -0,0 +1,19 @@
|
||||
JetFile: PackageLongNameLeadingDoubleDot.kt
|
||||
PACKAGE_DIRECTIVE
|
||||
PsiElement(package)('package')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiErrorElement:Package name must be a '.'-separated identifier list
|
||||
PsiElement(DOT)('.')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiErrorElement:Package name must be a '.'-separated identifier list
|
||||
PsiElement(DOT)('.')
|
||||
DOT_QUALIFIED_EXPRESSION
|
||||
DOT_QUALIFIED_EXPRESSION
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('a')
|
||||
PsiElement(DOT)('.')
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('b')
|
||||
PsiElement(DOT)('.')
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('c')
|
||||
@@ -0,0 +1 @@
|
||||
public [a] package name
|
||||
@@ -0,0 +1,19 @@
|
||||
JetFile: PackageModifiers.kt
|
||||
PACKAGE_DIRECTIVE
|
||||
MODIFIER_LIST
|
||||
PsiElement(public)('public')
|
||||
PsiWhiteSpace(' ')
|
||||
ANNOTATION
|
||||
PsiElement(LBRACKET)('[')
|
||||
ANNOTATION_ENTRY
|
||||
CONSTRUCTOR_CALLEE
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('a')
|
||||
PsiElement(RBRACKET)(']')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(package)('package')
|
||||
PsiWhiteSpace(' ')
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('name')
|
||||
@@ -0,0 +1 @@
|
||||
package . .
|
||||
@@ -0,0 +1,11 @@
|
||||
JetFile: PackageNameDoubleDot.kt
|
||||
PACKAGE_DIRECTIVE
|
||||
PsiElement(package)('package')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiErrorElement:Package name must be a '.'-separated identifier list
|
||||
PsiElement(DOT)('.')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiErrorElement:Package name must be a '.'-separated identifier list
|
||||
PsiElement(DOT)('.')
|
||||
PsiErrorElement:Package name must be a '.'-separated identifier list placed on a single line
|
||||
<empty list>
|
||||
@@ -0,0 +1 @@
|
||||
package .
|
||||
@@ -0,0 +1,8 @@
|
||||
JetFile: PackageNameJustDot.kt
|
||||
PACKAGE_DIRECTIVE
|
||||
PsiElement(package)('package')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiErrorElement:Package name must be a '.'-separated identifier list
|
||||
PsiElement(DOT)('.')
|
||||
PsiErrorElement:Package name must be a '.'-separated identifier list placed on a single line
|
||||
<empty list>
|
||||
@@ -0,0 +1 @@
|
||||
package .a
|
||||
@@ -0,0 +1,8 @@
|
||||
JetFile: PackageSimpleNameLeadingDot.kt
|
||||
PACKAGE_DIRECTIVE
|
||||
PsiElement(package)('package')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiErrorElement:Package name must be a '.'-separated identifier list
|
||||
PsiElement(DOT)('.')
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('a')
|
||||
@@ -0,0 +1 @@
|
||||
package . .a
|
||||
@@ -0,0 +1,11 @@
|
||||
JetFile: PackageSimpleNameLeadingDoubleDot.kt
|
||||
PACKAGE_DIRECTIVE
|
||||
PsiElement(package)('package')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiErrorElement:Package name must be a '.'-separated identifier list
|
||||
PsiElement(DOT)('.')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiErrorElement:Package name must be a '.'-separated identifier list
|
||||
PsiElement(DOT)('.')
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('a')
|
||||
Reference in New Issue
Block a user