KT-12949 Type aliases are not considered for import when there is an unresolved reference

#KT-12949 Fixed
This commit is contained in:
Valentin Kipyatkov
2016-09-07 19:36:16 +03:00
parent e41ab2a270
commit 19ef29e96c
5 changed files with 25 additions and 0 deletions
@@ -197,6 +197,8 @@ internal abstract class OrdinaryImportFixBase<T : KtExpression>(expression: T) :
indicesHelper.getJvmClassesByName(name).filterTo(result, filterByCallType)
}
indicesHelper.getTopLevelTypeAliases { it == name }.filterTo(result, filterByCallType)
indicesHelper.getTopLevelCallablesByName(name).filterTo(result, filterByCallType)
}
}
@@ -0,0 +1,8 @@
import dependency.TestAlias
// "Import" "true"
// ERROR: Unresolved reference: TestAlias
fun test() {
val a = <caret>TestAlias
}
@@ -0,0 +1,3 @@
package dependency
typealias TestAlias = () -> Unit
@@ -0,0 +1,6 @@
// "Import" "true"
// ERROR: Unresolved reference: TestAlias
fun test() {
val a = <caret>TestAlias
}
@@ -473,6 +473,12 @@ public class QuickFixMultiFileTestGenerated extends AbstractQuickFixMultiFileTes
doTestWithExtraFile(fileName);
}
@TestMetadata("typeAliasImport.before.Main.kt")
public void testTypeAliasImport() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/quickfix/autoImports/typeAliasImport.before.Main.kt");
doTestWithExtraFile(fileName);
}
@TestMetadata("unaryMinusOperator.before.Main.kt")
public void testUnaryMinusOperator() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/quickfix/autoImports/unaryMinusOperator.before.Main.kt");