KT-62676 [AA] Collect redundant this qualifiers in reference shortener
^KT-62676 Fixed
This commit is contained in:
+8
-4
@@ -102,6 +102,7 @@ internal class KtFirReferenceShortener(
|
|||||||
//TODO: collect all usages of available symbols in the file and prevent importing symbols that could introduce name clashes, which
|
//TODO: collect all usages of available symbols in the file and prevent importing symbols that could introduce name clashes, which
|
||||||
// may alter the meaning of existing code.
|
// may alter the meaning of existing code.
|
||||||
val collector = ElementsToShortenCollector(
|
val collector = ElementsToShortenCollector(
|
||||||
|
shortenOptions,
|
||||||
context,
|
context,
|
||||||
towerContext,
|
towerContext,
|
||||||
selection,
|
selection,
|
||||||
@@ -404,6 +405,7 @@ private class ShortenKDocQualifier(
|
|||||||
) : ElementToShorten()
|
) : ElementToShorten()
|
||||||
|
|
||||||
private class ElementsToShortenCollector(
|
private class ElementsToShortenCollector(
|
||||||
|
private val shortenOptions: ShortenOptions,
|
||||||
private val shorteningContext: FirShorteningContext,
|
private val shorteningContext: FirShorteningContext,
|
||||||
private val towerContextProvider: FirTowerContextProvider,
|
private val towerContextProvider: FirTowerContextProvider,
|
||||||
private val selection: TextRange,
|
private val selection: TextRange,
|
||||||
@@ -1138,11 +1140,13 @@ private class ElementsToShortenCollector(
|
|||||||
}
|
}
|
||||||
|
|
||||||
private fun canBePossibleToDropReceiver(qualifiedAccess: FirQualifiedAccessExpression): Boolean {
|
private fun canBePossibleToDropReceiver(qualifiedAccess: FirQualifiedAccessExpression): Boolean {
|
||||||
// we can remove receiver only if it is a qualifier
|
return when {
|
||||||
if (qualifiedAccess.explicitReceiver !is FirResolvedQualifier) return false
|
qualifiedAccess.explicitReceiver is FirThisReceiverExpression -> shortenOptions.removeThis
|
||||||
|
|
||||||
// if there is no extension receiver necessary, then it can be removed
|
qualifiedAccess.explicitReceiver is FirResolvedQualifier -> qualifiedAccess.extensionReceiver == null
|
||||||
return qualifiedAccess.extensionReceiver == null
|
|
||||||
|
else -> false
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun findUnambiguousReferencedCallableId(namedReference: FirNamedReference): FirCallableSymbol<*>? {
|
private fun findUnambiguousReferencedCallableId(namedReference: FirNamedReference): FirCallableSymbol<*>? {
|
||||||
|
|||||||
+10
@@ -72,6 +72,16 @@ public class FirIdeNormalAnalysisScriptSourceModuleReferenceShortenerTestGenerat
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Nested
|
||||||
|
@TestMetadata("analysis/analysis-api/testData/components/referenceShortener/referenceShortener/thisReference")
|
||||||
|
@TestDataPath("$PROJECT_ROOT")
|
||||||
|
public class ThisReference {
|
||||||
|
@Test
|
||||||
|
public void testAllFilesPresentInThisReference() throws Exception {
|
||||||
|
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("analysis/analysis-api/testData/components/referenceShortener/referenceShortener/thisReference"), Pattern.compile("^(.+)\\.kts$"), null, true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Nested
|
@Nested
|
||||||
@TestMetadata("analysis/analysis-api/testData/components/referenceShortener/referenceShortener/typeParameters")
|
@TestMetadata("analysis/analysis-api/testData/components/referenceShortener/referenceShortener/typeParameters")
|
||||||
@TestDataPath("$PROJECT_ROOT")
|
@TestDataPath("$PROJECT_ROOT")
|
||||||
|
|||||||
+88
@@ -816,6 +816,94 @@ public class FirIdeNormalAnalysisSourceModuleReferenceShortenerTestGenerated ext
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Nested
|
||||||
|
@TestMetadata("analysis/analysis-api/testData/components/referenceShortener/referenceShortener/thisReference")
|
||||||
|
@TestDataPath("$PROJECT_ROOT")
|
||||||
|
public class ThisReference {
|
||||||
|
@Test
|
||||||
|
public void testAllFilesPresentInThisReference() throws Exception {
|
||||||
|
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("analysis/analysis-api/testData/components/referenceShortener/referenceShortener/thisReference"), Pattern.compile("^(.+)\\.kt$"), null, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("this_extensionFunction_fromExtensionFunction.kt")
|
||||||
|
public void testThis_extensionFunction_fromExtensionFunction() throws Exception {
|
||||||
|
runTest("analysis/analysis-api/testData/components/referenceShortener/referenceShortener/thisReference/this_extensionFunction_fromExtensionFunction.kt");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("this_extensionFunction_fromExtensionFunction_conflictWithLocal.kt")
|
||||||
|
public void testThis_extensionFunction_fromExtensionFunction_conflictWithLocal() throws Exception {
|
||||||
|
runTest("analysis/analysis-api/testData/components/referenceShortener/referenceShortener/thisReference/this_extensionFunction_fromExtensionFunction_conflictWithLocal.kt");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("this_memberFunction_fromMemberFunction.kt")
|
||||||
|
public void testThis_memberFunction_fromMemberFunction() throws Exception {
|
||||||
|
runTest("analysis/analysis-api/testData/components/referenceShortener/referenceShortener/thisReference/this_memberFunction_fromMemberFunction.kt");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("this_memberFunction_fromMemberFunction_conflictWithLocal.kt")
|
||||||
|
public void testThis_memberFunction_fromMemberFunction_conflictWithLocal() throws Exception {
|
||||||
|
runTest("analysis/analysis-api/testData/components/referenceShortener/referenceShortener/thisReference/this_memberFunction_fromMemberFunction_conflictWithLocal.kt");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("this_memberProperty_fromInit.kt")
|
||||||
|
public void testThis_memberProperty_fromInit() throws Exception {
|
||||||
|
runTest("analysis/analysis-api/testData/components/referenceShortener/referenceShortener/thisReference/this_memberProperty_fromInit.kt");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("this_memberProperty_fromInit_conflictWithParameter.kt")
|
||||||
|
public void testThis_memberProperty_fromInit_conflictWithParameter() throws Exception {
|
||||||
|
runTest("analysis/analysis-api/testData/components/referenceShortener/referenceShortener/thisReference/this_memberProperty_fromInit_conflictWithParameter.kt");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("this_memberProperty_fromMemberFunction.kt")
|
||||||
|
public void testThis_memberProperty_fromMemberFunction() throws Exception {
|
||||||
|
runTest("analysis/analysis-api/testData/components/referenceShortener/referenceShortener/thisReference/this_memberProperty_fromMemberFunction.kt");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("this_memberProperty_fromMemberFunctionWithContextReceiver.kt")
|
||||||
|
public void testThis_memberProperty_fromMemberFunctionWithContextReceiver() throws Exception {
|
||||||
|
runTest("analysis/analysis-api/testData/components/referenceShortener/referenceShortener/thisReference/this_memberProperty_fromMemberFunctionWithContextReceiver.kt");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("this_memberProperty_fromMemberFunction_conflictWithLocal.kt")
|
||||||
|
public void testThis_memberProperty_fromMemberFunction_conflictWithLocal() throws Exception {
|
||||||
|
runTest("analysis/analysis-api/testData/components/referenceShortener/referenceShortener/thisReference/this_memberProperty_fromMemberFunction_conflictWithLocal.kt");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("this_memberProperty_fromMemberFunction_conflictWithParameter.kt")
|
||||||
|
public void testThis_memberProperty_fromMemberFunction_conflictWithParameter() throws Exception {
|
||||||
|
runTest("analysis/analysis-api/testData/components/referenceShortener/referenceShortener/thisReference/this_memberProperty_fromMemberFunction_conflictWithParameter.kt");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("this_memberProperty_fromMemberFunction_noConflictWithLocal.kt")
|
||||||
|
public void testThis_memberProperty_fromMemberFunction_noConflictWithLocal() throws Exception {
|
||||||
|
runTest("analysis/analysis-api/testData/components/referenceShortener/referenceShortener/thisReference/this_memberProperty_fromMemberFunction_noConflictWithLocal.kt");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("this_nullableReceiver.kt")
|
||||||
|
public void testThis_nullableReceiver() throws Exception {
|
||||||
|
runTest("analysis/analysis-api/testData/components/referenceShortener/referenceShortener/thisReference/this_nullableReceiver.kt");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("this_safeCall.kt")
|
||||||
|
public void testThis_safeCall() throws Exception {
|
||||||
|
runTest("analysis/analysis-api/testData/components/referenceShortener/referenceShortener/thisReference/this_safeCall.kt");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Nested
|
@Nested
|
||||||
@TestMetadata("analysis/analysis-api/testData/components/referenceShortener/referenceShortener/typeParameters")
|
@TestMetadata("analysis/analysis-api/testData/components/referenceShortener/referenceShortener/typeParameters")
|
||||||
@TestDataPath("$PROJECT_ROOT")
|
@TestDataPath("$PROJECT_ROOT")
|
||||||
|
|||||||
+2
@@ -5,6 +5,7 @@
|
|||||||
|
|
||||||
package org.jetbrains.kotlin.analysis.api.impl.base.test.cases.references
|
package org.jetbrains.kotlin.analysis.api.impl.base.test.cases.references
|
||||||
|
|
||||||
|
import org.jetbrains.kotlin.analysis.api.components.ShortenOptions
|
||||||
import org.jetbrains.kotlin.analysis.api.components.ShortenStrategy
|
import org.jetbrains.kotlin.analysis.api.components.ShortenStrategy
|
||||||
import org.jetbrains.kotlin.analysis.api.impl.base.test.cases.references.ShorteningResultsRenderer.renderShorteningResults
|
import org.jetbrains.kotlin.analysis.api.impl.base.test.cases.references.ShorteningResultsRenderer.renderShorteningResults
|
||||||
import org.jetbrains.kotlin.analysis.test.framework.base.AbstractAnalysisApiBasedSingleModuleTest
|
import org.jetbrains.kotlin.analysis.test.framework.base.AbstractAnalysisApiBasedSingleModuleTest
|
||||||
@@ -30,6 +31,7 @@ abstract class AbstractReferenceShortenerTest : AbstractAnalysisApiBasedSingleMo
|
|||||||
ShortenStrategy.values().map { option ->
|
ShortenStrategy.values().map { option ->
|
||||||
val shorteningsForOption = collectPossibleReferenceShorteningsInElement(
|
val shorteningsForOption = collectPossibleReferenceShorteningsInElement(
|
||||||
element,
|
element,
|
||||||
|
shortenOptions = ShortenOptions.ALL_ENABLED,
|
||||||
classShortenStrategy = { option },
|
classShortenStrategy = { option },
|
||||||
callableShortenStrategy = { option }
|
callableShortenStrategy = { option }
|
||||||
)
|
)
|
||||||
|
|||||||
+88
@@ -816,6 +816,94 @@ public class FirStandaloneNormalAnalysisSourceModuleReferenceShortenerTestGenera
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Nested
|
||||||
|
@TestMetadata("analysis/analysis-api/testData/components/referenceShortener/referenceShortener/thisReference")
|
||||||
|
@TestDataPath("$PROJECT_ROOT")
|
||||||
|
public class ThisReference {
|
||||||
|
@Test
|
||||||
|
public void testAllFilesPresentInThisReference() throws Exception {
|
||||||
|
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("analysis/analysis-api/testData/components/referenceShortener/referenceShortener/thisReference"), Pattern.compile("^(.+)\\.kt$"), null, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("this_extensionFunction_fromExtensionFunction.kt")
|
||||||
|
public void testThis_extensionFunction_fromExtensionFunction() throws Exception {
|
||||||
|
runTest("analysis/analysis-api/testData/components/referenceShortener/referenceShortener/thisReference/this_extensionFunction_fromExtensionFunction.kt");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("this_extensionFunction_fromExtensionFunction_conflictWithLocal.kt")
|
||||||
|
public void testThis_extensionFunction_fromExtensionFunction_conflictWithLocal() throws Exception {
|
||||||
|
runTest("analysis/analysis-api/testData/components/referenceShortener/referenceShortener/thisReference/this_extensionFunction_fromExtensionFunction_conflictWithLocal.kt");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("this_memberFunction_fromMemberFunction.kt")
|
||||||
|
public void testThis_memberFunction_fromMemberFunction() throws Exception {
|
||||||
|
runTest("analysis/analysis-api/testData/components/referenceShortener/referenceShortener/thisReference/this_memberFunction_fromMemberFunction.kt");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("this_memberFunction_fromMemberFunction_conflictWithLocal.kt")
|
||||||
|
public void testThis_memberFunction_fromMemberFunction_conflictWithLocal() throws Exception {
|
||||||
|
runTest("analysis/analysis-api/testData/components/referenceShortener/referenceShortener/thisReference/this_memberFunction_fromMemberFunction_conflictWithLocal.kt");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("this_memberProperty_fromInit.kt")
|
||||||
|
public void testThis_memberProperty_fromInit() throws Exception {
|
||||||
|
runTest("analysis/analysis-api/testData/components/referenceShortener/referenceShortener/thisReference/this_memberProperty_fromInit.kt");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("this_memberProperty_fromInit_conflictWithParameter.kt")
|
||||||
|
public void testThis_memberProperty_fromInit_conflictWithParameter() throws Exception {
|
||||||
|
runTest("analysis/analysis-api/testData/components/referenceShortener/referenceShortener/thisReference/this_memberProperty_fromInit_conflictWithParameter.kt");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("this_memberProperty_fromMemberFunction.kt")
|
||||||
|
public void testThis_memberProperty_fromMemberFunction() throws Exception {
|
||||||
|
runTest("analysis/analysis-api/testData/components/referenceShortener/referenceShortener/thisReference/this_memberProperty_fromMemberFunction.kt");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("this_memberProperty_fromMemberFunctionWithContextReceiver.kt")
|
||||||
|
public void testThis_memberProperty_fromMemberFunctionWithContextReceiver() throws Exception {
|
||||||
|
runTest("analysis/analysis-api/testData/components/referenceShortener/referenceShortener/thisReference/this_memberProperty_fromMemberFunctionWithContextReceiver.kt");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("this_memberProperty_fromMemberFunction_conflictWithLocal.kt")
|
||||||
|
public void testThis_memberProperty_fromMemberFunction_conflictWithLocal() throws Exception {
|
||||||
|
runTest("analysis/analysis-api/testData/components/referenceShortener/referenceShortener/thisReference/this_memberProperty_fromMemberFunction_conflictWithLocal.kt");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("this_memberProperty_fromMemberFunction_conflictWithParameter.kt")
|
||||||
|
public void testThis_memberProperty_fromMemberFunction_conflictWithParameter() throws Exception {
|
||||||
|
runTest("analysis/analysis-api/testData/components/referenceShortener/referenceShortener/thisReference/this_memberProperty_fromMemberFunction_conflictWithParameter.kt");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("this_memberProperty_fromMemberFunction_noConflictWithLocal.kt")
|
||||||
|
public void testThis_memberProperty_fromMemberFunction_noConflictWithLocal() throws Exception {
|
||||||
|
runTest("analysis/analysis-api/testData/components/referenceShortener/referenceShortener/thisReference/this_memberProperty_fromMemberFunction_noConflictWithLocal.kt");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("this_nullableReceiver.kt")
|
||||||
|
public void testThis_nullableReceiver() throws Exception {
|
||||||
|
runTest("analysis/analysis-api/testData/components/referenceShortener/referenceShortener/thisReference/this_nullableReceiver.kt");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("this_safeCall.kt")
|
||||||
|
public void testThis_safeCall() throws Exception {
|
||||||
|
runTest("analysis/analysis-api/testData/components/referenceShortener/referenceShortener/thisReference/this_safeCall.kt");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Nested
|
@Nested
|
||||||
@TestMetadata("analysis/analysis-api/testData/components/referenceShortener/referenceShortener/typeParameters")
|
@TestMetadata("analysis/analysis-api/testData/components/referenceShortener/referenceShortener/typeParameters")
|
||||||
@TestDataPath("$PROJECT_ROOT")
|
@TestDataPath("$PROJECT_ROOT")
|
||||||
|
|||||||
+9
@@ -0,0 +1,9 @@
|
|||||||
|
package test
|
||||||
|
|
||||||
|
class Foo
|
||||||
|
|
||||||
|
fun Foo.one() {}
|
||||||
|
|
||||||
|
fun Foo.usage() {
|
||||||
|
<expr>this.one()</expr>
|
||||||
|
}
|
||||||
+8
@@ -0,0 +1,8 @@
|
|||||||
|
Before shortening: this.one()
|
||||||
|
with DO_NOT_SHORTEN:
|
||||||
|
with SHORTEN_IF_ALREADY_IMPORTED:
|
||||||
|
[qualifier] this.one()
|
||||||
|
with SHORTEN_AND_IMPORT:
|
||||||
|
[qualifier] this.one()
|
||||||
|
with SHORTEN_AND_STAR_IMPORT:
|
||||||
|
[qualifier] this.one()
|
||||||
+11
@@ -0,0 +1,11 @@
|
|||||||
|
package test
|
||||||
|
|
||||||
|
class Foo
|
||||||
|
|
||||||
|
fun Foo.one() {}
|
||||||
|
|
||||||
|
fun Foo.usage() {
|
||||||
|
fun one() {}
|
||||||
|
|
||||||
|
<expr>this.one()</expr>
|
||||||
|
}
|
||||||
+5
@@ -0,0 +1,5 @@
|
|||||||
|
Before shortening: this.one()
|
||||||
|
with DO_NOT_SHORTEN:
|
||||||
|
with SHORTEN_IF_ALREADY_IMPORTED:
|
||||||
|
with SHORTEN_AND_IMPORT:
|
||||||
|
with SHORTEN_AND_STAR_IMPORT:
|
||||||
+9
@@ -0,0 +1,9 @@
|
|||||||
|
package test
|
||||||
|
|
||||||
|
class Foo {
|
||||||
|
fun one() {}
|
||||||
|
|
||||||
|
fun usage() {
|
||||||
|
<expr>this.one()</expr>
|
||||||
|
}
|
||||||
|
}
|
||||||
+8
@@ -0,0 +1,8 @@
|
|||||||
|
Before shortening: this.one()
|
||||||
|
with DO_NOT_SHORTEN:
|
||||||
|
with SHORTEN_IF_ALREADY_IMPORTED:
|
||||||
|
[qualifier] this.one()
|
||||||
|
with SHORTEN_AND_IMPORT:
|
||||||
|
[qualifier] this.one()
|
||||||
|
with SHORTEN_AND_STAR_IMPORT:
|
||||||
|
[qualifier] this.one()
|
||||||
+11
@@ -0,0 +1,11 @@
|
|||||||
|
package test
|
||||||
|
|
||||||
|
class Foo {
|
||||||
|
fun one() {}
|
||||||
|
|
||||||
|
fun usage() {
|
||||||
|
fun one() {}
|
||||||
|
|
||||||
|
<expr>this.one()</expr>
|
||||||
|
}
|
||||||
|
}
|
||||||
+5
@@ -0,0 +1,5 @@
|
|||||||
|
Before shortening: this.one()
|
||||||
|
with DO_NOT_SHORTEN:
|
||||||
|
with SHORTEN_IF_ALREADY_IMPORTED:
|
||||||
|
with SHORTEN_AND_IMPORT:
|
||||||
|
with SHORTEN_AND_STAR_IMPORT:
|
||||||
+9
@@ -0,0 +1,9 @@
|
|||||||
|
package test
|
||||||
|
|
||||||
|
class Foo {
|
||||||
|
val one: Int
|
||||||
|
|
||||||
|
init {
|
||||||
|
<expr>this.one</expr> = 10
|
||||||
|
}
|
||||||
|
}
|
||||||
+8
@@ -0,0 +1,8 @@
|
|||||||
|
Before shortening: this.one
|
||||||
|
with DO_NOT_SHORTEN:
|
||||||
|
with SHORTEN_IF_ALREADY_IMPORTED:
|
||||||
|
[qualifier] this.one
|
||||||
|
with SHORTEN_AND_IMPORT:
|
||||||
|
[qualifier] this.one
|
||||||
|
with SHORTEN_AND_STAR_IMPORT:
|
||||||
|
[qualifier] this.one
|
||||||
+9
@@ -0,0 +1,9 @@
|
|||||||
|
package test
|
||||||
|
|
||||||
|
class Foo(one: Int) {
|
||||||
|
val one: Int
|
||||||
|
|
||||||
|
init {
|
||||||
|
<expr>this.one</expr> = one
|
||||||
|
}
|
||||||
|
}
|
||||||
+5
@@ -0,0 +1,5 @@
|
|||||||
|
Before shortening: this.one
|
||||||
|
with DO_NOT_SHORTEN:
|
||||||
|
with SHORTEN_IF_ALREADY_IMPORTED:
|
||||||
|
with SHORTEN_AND_IMPORT:
|
||||||
|
with SHORTEN_AND_STAR_IMPORT:
|
||||||
+9
@@ -0,0 +1,9 @@
|
|||||||
|
package test
|
||||||
|
|
||||||
|
class Foo {
|
||||||
|
val one: Int = 10
|
||||||
|
|
||||||
|
fun usage() {
|
||||||
|
<expr>this.one</expr>
|
||||||
|
}
|
||||||
|
}
|
||||||
+8
@@ -0,0 +1,8 @@
|
|||||||
|
Before shortening: this.one
|
||||||
|
with DO_NOT_SHORTEN:
|
||||||
|
with SHORTEN_IF_ALREADY_IMPORTED:
|
||||||
|
[qualifier] this.one
|
||||||
|
with SHORTEN_AND_IMPORT:
|
||||||
|
[qualifier] this.one
|
||||||
|
with SHORTEN_AND_STAR_IMPORT:
|
||||||
|
[qualifier] this.one
|
||||||
+14
@@ -0,0 +1,14 @@
|
|||||||
|
package test
|
||||||
|
|
||||||
|
class Foo {
|
||||||
|
val one: Int = 10
|
||||||
|
|
||||||
|
context(Context)
|
||||||
|
fun usage() {
|
||||||
|
<expr>this.one</expr>
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class Context {
|
||||||
|
val one: Int = 20
|
||||||
|
}
|
||||||
+8
@@ -0,0 +1,8 @@
|
|||||||
|
Before shortening: this.one
|
||||||
|
with DO_NOT_SHORTEN:
|
||||||
|
with SHORTEN_IF_ALREADY_IMPORTED:
|
||||||
|
[qualifier] this.one
|
||||||
|
with SHORTEN_AND_IMPORT:
|
||||||
|
[qualifier] this.one
|
||||||
|
with SHORTEN_AND_STAR_IMPORT:
|
||||||
|
[qualifier] this.one
|
||||||
+11
@@ -0,0 +1,11 @@
|
|||||||
|
package test
|
||||||
|
|
||||||
|
class Foo {
|
||||||
|
val one: Int = 10
|
||||||
|
|
||||||
|
fun usage() {
|
||||||
|
val one = 20
|
||||||
|
|
||||||
|
<expr>this.one</expr>
|
||||||
|
}
|
||||||
|
}
|
||||||
+5
@@ -0,0 +1,5 @@
|
|||||||
|
Before shortening: this.one
|
||||||
|
with DO_NOT_SHORTEN:
|
||||||
|
with SHORTEN_IF_ALREADY_IMPORTED:
|
||||||
|
with SHORTEN_AND_IMPORT:
|
||||||
|
with SHORTEN_AND_STAR_IMPORT:
|
||||||
+9
@@ -0,0 +1,9 @@
|
|||||||
|
package test
|
||||||
|
|
||||||
|
class Foo {
|
||||||
|
val one: Int = 10
|
||||||
|
|
||||||
|
fun usage(one: Int) {
|
||||||
|
<expr>this.one</expr>
|
||||||
|
}
|
||||||
|
}
|
||||||
+5
@@ -0,0 +1,5 @@
|
|||||||
|
Before shortening: this.one
|
||||||
|
with DO_NOT_SHORTEN:
|
||||||
|
with SHORTEN_IF_ALREADY_IMPORTED:
|
||||||
|
with SHORTEN_AND_IMPORT:
|
||||||
|
with SHORTEN_AND_STAR_IMPORT:
|
||||||
+11
@@ -0,0 +1,11 @@
|
|||||||
|
package test
|
||||||
|
|
||||||
|
class Foo {
|
||||||
|
val one: Int = 10
|
||||||
|
|
||||||
|
fun usage() {
|
||||||
|
<expr>this.one</expr>
|
||||||
|
|
||||||
|
val one = 20
|
||||||
|
}
|
||||||
|
}
|
||||||
+8
@@ -0,0 +1,8 @@
|
|||||||
|
Before shortening: this.one
|
||||||
|
with DO_NOT_SHORTEN:
|
||||||
|
with SHORTEN_IF_ALREADY_IMPORTED:
|
||||||
|
[qualifier] this.one
|
||||||
|
with SHORTEN_AND_IMPORT:
|
||||||
|
[qualifier] this.one
|
||||||
|
with SHORTEN_AND_STAR_IMPORT:
|
||||||
|
[qualifier] this.one
|
||||||
+9
@@ -0,0 +1,9 @@
|
|||||||
|
package test
|
||||||
|
|
||||||
|
class Foo
|
||||||
|
|
||||||
|
fun Foo?.one() {}
|
||||||
|
|
||||||
|
fun Foo?.usage() {
|
||||||
|
<expr>this.one()</expr>
|
||||||
|
}
|
||||||
+8
@@ -0,0 +1,8 @@
|
|||||||
|
Before shortening: this.one()
|
||||||
|
with DO_NOT_SHORTEN:
|
||||||
|
with SHORTEN_IF_ALREADY_IMPORTED:
|
||||||
|
[qualifier] this.one()
|
||||||
|
with SHORTEN_AND_IMPORT:
|
||||||
|
[qualifier] this.one()
|
||||||
|
with SHORTEN_AND_STAR_IMPORT:
|
||||||
|
[qualifier] this.one()
|
||||||
+9
@@ -0,0 +1,9 @@
|
|||||||
|
package test
|
||||||
|
|
||||||
|
class Foo
|
||||||
|
|
||||||
|
fun Foo.one() {}
|
||||||
|
|
||||||
|
fun Foo?.usage() {
|
||||||
|
<expr>this?.one()</expr>
|
||||||
|
}
|
||||||
+5
@@ -0,0 +1,5 @@
|
|||||||
|
Before shortening: this?.one()
|
||||||
|
with DO_NOT_SHORTEN:
|
||||||
|
with SHORTEN_IF_ALREADY_IMPORTED:
|
||||||
|
with SHORTEN_AND_IMPORT:
|
||||||
|
with SHORTEN_AND_STAR_IMPORT:
|
||||||
Reference in New Issue
Block a user