Generate (possibly empty) file classes for files with type aliases.
This commit is contained in:
@@ -99,7 +99,7 @@ public class PackageCodegen {
|
|||||||
List<KtClassOrObject> classOrObjects = new ArrayList<KtClassOrObject>();
|
List<KtClassOrObject> classOrObjects = new ArrayList<KtClassOrObject>();
|
||||||
|
|
||||||
for (KtDeclaration declaration : file.getDeclarations()) {
|
for (KtDeclaration declaration : file.getDeclarations()) {
|
||||||
if (declaration instanceof KtProperty || declaration instanceof KtNamedFunction) {
|
if (declaration instanceof KtProperty || declaration instanceof KtNamedFunction || declaration instanceof KtTypeAlias) {
|
||||||
generatePackagePart = true;
|
generatePackagePart = true;
|
||||||
}
|
}
|
||||||
else if (declaration instanceof KtClassOrObject) {
|
else if (declaration instanceof KtClassOrObject) {
|
||||||
|
|||||||
@@ -0,0 +1,2 @@
|
|||||||
|
typealias S = String
|
||||||
|
typealias L<T> = List<T>
|
||||||
@@ -47,6 +47,12 @@ class KtFileLightClassTest : KotlinLightCodeInsightFixtureTestCase() {
|
|||||||
assertEquals(1, aClass.findMethodsByName("bar", false).size)
|
assertEquals(1, aClass.findMethodsByName("bar", false).size)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun testAliasesOnly() {
|
||||||
|
val file = myFixture.configureByFile("aliasesOnly.kt") as KtFile
|
||||||
|
val aClass = file.classes.single()
|
||||||
|
assertEquals(0, aClass.getMethods().size)
|
||||||
|
}
|
||||||
|
|
||||||
override fun getTestDataPath(): String? {
|
override fun getTestDataPath(): String? {
|
||||||
return PluginTestCaseBase.getTestDataPathBase() + "/asJava/fileLightClass/"
|
return PluginTestCaseBase.getTestDataPathBase() + "/asJava/fileLightClass/"
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user