Allow "create actual" for function even if partially-compatible exists
So #KT-20163 Fixed
This commit is contained in:
@@ -137,7 +137,8 @@ sealed class CreateActualFix<out D : KtNamedDeclaration>(
|
||||
val d = DiagnosticFactory.cast(diagnostic, Errors.NO_ACTUAL_FOR_EXPECT)
|
||||
val declaration = d.psiElement as? KtNamedDeclaration ?: return null
|
||||
val compatibility = d.c
|
||||
if (compatibility.isNotEmpty()) return null
|
||||
// For function we allow it, because overloads are possible
|
||||
if (compatibility.isNotEmpty() && declaration !is KtFunction) return null
|
||||
val actualPlatform = d.b.getMultiTargetPlatform() as? MultiTargetPlatform.Specific ?: return null
|
||||
return when (declaration) {
|
||||
is KtClassOrObject -> CreateActualClassFix(declaration, actualPlatform)
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
// "Create actual function for platform JVM" "true"
|
||||
|
||||
expect fun <caret>foo(arg: Int): String
|
||||
|
||||
expect fun foo(arg: String): String
|
||||
@@ -0,0 +1,5 @@
|
||||
// "Create actual function for platform JVM" "true"
|
||||
|
||||
expect fun foo(arg: Int): String
|
||||
|
||||
expect fun foo(arg: String): String
|
||||
@@ -0,0 +1,3 @@
|
||||
// foo: to be implemented
|
||||
|
||||
actual fun foo(arg: String) = arg
|
||||
@@ -0,0 +1,7 @@
|
||||
// foo: to be implemented
|
||||
|
||||
actual fun foo(arg: String) = arg
|
||||
|
||||
actual fun foo(arg: Int): String {
|
||||
TODO("not implemented") //To change body of created functions use File | Settings | File Templates.
|
||||
}
|
||||
Reference in New Issue
Block a user