Add actual: handle (incorrect) case with expect function with body
So #KT-23326 Fixed
This commit is contained in:
@@ -327,7 +327,9 @@ private fun KtPsiFactory.generateFunction(
|
||||
): KtFunction {
|
||||
val returnType = descriptor.returnType
|
||||
val body = run {
|
||||
if (returnType != null && !KotlinBuiltIns.isUnit(returnType)) {
|
||||
if (expectedFunction.hasBody()) {
|
||||
""
|
||||
} else if (returnType != null && !KotlinBuiltIns.isUnit(returnType)) {
|
||||
val delegation = getFunctionBodyTextFromTemplate(
|
||||
project,
|
||||
TemplateKind.FUNCTION,
|
||||
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
// DISABLE-ERRORS
|
||||
|
||||
expect class My {
|
||||
// Incompilable function
|
||||
fun foo() {}
|
||||
}
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
// DISABLE-ERRORS
|
||||
|
||||
expect class My {
|
||||
// Incompilable function
|
||||
fun foo() {}
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
// "Add missing actual members" "true"
|
||||
// DISABLE-ERRORS
|
||||
|
||||
actual class <caret>My
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
// "Add missing actual members" "true"
|
||||
// DISABLE-ERRORS
|
||||
|
||||
actual class My {
|
||||
// Incompilable function
|
||||
actual fun foo() {}
|
||||
}
|
||||
+5
@@ -109,6 +109,11 @@ public class QuickFixMultiModuleTestGenerated extends AbstractQuickFixMultiModul
|
||||
runTest("idea/testData/multiModuleQuickFix/classSomeProperties/");
|
||||
}
|
||||
|
||||
@TestMetadata("classWithIncompilableFunction")
|
||||
public void testClassWithIncompilableFunction() throws Exception {
|
||||
runTest("idea/testData/multiModuleQuickFix/classWithIncompilableFunction/");
|
||||
}
|
||||
|
||||
@TestMetadata("companionAbsence")
|
||||
public void testCompanionAbsence() throws Exception {
|
||||
runTest("idea/testData/multiModuleQuickFix/companionAbsence/");
|
||||
|
||||
Reference in New Issue
Block a user