Fix import resolution for some cases of malformed imports ("import some.")

Fix parsing import directives in case of non-identifier after "import"
Add diagnostics test for malformed imports
This commit is contained in:
Pavel V. Talanov
2015-06-16 20:46:25 +03:00
parent 37bcd455b5
commit 997a6f1381
9 changed files with 112 additions and 9 deletions
+8
View File
@@ -28,6 +28,14 @@ import foo.bar.* as
import foo.bar. ;
import foo.bar.* as bar ;
import foo.bar.* as ;
import *
import -
import ^_^
import .
import ---; import +++
import ..{...
import ..}...
import foo
fun foo() {
+65
View File
@@ -317,6 +317,71 @@ JetFile: Imports_ERR.kt
PsiElement(as)('as')
PsiWhiteSpace(' ')
PsiElement(SEMICOLON)(';')
PsiWhiteSpace('\n')
IMPORT_DIRECTIVE
PsiElement(import)('import')
PsiWhiteSpace(' ')
PsiErrorElement:Expecting qualified name
PsiElement(MUL)('*')
PsiWhiteSpace('\n')
IMPORT_DIRECTIVE
PsiElement(import)('import')
PsiWhiteSpace(' ')
PsiErrorElement:Expecting qualified name
PsiElement(MINUS)('-')
PsiWhiteSpace('\n')
IMPORT_DIRECTIVE
PsiElement(import)('import')
PsiWhiteSpace(' ')
PsiErrorElement:Expecting qualified name
PsiElement(BAD_CHARACTER)('^')
PsiElement(IDENTIFIER)('_')
PsiElement(BAD_CHARACTER)('^')
PsiWhiteSpace('\n')
IMPORT_DIRECTIVE
PsiElement(import)('import')
PsiWhiteSpace(' ')
PsiErrorElement:Expecting qualified name
PsiElement(DOT)('.')
PsiWhiteSpace('\n')
IMPORT_DIRECTIVE
PsiElement(import)('import')
PsiWhiteSpace(' ')
PsiErrorElement:Expecting qualified name
PsiElement(MINUSMINUS)('--')
PsiElement(MINUS)('-')
PsiElement(SEMICOLON)(';')
PsiWhiteSpace(' ')
IMPORT_DIRECTIVE
PsiElement(import)('import')
PsiWhiteSpace(' ')
PsiErrorElement:Expecting qualified name
PsiElement(PLUSPLUS)('++')
PsiElement(PLUS)('+')
PsiWhiteSpace('\n')
IMPORT_DIRECTIVE
PsiElement(import)('import')
PsiWhiteSpace(' ')
PsiErrorElement:Expecting qualified name
PsiElement(RANGE)('..')
PsiElement(LBRACE)('{')
PsiElement(RANGE)('..')
PsiElement(DOT)('.')
PsiWhiteSpace('\n')
IMPORT_DIRECTIVE
PsiElement(import)('import')
PsiWhiteSpace(' ')
PsiErrorElement:Expecting qualified name
PsiElement(RANGE)('..')
PsiElement(RBRACE)('}')
PsiElement(RANGE)('..')
PsiElement(DOT)('.')
PsiWhiteSpace('\n')
IMPORT_DIRECTIVE
PsiElement(import)('import')
PsiWhiteSpace(' ')
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('foo')
PsiWhiteSpace('\n\n')
FUN
PsiElement(fun)('fun')