KT-15309 Don't apply "Fix with 'asDynamic'" to member extension funcitons
This commit is contained in:
+2
-2
@@ -65,7 +65,7 @@ class MigrateExternalExtensionFix(declaration: KtNamedDeclaration)
|
||||
}
|
||||
|
||||
private fun fixNativeClass(containingClass: KtClassOrObject) {
|
||||
val membersToFix = containingClass.declarations.filterIsInstance<KtCallableDeclaration>().filter { isMemberDeclaration(it) }. map {
|
||||
val membersToFix = containingClass.declarations.filterIsInstance<KtCallableDeclaration>().filter { isMemberDeclaration(it) && !isMemberExtensionDeclaration(it) }. map {
|
||||
it to fetchJsNativeAnnotations(it)
|
||||
}.filter {
|
||||
it.second.annotations.isNotEmpty()
|
||||
@@ -251,7 +251,7 @@ class MigrateExternalExtensionFix(declaration: KtNamedDeclaration)
|
||||
val e = diagnostic.psiElement
|
||||
when (diagnostic.factory) {
|
||||
ErrorsJs.WRONG_EXTERNAL_DECLARATION -> {
|
||||
if (isMemberExtensionDeclaration(e)) {
|
||||
if (isMemberExtensionDeclaration(e) && e.getParentOfType<KtClassOrObject>(true) == null) {
|
||||
return MigrateExternalExtensionFix(e as KtNamedDeclaration)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
// "Fix with 'asDynamic'" "true"
|
||||
// JS
|
||||
// ERROR: Declaration of such kind (extension function) cant be external
|
||||
|
||||
external class B {
|
||||
@nativeGetter
|
||||
@@ -15,4 +16,6 @@ external class B {
|
||||
fun<T> exp(t: T)
|
||||
|
||||
fun dontTouch(): Nothing = definedExternally
|
||||
|
||||
fun B.doNotTouchNestedExtensionMembers(): Nothing = definedExternally
|
||||
}
|
||||
@@ -1,9 +1,12 @@
|
||||
// "Fix with 'asDynamic'" "true"
|
||||
// JS
|
||||
// ERROR: Declaration of such kind (extension function) cant be external
|
||||
|
||||
external class B {
|
||||
|
||||
fun dontTouch(): Nothing = definedExternally
|
||||
|
||||
fun B.doNotTouchNestedExtensionMembers(): Nothing = definedExternally
|
||||
}
|
||||
|
||||
@Suppress("NOTHING_TO_INLINE")
|
||||
|
||||
@@ -6558,6 +6558,12 @@ public class QuickFixTestGenerated extends AbstractQuickFixTest {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/quickfix/migration/jsExternal/nativeSetterExtensionFunJsRuntime.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("nestedExtension01.kt")
|
||||
public void testNestedExtension01() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/quickfix/migration/jsExternal/nestedExtension01.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
}
|
||||
|
||||
@TestMetadata("idea/testData/quickfix/migration/missingConstructorKeyword")
|
||||
|
||||
-1
@@ -53,5 +53,4 @@ public class SourceMapGenerationSmokeTestGenerated extends AbstractSourceMapGene
|
||||
String fileName = KotlinTestUtils.navigationMetadata("js/js.translator/testData/sourcemap/methodCallInMethod.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user