KTIJ-27139 [AA] Shorten qualified expressions only when the callee/type reference is in selection

If you want to shorten call like `foo.bar()` into `bar()`, then you
need your range to intersect with `bar` callee reference. Having only
`foo` in the range is not enough

Same goes for the type references - to shorten `foo.Bar` into `Bar`, you
need at least some intersection of your range with `Bar` reference

^KTIJ-27139 Fixed
^KTIJ-27015 Fixed
This commit is contained in:
Roman Golyshev
2023-09-22 18:54:25 +02:00
committed by teamcity
parent ecbf69504a
commit d2fcd71d23
19 changed files with 244 additions and 6 deletions
@@ -340,6 +340,54 @@ public class FirStandaloneNormalAnalysisSourceModuleReferenceShortenerTestGenera
runTest("analysis/analysis-api/testData/components/referenceShortener/referenceShortener/parameterTypeTopLevelTypeLoses.kt");
}
@Test
@TestMetadata("partiallySelectedQualifiedCall1.kt")
public void testPartiallySelectedQualifiedCall1() throws Exception {
runTest("analysis/analysis-api/testData/components/referenceShortener/referenceShortener/partiallySelectedQualifiedCall1.kt");
}
@Test
@TestMetadata("partiallySelectedQualifiedCall2.kt")
public void testPartiallySelectedQualifiedCall2() throws Exception {
runTest("analysis/analysis-api/testData/components/referenceShortener/referenceShortener/partiallySelectedQualifiedCall2.kt");
}
@Test
@TestMetadata("partiallySelectedQualifiedCall3.kt")
public void testPartiallySelectedQualifiedCall3() throws Exception {
runTest("analysis/analysis-api/testData/components/referenceShortener/referenceShortener/partiallySelectedQualifiedCall3.kt");
}
@Test
@TestMetadata("partiallySelectedQualifiedCall4.kt")
public void testPartiallySelectedQualifiedCall4() throws Exception {
runTest("analysis/analysis-api/testData/components/referenceShortener/referenceShortener/partiallySelectedQualifiedCall4.kt");
}
@Test
@TestMetadata("partiallySelectedType1.kt")
public void testPartiallySelectedType1() throws Exception {
runTest("analysis/analysis-api/testData/components/referenceShortener/referenceShortener/partiallySelectedType1.kt");
}
@Test
@TestMetadata("partiallySelectedType2.kt")
public void testPartiallySelectedType2() throws Exception {
runTest("analysis/analysis-api/testData/components/referenceShortener/referenceShortener/partiallySelectedType2.kt");
}
@Test
@TestMetadata("partiallySelectedTypeQualifier1.kt")
public void testPartiallySelectedTypeQualifier1() throws Exception {
runTest("analysis/analysis-api/testData/components/referenceShortener/referenceShortener/partiallySelectedTypeQualifier1.kt");
}
@Test
@TestMetadata("partiallySelectedTypeQualifier2.kt")
public void testPartiallySelectedTypeQualifier2() throws Exception {
runTest("analysis/analysis-api/testData/components/referenceShortener/referenceShortener/partiallySelectedTypeQualifier2.kt");
}
@Test
@TestMetadata("qualifierOfUnresolvedReference.kt")
public void testQualifierOfUnresolvedReference() throws Exception {