Fix create expected for non-actual nested class case
This commit is contained in:
@@ -213,6 +213,7 @@ private fun KtPsiFactory.generateClassOrObjectByActualClass(
|
||||
|
||||
declLoop@ for (actualDeclaration in actualClass.declarations) {
|
||||
val descriptor = actualDeclaration.toDescriptor() ?: continue
|
||||
if (!actualDeclaration.hasActualModifier()) continue@declLoop
|
||||
val expectedDeclaration: KtDeclaration = when (actualDeclaration) {
|
||||
is KtClassOrObject ->
|
||||
if (actualDeclaration !is KtEnumEntry) {
|
||||
@@ -221,7 +222,6 @@ private fun KtPsiFactory.generateClassOrObjectByActualClass(
|
||||
continue@declLoop
|
||||
}
|
||||
is KtCallableDeclaration -> {
|
||||
if (!actualDeclaration.hasActualModifier()) continue@declLoop
|
||||
when (actualDeclaration) {
|
||||
is KtFunction ->
|
||||
generateFunction(project, actualDeclaration, descriptor as FunctionDescriptor, expectedClass, outerExpectedClasses)
|
||||
|
||||
+2
@@ -0,0 +1,2 @@
|
||||
expect class My {
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
// "Create expected class in common module testModule_Common" "true"
|
||||
// DISABLE-ERRORS
|
||||
|
||||
actual class <caret>My {
|
||||
inner class Nested(val s: String) {
|
||||
fun hello() = s
|
||||
|
||||
var ss = s
|
||||
|
||||
class OtherNested(var d: Double) {
|
||||
val dd = d
|
||||
}
|
||||
}
|
||||
}
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
// "Create expected class in common module testModule_Common" "true"
|
||||
// DISABLE-ERRORS
|
||||
|
||||
actual class My {
|
||||
inner class Nested(val s: String) {
|
||||
fun hello() = s
|
||||
|
||||
var ss = s
|
||||
|
||||
class OtherNested(var d: Double) {
|
||||
val dd = d
|
||||
}
|
||||
}
|
||||
}
|
||||
+5
@@ -294,6 +294,11 @@ public class QuickFixMultiModuleTestGenerated extends AbstractQuickFixMultiModul
|
||||
runTest("idea/testData/multiModuleQuickFix/expectClassWithAliases/");
|
||||
}
|
||||
|
||||
@TestMetadata("expectClassWithPlatformNested")
|
||||
public void testExpectClassWithPlatformNested() throws Exception {
|
||||
runTest("idea/testData/multiModuleQuickFix/expectClassWithPlatformNested/");
|
||||
}
|
||||
|
||||
@TestMetadata("expectClassWithSupertype")
|
||||
public void testExpectClassWithSupertype() throws Exception {
|
||||
runTest("idea/testData/multiModuleQuickFix/expectClassWithSupertype/");
|
||||
|
||||
Reference in New Issue
Block a user