Pull Members Up: Skip visibility checking between members to move
This commit is contained in:
@@ -147,6 +147,7 @@ private fun KotlinPullUpData.checkVisibility(
|
|||||||
conflicts: MultiMap<PsiElement, String>
|
conflicts: MultiMap<PsiElement, String>
|
||||||
) {
|
) {
|
||||||
fun reportConflictIfAny(targetDescriptor: DeclarationDescriptor) {
|
fun reportConflictIfAny(targetDescriptor: DeclarationDescriptor) {
|
||||||
|
if (targetDescriptor in memberDescriptors.values) return
|
||||||
val target = (targetDescriptor as? DeclarationDescriptorWithSource)?.source?.getPsi() ?: return
|
val target = (targetDescriptor as? DeclarationDescriptorWithSource)?.source?.getPsi() ?: return
|
||||||
if (targetDescriptor is DeclarationDescriptorWithVisibility
|
if (targetDescriptor is DeclarationDescriptorWithVisibility
|
||||||
&& !Visibilities.isVisibleWithIrrelevantReceiver(targetDescriptor, targetClassDescriptor)) {
|
&& !Visibilities.isVisibleWithIrrelevantReceiver(targetDescriptor, targetClassDescriptor)) {
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ class <caret>B: A() {
|
|||||||
// INFO: {"checked": "false"}
|
// INFO: {"checked": "false"}
|
||||||
private fun foo() = 1
|
private fun foo() = 1
|
||||||
|
|
||||||
// INFO: {"checked": "true"}
|
// INFO: {"checked": "false"}
|
||||||
private class Z(n: Int)
|
private class Z(n: Int)
|
||||||
|
|
||||||
// INFO: {"checked": "true"}
|
// INFO: {"checked": "true"}
|
||||||
|
|||||||
@@ -0,0 +1,8 @@
|
|||||||
|
open class Temp1
|
||||||
|
open class <caret>Temp2 : Temp1() {
|
||||||
|
// INFO: {"checked": "true"}
|
||||||
|
private val used: Int = 1
|
||||||
|
// INFO: {"checked": "true"}
|
||||||
|
private val using: Int = used + 1
|
||||||
|
}
|
||||||
|
class Temp3 : Temp2()
|
||||||
+10
@@ -0,0 +1,10 @@
|
|||||||
|
open class Temp1 {
|
||||||
|
// INFO: {"checked": "true"}
|
||||||
|
private val used: Int = 1
|
||||||
|
// INFO: {"checked": "true"}
|
||||||
|
private val using: Int = used + 1
|
||||||
|
}
|
||||||
|
|
||||||
|
open class Temp2 : Temp1() {
|
||||||
|
}
|
||||||
|
class Temp3 : Temp2()
|
||||||
@@ -181,6 +181,12 @@ public class PullUpTestGenerated extends AbstractPullUpTest {
|
|||||||
doKotlinTest(fileName);
|
doKotlinTest(fileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("noVisibilityCheckBetweenMovedMembers.kt")
|
||||||
|
public void testNoVisibilityCheckBetweenMovedMembers() throws Exception {
|
||||||
|
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/refactoring/pullUp/k2k/noVisibilityCheckBetweenMovedMembers.kt");
|
||||||
|
doKotlinTest(fileName);
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("outsideOfClass.kt")
|
@TestMetadata("outsideOfClass.kt")
|
||||||
public void testOutsideOfClass() throws Exception {
|
public void testOutsideOfClass() throws Exception {
|
||||||
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/refactoring/pullUp/k2k/outsideOfClass.kt");
|
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/refactoring/pullUp/k2k/outsideOfClass.kt");
|
||||||
|
|||||||
Reference in New Issue
Block a user