Allow "create actual" for function even if partially-compatible exists

So #KT-20163 Fixed
This commit is contained in:
Mikhail Glukhikh
2017-10-03 15:52:12 +03:00
parent e8321be380
commit aff689afba
5 changed files with 22 additions and 1 deletions
@@ -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
+3
View File
@@ -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.
}