diff --git a/compiler/frontend/src/org/jetbrains/kotlin/KtNodeTypes.java b/compiler/frontend/src/org/jetbrains/kotlin/KtNodeTypes.java index 474efa230d2..7e3349a2deb 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/KtNodeTypes.java +++ b/compiler/frontend/src/org/jetbrains/kotlin/KtNodeTypes.java @@ -55,6 +55,7 @@ public interface KtNodeTypes { IElementType IMPORT_LIST = KtStubElementTypes.IMPORT_LIST; IElementType FILE_ANNOTATION_LIST = KtStubElementTypes.FILE_ANNOTATION_LIST; IElementType IMPORT_DIRECTIVE = KtStubElementTypes.IMPORT_DIRECTIVE; + IElementType IMPORT_ALIAS = KtStubElementTypes.IMPORT_ALIAS; IElementType MODIFIER_LIST = KtStubElementTypes.MODIFIER_LIST; IElementType ANNOTATION = KtStubElementTypes.ANNOTATION; IElementType ANNOTATION_ENTRY = KtStubElementTypes.ANNOTATION_ENTRY; diff --git a/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/PositioningStrategies.kt b/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/PositioningStrategies.kt index e7bfd5df06c..cb9dc99cf46 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/PositioningStrategies.kt +++ b/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/PositioningStrategies.kt @@ -471,7 +471,7 @@ object PositioningStrategies { @JvmField val IMPORT_ALIAS: PositioningStrategy = object: PositioningStrategy() { override fun mark(element: KtImportDirective): List { - element.aliasNameNode?.let { return markNode(it) } + element.alias?.nameIdentifier?.let { return markElement(it) } element.importedReference?.let { if (it is KtQualifiedExpression) { it.selectorExpression?.let { return markElement(it) } diff --git a/compiler/frontend/src/org/jetbrains/kotlin/parsing/KotlinParsing.java b/compiler/frontend/src/org/jetbrains/kotlin/parsing/KotlinParsing.java index 4065ebcde6a..a9a7ffaef74 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/parsing/KotlinParsing.java +++ b/compiler/frontend/src/org/jetbrains/kotlin/parsing/KotlinParsing.java @@ -292,7 +292,7 @@ public class KotlinParsing extends AbstractKotlinParsing { PsiBuilder.Marker importDirective = mark(); advance(); // IMPORT_KEYWORD - if (closeImportWithErrorIfNewline(importDirective, "Expecting qualified name")) { + if (closeImportWithErrorIfNewline(importDirective, null, "Expecting qualified name")) { return; } @@ -313,7 +313,7 @@ public class KotlinParsing extends AbstractKotlinParsing { while (at(DOT) && lookahead(1) != MUL) { advance(); // DOT - if (closeImportWithErrorIfNewline(importDirective, "Import must be placed on a single line")) { + if (closeImportWithErrorIfNewline(importDirective, null, "Import must be placed on a single line")) { qualifiedName.drop(); return; } @@ -339,28 +339,37 @@ public class KotlinParsing extends AbstractKotlinParsing { if (at(AS_KEYWORD)) { PsiBuilder.Marker as = mark(); advance(); // AS_KEYWORD - if (closeImportWithErrorIfNewline(importDirective, "Expecting identifier")) { + if (closeImportWithErrorIfNewline(importDirective, null, "Expecting identifier")) { as.drop(); return; } consumeIf(IDENTIFIER); - as.error("Cannot rename all imported items to one identifier"); + as.done(IMPORT_ALIAS); + as.precede().error("Cannot rename all imported items to one identifier"); } } if (at(AS_KEYWORD)) { + PsiBuilder.Marker alias = mark(); advance(); // AS_KEYWORD - if (closeImportWithErrorIfNewline(importDirective, "Expecting identifier")) { + if (closeImportWithErrorIfNewline(importDirective, alias, "Expecting identifier")) { return; } expect(IDENTIFIER, "Expecting identifier", TokenSet.create(SEMICOLON)); + alias.done(IMPORT_ALIAS); } consumeIf(SEMICOLON); importDirective.done(IMPORT_DIRECTIVE); importDirective.setCustomEdgeTokenBinders(null, TrailingCommentsBinder.INSTANCE); } - private boolean closeImportWithErrorIfNewline(PsiBuilder.Marker importDirective, String errorMessage) { + private boolean closeImportWithErrorIfNewline( + PsiBuilder.Marker importDirective, + @Nullable PsiBuilder.Marker importAlias, + String errorMessage) { if (myBuilder.newlineBeforeCurrentToken()) { + if (importAlias != null) { + importAlias.done(IMPORT_ALIAS); + } error(errorMessage); importDirective.done(IMPORT_DIRECTIVE); return true; diff --git a/compiler/frontend/src/org/jetbrains/kotlin/psi/KtImportAlias.kt b/compiler/frontend/src/org/jetbrains/kotlin/psi/KtImportAlias.kt new file mode 100644 index 00000000000..bbbd206fd8c --- /dev/null +++ b/compiler/frontend/src/org/jetbrains/kotlin/psi/KtImportAlias.kt @@ -0,0 +1,42 @@ +/* + * Copyright 2010-2017 JetBrains s.r.o. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.jetbrains.kotlin.psi + +import com.intellij.lang.ASTNode +import com.intellij.psi.PsiElement +import com.intellij.psi.PsiNameIdentifierOwner +import org.jetbrains.kotlin.lexer.KtTokens +import org.jetbrains.kotlin.psi.stubs.KotlinImportAliasStub +import org.jetbrains.kotlin.psi.stubs.elements.KtStubElementTypes + +class KtImportAlias : KtElementImplStub, PsiNameIdentifierOwner { + @Suppress("unused") constructor(node: ASTNode) : super(node) + @Suppress("unused") constructor(stub: KotlinImportAliasStub) : super(stub, KtStubElementTypes.IMPORT_ALIAS) + + override fun accept(visitor: KtVisitor, data: D): R { + return visitor.visitImportAlias(this, data) + } + + override fun getName() = stub?.getName() ?: nameIdentifier?.text + + override fun setName(name: String): PsiElement { + nameIdentifier?.replace(KtPsiFactory(this).createNameIdentifier(name)) + return this + } + + override fun getNameIdentifier(): PsiElement? = findChildByType(KtTokens.IDENTIFIER) +} \ No newline at end of file diff --git a/compiler/frontend/src/org/jetbrains/kotlin/psi/KtImportDirective.java b/compiler/frontend/src/org/jetbrains/kotlin/psi/KtImportDirective.java index d5b32e7e116..73bb8a92f7c 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/psi/KtImportDirective.java +++ b/compiler/frontend/src/org/jetbrains/kotlin/psi/KtImportDirective.java @@ -17,7 +17,6 @@ package org.jetbrains.kotlin.psi; import com.intellij.lang.ASTNode; -import com.intellij.psi.tree.IElementType; import com.intellij.psi.util.PsiTreeUtil; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -54,32 +53,14 @@ public class KtImportDirective extends KtElementImplStub extends PsiElementVisitor { return visitDeclaration(script, data); } + public R visitImportAlias(@NotNull KtImportAlias importAlias, D data) { + return visitKtElement(importAlias, data); + } + public R visitImportDirective(@NotNull KtImportDirective importDirective, D data) { return visitKtElement(importDirective, data); } diff --git a/compiler/frontend/src/org/jetbrains/kotlin/psi/KtVisitorVoid.java b/compiler/frontend/src/org/jetbrains/kotlin/psi/KtVisitorVoid.java index 8a86efcdd03..484898bbefb 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/psi/KtVisitorVoid.java +++ b/compiler/frontend/src/org/jetbrains/kotlin/psi/KtVisitorVoid.java @@ -73,6 +73,10 @@ public class KtVisitorVoid extends KtVisitor { super.visitScript(script, null); } + public void visitImportAlias(@NotNull KtImportAlias importAlias) { + super.visitImportAlias(importAlias, null); + } + public void visitImportDirective(@NotNull KtImportDirective importDirective) { super.visitImportDirective(importDirective, null); } diff --git a/compiler/frontend/src/org/jetbrains/kotlin/psi/KtVisitorVoidWithParameter.java b/compiler/frontend/src/org/jetbrains/kotlin/psi/KtVisitorVoidWithParameter.java index a1999c0c649..ef070db9ad5 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/psi/KtVisitorVoidWithParameter.java +++ b/compiler/frontend/src/org/jetbrains/kotlin/psi/KtVisitorVoidWithParameter.java @@ -70,6 +70,10 @@ public class KtVisitorVoidWithParameter

extends KtVisitor { super.visitImportDirective(importDirective, data); } + public void visitImportAliasVoid(@NotNull KtImportAlias importAlias, P data) { + super.visitImportAlias(importAlias, data); + } + public void visitImportListVoid(@NotNull KtImportList importList, P data) { super.visitImportList(importList, data); } diff --git a/compiler/frontend/src/org/jetbrains/kotlin/psi/stubs/StubInterfaces.kt b/compiler/frontend/src/org/jetbrains/kotlin/psi/stubs/StubInterfaces.kt index 9366a82e488..db2ad96bfa1 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/psi/stubs/StubInterfaces.kt +++ b/compiler/frontend/src/org/jetbrains/kotlin/psi/stubs/StubInterfaces.kt @@ -71,10 +71,13 @@ interface KotlinFunctionStub : KotlinCallableStubBase { fun hasTypeParameterListBeforeFunctionName(): Boolean } +interface KotlinImportAliasStub : StubElement { + fun getName(): String? +} + interface KotlinImportDirectiveStub : StubElement { fun isAllUnder(): Boolean fun getImportedFqName(): FqName? - fun getAliasName(): String? fun isValid(): Boolean } diff --git a/compiler/frontend/src/org/jetbrains/kotlin/psi/stubs/elements/KtImportAliasElementType.kt b/compiler/frontend/src/org/jetbrains/kotlin/psi/stubs/elements/KtImportAliasElementType.kt new file mode 100644 index 00000000000..962c207444a --- /dev/null +++ b/compiler/frontend/src/org/jetbrains/kotlin/psi/stubs/elements/KtImportAliasElementType.kt @@ -0,0 +1,42 @@ +/* + * Copyright 2010-2017 JetBrains s.r.o. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.jetbrains.kotlin.psi.stubs.elements + +import com.intellij.psi.PsiElement +import com.intellij.psi.stubs.StubElement +import com.intellij.psi.stubs.StubInputStream +import com.intellij.psi.stubs.StubOutputStream +import com.intellij.util.io.StringRef +import org.jetbrains.kotlin.psi.KtImportAlias +import org.jetbrains.kotlin.psi.stubs.KotlinImportAliasStub +import org.jetbrains.kotlin.psi.stubs.impl.KotlinImportAliasStubImpl + +class KtImportAliasElementType(debugName: String) : + KtStubElementType(debugName, KtImportAlias::class.java, KotlinImportAliasStub::class.java) { + override fun createStub(psi: KtImportAlias, parentStub: StubElement?): KotlinImportAliasStub { + return KotlinImportAliasStubImpl(parentStub, StringRef.fromString(psi.name)) + } + + override fun serialize(stub: KotlinImportAliasStub, dataStream: StubOutputStream) { + dataStream.writeName(stub.getName()) + } + + override fun deserialize(dataStream: StubInputStream, parentStub: StubElement?): KotlinImportAliasStub { + val name = dataStream.readName() + return KotlinImportAliasStubImpl(parentStub, name) + } +} \ No newline at end of file diff --git a/compiler/frontend/src/org/jetbrains/kotlin/psi/stubs/elements/KtImportDirectiveElementType.java b/compiler/frontend/src/org/jetbrains/kotlin/psi/stubs/elements/KtImportDirectiveElementType.java index c082c3d29db..9cf83348fa6 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/psi/stubs/elements/KtImportDirectiveElementType.java +++ b/compiler/frontend/src/org/jetbrains/kotlin/psi/stubs/elements/KtImportDirectiveElementType.java @@ -38,8 +38,7 @@ public class KtImportDirectiveElementType extends KtStubElementType PACKAGE_DIRECTIVE = new KtPlaceHolderStubElementType<>("PACKAGE_DIRECTIVE", KtPackageDirective.class); diff --git a/compiler/frontend/src/org/jetbrains/kotlin/psi/stubs/impl/KotlinFileStubImpl.kt b/compiler/frontend/src/org/jetbrains/kotlin/psi/stubs/impl/KotlinFileStubImpl.kt index 6a981b79398..0f9e24916c9 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/psi/stubs/impl/KotlinFileStubImpl.kt +++ b/compiler/frontend/src/org/jetbrains/kotlin/psi/stubs/impl/KotlinFileStubImpl.kt @@ -25,8 +25,11 @@ import com.intellij.util.io.StringRef import org.jetbrains.kotlin.name.FqName import org.jetbrains.kotlin.psi.KtFile import org.jetbrains.kotlin.psi.stubs.KotlinFileStub +import org.jetbrains.kotlin.psi.stubs.KotlinImportAliasStub import org.jetbrains.kotlin.psi.stubs.KotlinImportDirectiveStub -import org.jetbrains.kotlin.psi.stubs.elements.KtStubElementTypes +import org.jetbrains.kotlin.psi.stubs.elements.KtStubElementTypes.FILE +import org.jetbrains.kotlin.psi.stubs.elements.KtStubElementTypes.IMPORT_LIST +import org.jetbrains.kotlin.utils.addToStdlib.firstIsInstanceOrNull open class KotlinFileStubImpl( jetFile: KtFile?, @@ -39,7 +42,7 @@ open class KotlinFileStubImpl( override fun getPackageFqName(): FqName = FqName(StringRef.toString(packageName)!!) override fun isScript(): Boolean = isScript - override fun getType(): IStubFileElementType = KtStubElementTypes.FILE + override fun getType(): IStubFileElementType = FILE override fun toString(): String = "PsiJetFileStubImpl[" + "package=" + getPackageFqName().asString() + "]" @@ -48,7 +51,9 @@ open class KotlinFileStubImpl( } override fun findImportsByAlias(alias: String): List { - val importList = childrenStubs.firstOrNull { it.stubType == KtStubElementTypes.IMPORT_LIST } ?: return emptyList() - return importList.childrenStubs.filterIsInstance().filter { it.getAliasName() == alias } + val importList = childrenStubs.firstOrNull { it.stubType == IMPORT_LIST } ?: return emptyList() + return importList.childrenStubs.filterIsInstance().filter { + it.childrenStubs.firstIsInstanceOrNull()?.getName() == alias + } } } diff --git a/compiler/frontend/src/org/jetbrains/kotlin/psi/stubs/impl/KotlinImportAliasStubImpl.kt b/compiler/frontend/src/org/jetbrains/kotlin/psi/stubs/impl/KotlinImportAliasStubImpl.kt new file mode 100644 index 00000000000..d0edfbe987c --- /dev/null +++ b/compiler/frontend/src/org/jetbrains/kotlin/psi/stubs/impl/KotlinImportAliasStubImpl.kt @@ -0,0 +1,31 @@ +/* + * Copyright 2010-2017 JetBrains s.r.o. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.jetbrains.kotlin.psi.stubs.impl + +import com.intellij.psi.PsiElement +import com.intellij.psi.stubs.StubElement +import com.intellij.util.io.StringRef +import org.jetbrains.kotlin.psi.KtImportAlias +import org.jetbrains.kotlin.psi.stubs.KotlinImportAliasStub +import org.jetbrains.kotlin.psi.stubs.elements.KtStubElementTypes + +class KotlinImportAliasStubImpl( + parent: StubElement?, + private val name: StringRef? +) : KotlinStubBaseImpl(parent, KtStubElementTypes.IMPORT_ALIAS), KotlinImportAliasStub { + override fun getName(): String? = StringRef.toString(name) +} diff --git a/compiler/frontend/src/org/jetbrains/kotlin/psi/stubs/impl/KotlinImportDirectiveStubImpl.kt b/compiler/frontend/src/org/jetbrains/kotlin/psi/stubs/impl/KotlinImportDirectiveStubImpl.kt index be15aa9ebd0..1a6db306794 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/psi/stubs/impl/KotlinImportDirectiveStubImpl.kt +++ b/compiler/frontend/src/org/jetbrains/kotlin/psi/stubs/impl/KotlinImportDirectiveStubImpl.kt @@ -28,7 +28,6 @@ class KotlinImportDirectiveStubImpl( parent: StubElement, private val isAllUnder: Boolean, private val importedFqName: StringRef?, - private val aliasName: StringRef?, private val isValid: Boolean ) : KotlinStubBaseImpl(parent, KtStubElementTypes.IMPORT_DIRECTIVE), KotlinImportDirectiveStub { override fun isAllUnder(): Boolean = isAllUnder @@ -38,6 +37,5 @@ class KotlinImportDirectiveStubImpl( return if (fqNameString != null) FqName(fqNameString) else null } - override fun getAliasName(): String? = StringRef.toString(aliasName) override fun isValid(): Boolean = isValid } diff --git a/compiler/testData/psi/ImportSoftKW.txt b/compiler/testData/psi/ImportSoftKW.txt index ae07f5e4306..0350fc98d4a 100644 --- a/compiler/testData/psi/ImportSoftKW.txt +++ b/compiler/testData/psi/ImportSoftKW.txt @@ -20,6 +20,7 @@ JetFile: ImportSoftKW.kt REFERENCE_EXPRESSION PsiElement(IDENTIFIER)('import') PsiWhiteSpace(' ') - PsiElement(as)('as') - PsiWhiteSpace(' ') - PsiElement(IDENTIFIER)('import') \ No newline at end of file + IMPORT_ALIAS + PsiElement(as)('as') + PsiWhiteSpace(' ') + PsiElement(IDENTIFIER)('import') \ No newline at end of file diff --git a/compiler/testData/psi/Imports.txt b/compiler/testData/psi/Imports.txt index 40513b30904..6a398c40f08 100644 --- a/compiler/testData/psi/Imports.txt +++ b/compiler/testData/psi/Imports.txt @@ -36,9 +36,10 @@ JetFile: Imports.kt REFERENCE_EXPRESSION PsiElement(IDENTIFIER)('foo') PsiWhiteSpace(' ') - PsiElement(as)('as') - PsiWhiteSpace(' ') - PsiElement(IDENTIFIER)('bar') + IMPORT_ALIAS + PsiElement(as)('as') + PsiWhiteSpace(' ') + PsiElement(IDENTIFIER)('bar') PsiWhiteSpace('\n') IMPORT_DIRECTIVE PsiElement(import)('import') @@ -50,9 +51,10 @@ JetFile: Imports.kt REFERENCE_EXPRESSION PsiElement(IDENTIFIER)('bar') PsiWhiteSpace(' ') - PsiElement(as)('as') - PsiWhiteSpace(' ') - PsiElement(IDENTIFIER)('bar') + IMPORT_ALIAS + PsiElement(as)('as') + PsiWhiteSpace(' ') + PsiElement(IDENTIFIER)('bar') PsiWhiteSpace('\n') IMPORT_DIRECTIVE PsiElement(import)('import') diff --git a/compiler/testData/psi/Imports_ERR.txt b/compiler/testData/psi/Imports_ERR.txt index e1c9eb53bf9..93230f3a486 100644 --- a/compiler/testData/psi/Imports_ERR.txt +++ b/compiler/testData/psi/Imports_ERR.txt @@ -62,7 +62,8 @@ JetFile: Imports_ERR.kt REFERENCE_EXPRESSION PsiElement(IDENTIFIER)('foo') PsiWhiteSpace(' ') - PsiElement(as)('as') + IMPORT_ALIAS + PsiElement(as)('as') PsiErrorElement:Expecting identifier PsiWhiteSpace('\n') @@ -76,7 +77,8 @@ JetFile: Imports_ERR.kt PsiErrorElement:Qualified name must be a '.'-separated identifier list PsiWhiteSpace(' ') - PsiElement(as)('as') + IMPORT_ALIAS + PsiElement(as)('as') PsiErrorElement:Expecting identifier PsiWhiteSpace('\n') @@ -102,9 +104,10 @@ JetFile: Imports_ERR.kt PsiErrorElement:Qualified name must be a '.'-separated identifier list PsiWhiteSpace(' ') - PsiElement(as)('as') - PsiErrorElement:Expecting identifier - + IMPORT_ALIAS + PsiElement(as)('as') + PsiErrorElement:Expecting identifier + PsiWhiteSpace(' ') PsiElement(SEMICOLON)(';') PsiWhiteSpace('\n') @@ -117,7 +120,8 @@ JetFile: Imports_ERR.kt PsiElement(MUL)('*') PsiWhiteSpace(' ') PsiErrorElement:Cannot rename all imported items to one identifier - PsiElement(as)('as') + IMPORT_ALIAS + PsiElement(as)('as') PsiElement(SEMICOLON)(';') PsiWhiteSpace('\n\n') IMPORT_DIRECTIVE @@ -126,69 +130,75 @@ JetFile: Imports_ERR.kt REFERENCE_EXPRESSION PsiElement(IDENTIFIER)('foo') PsiWhiteSpace(' ') - PsiElement(as)('as') - PsiWhiteSpace(' ') - PsiErrorElement:Expecting identifier - PsiElement(DOT)('.') - PsiWhiteSpace('\n') - IMPORT_DIRECTIVE - PsiElement(import)('import') - PsiWhiteSpace(' ') - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('foo') - PsiWhiteSpace(' ') - PsiElement(as)('as') - PsiErrorElement:Expecting identifier - - PsiWhiteSpace(' ') - PsiElement(SEMICOLON)(';') - PsiWhiteSpace('\n') - IMPORT_DIRECTIVE - PsiElement(import)('import') - PsiWhiteSpace(' ') - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('foo') - PsiWhiteSpace(' ') - PsiElement(as)('as') - PsiWhiteSpace(' ') - PsiErrorElement:Expecting identifier - PsiElement(MUL)('*') - PsiWhiteSpace('\n') - IMPORT_DIRECTIVE - PsiElement(import)('import') - PsiWhiteSpace(' ') - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('foo') - PsiWhiteSpace(' ') - PsiElement(as)('as') - PsiWhiteSpace(' ') - PsiElement(IDENTIFIER)('sdfsdf') - PsiWhiteSpace('\n') - IMPORT_DIRECTIVE - PsiElement(import)('import') - PsiWhiteSpace(' ') - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('foo') - PsiElement(DOT)('.') - PsiElement(MUL)('*') - PsiWhiteSpace(' ') - PsiErrorElement:Cannot rename all imported items to one identifier - PsiElement(as)('as') - PsiWhiteSpace(' ') - PsiElement(SEMICOLON)(';') - PsiWhiteSpace('\n') - IMPORT_DIRECTIVE - PsiElement(import)('import') - PsiWhiteSpace(' ') - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('foo') - PsiElement(DOT)('.') - PsiElement(MUL)('*') - PsiWhiteSpace(' ') - PsiErrorElement:Cannot rename all imported items to one identifier + IMPORT_ALIAS PsiElement(as)('as') PsiWhiteSpace(' ') - PsiElement(IDENTIFIER)('bar') + PsiErrorElement:Expecting identifier + PsiElement(DOT)('.') + PsiWhiteSpace('\n') + IMPORT_DIRECTIVE + PsiElement(import)('import') + PsiWhiteSpace(' ') + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('foo') + PsiWhiteSpace(' ') + IMPORT_ALIAS + PsiElement(as)('as') + PsiErrorElement:Expecting identifier + + PsiWhiteSpace(' ') + PsiElement(SEMICOLON)(';') + PsiWhiteSpace('\n') + IMPORT_DIRECTIVE + PsiElement(import)('import') + PsiWhiteSpace(' ') + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('foo') + PsiWhiteSpace(' ') + IMPORT_ALIAS + PsiElement(as)('as') + PsiWhiteSpace(' ') + PsiErrorElement:Expecting identifier + PsiElement(MUL)('*') + PsiWhiteSpace('\n') + IMPORT_DIRECTIVE + PsiElement(import)('import') + PsiWhiteSpace(' ') + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('foo') + PsiWhiteSpace(' ') + IMPORT_ALIAS + PsiElement(as)('as') + PsiWhiteSpace(' ') + PsiElement(IDENTIFIER)('sdfsdf') + PsiWhiteSpace('\n') + IMPORT_DIRECTIVE + PsiElement(import)('import') + PsiWhiteSpace(' ') + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('foo') + PsiElement(DOT)('.') + PsiElement(MUL)('*') + PsiWhiteSpace(' ') + PsiErrorElement:Cannot rename all imported items to one identifier + IMPORT_ALIAS + PsiElement(as)('as') + PsiWhiteSpace(' ') + PsiElement(SEMICOLON)(';') + PsiWhiteSpace('\n') + IMPORT_DIRECTIVE + PsiElement(import)('import') + PsiWhiteSpace(' ') + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('foo') + PsiElement(DOT)('.') + PsiElement(MUL)('*') + PsiWhiteSpace(' ') + PsiErrorElement:Cannot rename all imported items to one identifier + IMPORT_ALIAS + PsiElement(as)('as') + PsiWhiteSpace(' ') + PsiElement(IDENTIFIER)('bar') PsiWhiteSpace('\n') IMPORT_DIRECTIVE PsiElement(import)('import') @@ -213,9 +223,10 @@ JetFile: Imports_ERR.kt PsiErrorElement:Qualified name must be a '.'-separated identifier list PsiWhiteSpace(' ') - PsiElement(as)('as') - PsiWhiteSpace(' ') - PsiElement(IDENTIFIER)('bar') + IMPORT_ALIAS + PsiElement(as)('as') + PsiWhiteSpace(' ') + PsiElement(IDENTIFIER)('bar') PsiWhiteSpace('\n') IMPORT_DIRECTIVE PsiElement(import)('import') @@ -227,9 +238,10 @@ JetFile: Imports_ERR.kt PsiErrorElement:Qualified name must be a '.'-separated identifier list PsiWhiteSpace(' ') - PsiElement(as)('as') - PsiWhiteSpace(' ') - PsiElement(IDENTIFIER)('bar') + IMPORT_ALIAS + PsiElement(as)('as') + PsiWhiteSpace(' ') + PsiElement(IDENTIFIER)('bar') PsiWhiteSpace(' ') PsiElement(SEMICOLON)(';') PsiWhiteSpace('\n\n') @@ -246,9 +258,10 @@ JetFile: Imports_ERR.kt PsiElement(MUL)('*') PsiWhiteSpace(' ') PsiErrorElement:Cannot rename all imported items to one identifier - PsiElement(as)('as') - PsiWhiteSpace(' ') - PsiElement(IDENTIFIER)('bar') + IMPORT_ALIAS + PsiElement(as)('as') + PsiWhiteSpace(' ') + PsiElement(IDENTIFIER)('bar') PsiWhiteSpace('\n') IMPORT_DIRECTIVE PsiElement(import)('import') @@ -295,9 +308,10 @@ JetFile: Imports_ERR.kt PsiElement(MUL)('*') PsiWhiteSpace(' ') PsiErrorElement:Cannot rename all imported items to one identifier - PsiElement(as)('as') - PsiWhiteSpace(' ') - PsiElement(IDENTIFIER)('bar') + IMPORT_ALIAS + PsiElement(as)('as') + PsiWhiteSpace(' ') + PsiElement(IDENTIFIER)('bar') PsiWhiteSpace(' ') PsiElement(SEMICOLON)(';') PsiWhiteSpace('\n') @@ -314,7 +328,8 @@ JetFile: Imports_ERR.kt PsiElement(MUL)('*') PsiWhiteSpace(' ') PsiErrorElement:Cannot rename all imported items to one identifier - PsiElement(as)('as') + IMPORT_ALIAS + PsiElement(as)('as') PsiWhiteSpace(' ') PsiElement(SEMICOLON)(';') PsiWhiteSpace('\n')