CreateExpectedFix: should generate expect declaration in selected module
#KT-33933 Fixed
This commit is contained in:
@@ -62,6 +62,7 @@ sealed class CreateExpectedFix<D : KtNamedDeclaration>(
|
||||
if (otherDeclaration === originalDeclaration) continue
|
||||
if (!otherDeclaration.hasActualModifier()) continue
|
||||
val expectedDeclaration = otherDeclaration.liftToExpected() ?: continue
|
||||
if (expectedDeclaration.module != module) continue
|
||||
return expectedDeclaration.containingKtFile
|
||||
}
|
||||
return null
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
expect class First
|
||||
@@ -0,0 +1 @@
|
||||
expect class First
|
||||
@@ -0,0 +1,7 @@
|
||||
MODULE common { platform=[JVM, JS, Native] }
|
||||
MODULE jvm { platform=[JVM] }
|
||||
MODULE main { platform=[JVM (JVM_1_8)] }
|
||||
|
||||
jvm -> common { kind=DEPENDS_ON }
|
||||
main -> jvm { kind=DEPENDS_ON }
|
||||
main -> common { kind=DEPENDS_ON }
|
||||
@@ -0,0 +1 @@
|
||||
expect class <caret>Second
|
||||
@@ -0,0 +1,5 @@
|
||||
// "Create expected class in common module jvm" "true"
|
||||
// DISABLE-ERRORS
|
||||
actual class First
|
||||
|
||||
actual class <caret>Second
|
||||
@@ -0,0 +1,5 @@
|
||||
// "Create expected class in common module jvm" "true"
|
||||
// DISABLE-ERRORS
|
||||
actual class First
|
||||
|
||||
actual class Second
|
||||
+5
@@ -573,6 +573,11 @@ public class QuickFixMultiModuleTestGenerated extends AbstractQuickFixMultiModul
|
||||
runTest("idea/testData/multiModuleQuickFix/createExpect/functionWithImplementationInInterface2/");
|
||||
}
|
||||
|
||||
@TestMetadata("hierarchy")
|
||||
public void testHierarchy() throws Exception {
|
||||
runTest("idea/testData/multiModuleQuickFix/createExpect/hierarchy/");
|
||||
}
|
||||
|
||||
@TestMetadata("inlineClass")
|
||||
public void testInlineClass() throws Exception {
|
||||
runTest("idea/testData/multiModuleQuickFix/createExpect/inlineClass/");
|
||||
|
||||
Reference in New Issue
Block a user