Generate actual nested classes for actual owner class #KT-19937 Fixed
This commit is contained in:
@@ -201,7 +201,6 @@ private fun KtPsiFactory.generateClassOrObject(
|
|||||||
if (expectedClass !is KtClass || !expectedClass.isInterface()) {
|
if (expectedClass !is KtClass || !expectedClass.isInterface()) {
|
||||||
actualClass.declarations.forEach {
|
actualClass.declarations.forEach {
|
||||||
if (it !is KtEnumEntry &&
|
if (it !is KtEnumEntry &&
|
||||||
it !is KtClassOrObject &&
|
|
||||||
!it.hasModifier(KtTokens.ABSTRACT_KEYWORD)) {
|
!it.hasModifier(KtTokens.ABSTRACT_KEYWORD)) {
|
||||||
it.delete()
|
it.delete()
|
||||||
}
|
}
|
||||||
@@ -211,6 +210,13 @@ private fun KtPsiFactory.generateClassOrObject(
|
|||||||
if (expectedDeclaration.hasModifier(KtTokens.ABSTRACT_KEYWORD)) continue
|
if (expectedDeclaration.hasModifier(KtTokens.ABSTRACT_KEYWORD)) continue
|
||||||
val descriptor = expectedDeclaration.toDescriptor() ?: continue
|
val descriptor = expectedDeclaration.toDescriptor() ?: continue
|
||||||
val actualDeclaration: KtDeclaration = when (expectedDeclaration) {
|
val actualDeclaration: KtDeclaration = when (expectedDeclaration) {
|
||||||
|
is KtClassOrObject ->
|
||||||
|
if (expectedDeclaration !is KtEnumEntry) {
|
||||||
|
generateClassOrObject(project, expectedDeclaration, actualNeeded = true)
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
continue@declLoop
|
||||||
|
}
|
||||||
is KtFunction -> generateFunction(project, expectedDeclaration, descriptor as FunctionDescriptor, actualNeeded = true)
|
is KtFunction -> generateFunction(project, expectedDeclaration, descriptor as FunctionDescriptor, actualNeeded = true)
|
||||||
is KtProperty -> generateProperty(project, expectedDeclaration, descriptor as PropertyDescriptor, actualNeeded = true)
|
is KtProperty -> generateProperty(project, expectedDeclaration, descriptor as PropertyDescriptor, actualNeeded = true)
|
||||||
else -> continue@declLoop
|
else -> continue@declLoop
|
||||||
|
|||||||
@@ -1,15 +1,15 @@
|
|||||||
// WithNested: to be implemented
|
// WithNested: to be implemented
|
||||||
actual class WithNested {
|
actual class WithNested {
|
||||||
|
|
||||||
class Nested {
|
|
||||||
fun bar()
|
|
||||||
}
|
|
||||||
|
|
||||||
inner class Inner {
|
|
||||||
fun baz()
|
|
||||||
}
|
|
||||||
|
|
||||||
actual fun foo(): Int {
|
actual fun foo(): Int {
|
||||||
TODO("not implemented") //To change body of created functions use File | Settings | File Templates.
|
TODO("not implemented") //To change body of created functions use File | Settings | File Templates.
|
||||||
}
|
}
|
||||||
|
|
||||||
|
actual class Nested {
|
||||||
|
actual fun bar() {}
|
||||||
|
}
|
||||||
|
|
||||||
|
actual inner class Inner {
|
||||||
|
actual fun baz() {}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
// Sealed: to be implemented
|
// Sealed: to be implemented
|
||||||
actual sealed class Sealed {
|
actual sealed class Sealed {
|
||||||
object Obj : Sealed
|
actual object Obj : Sealed
|
||||||
|
actual class Klass(x: Int) : Sealed
|
||||||
|
|
||||||
class Klass(x: Int) : Sealed
|
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user