Extraction Engine: Report conflict on all diagnostics from UNRESOLVED_REFERENCE group

#KT-9117 Fixed
This commit is contained in:
Alexey Sedunov
2015-09-14 20:16:08 +03:00
parent 767897dccf
commit 0fbcf0b958
4 changed files with 21 additions and 1 deletions
@@ -1020,7 +1020,7 @@ fun ExtractableCodeDescriptor.validate(): ExtractableCodeDescriptorWithConflicts
if (currentDescriptor is LocalVariableDescriptor
&& parameters.any { it.mirrorVarName == currentDescriptor.getName().asString() }) continue
if (diagnostics.any { it.getFactory() == Errors.UNRESOLVED_REFERENCE }
if (diagnostics.any { it.getFactory() in Errors.UNRESOLVED_REFERENCE_DIAGNOSTICS }
|| (currentDescriptor != null
&& !ErrorUtils.isError(currentDescriptor)
&& !comparePossiblyOverridingDescriptors(extractionData.project, currentDescriptor, resolveResult.descriptor))) {
@@ -0,0 +1,13 @@
// SIBLING:
class A {
fun foo() {
val a = B()
<selection>a.unresolved()</selection>
}
private fun B.unresolved() = 1
}
class B
private fun A.unresolved() = 1
@@ -0,0 +1 @@
Function A.unresolved will no longer be accessible after extraction
@@ -695,6 +695,12 @@ public class JetExtractionTestGenerated extends AbstractJetExtractionTest {
String fileName = JetTestUtils.navigationMetadata("idea/testData/refactoring/extractFunction/basic/traitFunction.kt");
doExtractFunctionTest(fileName);
}
@TestMetadata("unresolvedWrongReceiver.kt")
public void testUnresolvedWrongReceiver() throws Exception {
String fileName = JetTestUtils.navigationMetadata("idea/testData/refactoring/extractFunction/basic/unresolvedWrongReceiver.kt");
doExtractFunctionTest(fileName);
}
}
@TestMetadata("idea/testData/refactoring/extractFunction/controlFlow")