Handle SHORTEN_IF_ALEADY_IMPORTED case of KtFirReferenceShortener
For the following example, when we run the reference shortener, it
drops `a.b.c` qualifier, because it matches "FOURTH".
```
package a.b.c
fun <T, E, D> foo(a: T, b: E, c: D) = a.hashCode() + b.hashCode() + c.hashCode() // FIRST
fun <E> E.foo() = hashCode() // SECOND
object Receiver {
fun <T, E, D> foo(a: T, b: E, c: D) = a.hashCode() + b.hashCode() + c.hashCode() // THIRD
fun foo(a: Int, b: Boolean, c: String) = a.hashCode() + b.hashCode() + c.hashCode() // FOURTH
fun test(): Int {
fun foo(a: Int, b: Boolean, c: Int) = a + b.hashCode() + c // FIFTH
return <expr>a.b.c.foo(1, false, "bar")</expr>
}
}
```
As shown in the above example, when SHORTEN_IF_ALEADY_IMPORTED option is
given from a user, the reference shortener has to check whether it can
drop the qualifier without changing the referenced symbol and if it is
possible to do that without adding a new import directive, it deletes
the qualifier.
It needs two steps:
1. Collect all candidate symbols matching the signature e.g., function
arguments / type arguments
2. Determine whether the referenced symbol has the highest reference
priority when we drops the qualifier depending on scopes
This commit uses `AllCandidatesResolver(shorteningContext.analysisSession.useSiteSession).
getAllCandidates( .. fake FIR call/property-access ..)` for step1.
For step2, we use a heuristic based on scopes of candidates. If a
candidate symbol is under the same scope with the target expression, it
has a `FirLocalScope` which has the high priority. So when we have a
candidate under a `FirLocalScope` and the actual referenced symbol is
different from the candidate, we must avoid dropping its qualifier
because the shortening will change its semantics i.e., reference.
The order of scopes depending on their scope types is:
1. FirLocalScope
2. FirClassUseSiteMemberScope / FirNestedClassifierScope
3. FirExplicitSimpleImportingScope
4. FirPackageMemberScope
5. others
Note that for "others" the above rule can be wrong. Please update it if
you find other scopes that have a priority higher than the specified
scopes.
One of non-trivial parts is the priority among multiple
FirClassUseSiteMemberScope and FirNestedClassifierScope. They are
basically scopes for class declarations. We decide their priorities
based on the distance of class declaration from the target expression.
Note that we take a strict approach to reject all false positive. For
example, when we are not sure, we don't shorten it to avoid changing its
semantics.
TODO: One corner case is handling receivers. We have to update
```
private fun shortenIfAlreadyImported(
firQualifiedAccess: FirQualifiedAccess,
calledSymbol: FirCallableSymbol<*>,
expressionInScope: KtExpression,
): Boolean
```
The current implementation cannot handle the following example:
```
package foo
class Foo {
fun test() {
// It references FIRST. Removing `foo` lets it reference SECOND.
<caret>foo.myRun {
42
}
}
}
inline fun <R> myRun(block: () -> R): R = block() // FIRST
inline fun <T, R> T.myRun(block: T.() -> R): R = block() // SECOND
```
Tests related to TODO:
- analysis/analysis-api/testData/components/referenceShortener/referenceShortener/receiver2.kt
- analysis/analysis-api/testData/components/referenceShortener/referenceShortener/receiver3.kt
This commit is contained in:
Vendored
+22
@@ -0,0 +1,22 @@
|
||||
// FILE: main.kt
|
||||
package my.simple.name
|
||||
|
||||
open class SuperClass {
|
||||
companion object {
|
||||
fun check() {}
|
||||
}
|
||||
}
|
||||
|
||||
class Child: SuperClass {
|
||||
class Foo constructor() {
|
||||
constructor(i: Int) : this()
|
||||
|
||||
fun foo() {
|
||||
<expr>my.simple.name.SuperClass.check()</expr>
|
||||
}
|
||||
|
||||
companion object {
|
||||
fun check() {}
|
||||
}
|
||||
}
|
||||
}
|
||||
Vendored
+8
@@ -0,0 +1,8 @@
|
||||
Before shortening: my.simple.name.SuperClass.check()
|
||||
with DO_NOT_SHORTEN:
|
||||
with SHORTEN_IF_ALREADY_IMPORTED:
|
||||
[qualifier] my.simple.name.SuperClass
|
||||
with SHORTEN_AND_IMPORT:
|
||||
[qualifier] my.simple.name.SuperClass
|
||||
with SHORTEN_AND_STAR_IMPORT:
|
||||
[qualifier] my.simple.name.SuperClass
|
||||
Vendored
+22
@@ -0,0 +1,22 @@
|
||||
// FILE: main.kt
|
||||
package my.simple.name
|
||||
|
||||
open class SuperClass {
|
||||
companion object {
|
||||
fun check() {}
|
||||
}
|
||||
}
|
||||
|
||||
class Child: SuperClass {
|
||||
class Foo constructor() {
|
||||
constructor(i: Int) : this()
|
||||
|
||||
fun foo() {
|
||||
<expr>Child.Foo.check()</expr>
|
||||
}
|
||||
|
||||
companion object {
|
||||
fun check() {}
|
||||
}
|
||||
}
|
||||
}
|
||||
Vendored
+11
@@ -0,0 +1,11 @@
|
||||
Before shortening: Child.Foo.check()
|
||||
with DO_NOT_SHORTEN:
|
||||
with SHORTEN_IF_ALREADY_IMPORTED:
|
||||
[qualifier] Child.Foo
|
||||
[qualifier] Child.Foo.check()
|
||||
with SHORTEN_AND_IMPORT:
|
||||
[qualifier] Child.Foo
|
||||
[qualifier] Child.Foo.check()
|
||||
with SHORTEN_AND_STAR_IMPORT:
|
||||
[qualifier] Child.Foo
|
||||
[qualifier] Child.Foo.check()
|
||||
Vendored
+28
@@ -0,0 +1,28 @@
|
||||
// FILE: main.kt
|
||||
package my.simple.name
|
||||
|
||||
class ClassFarAway {
|
||||
companion object {
|
||||
fun check() {}
|
||||
}
|
||||
}
|
||||
|
||||
open class SuperClass {
|
||||
companion object {
|
||||
fun check() {}
|
||||
}
|
||||
}
|
||||
|
||||
class Child: SuperClass {
|
||||
class Foo constructor() {
|
||||
constructor(i: Int) : this()
|
||||
|
||||
fun foo() {
|
||||
<expr>my.simple.name.ClassFarAway.check()</expr>
|
||||
}
|
||||
|
||||
companion object {
|
||||
fun check() {}
|
||||
}
|
||||
}
|
||||
}
|
||||
Vendored
+8
@@ -0,0 +1,8 @@
|
||||
Before shortening: my.simple.name.ClassFarAway.check()
|
||||
with DO_NOT_SHORTEN:
|
||||
with SHORTEN_IF_ALREADY_IMPORTED:
|
||||
[qualifier] my.simple.name.ClassFarAway
|
||||
with SHORTEN_AND_IMPORT:
|
||||
[qualifier] my.simple.name.ClassFarAway
|
||||
with SHORTEN_AND_STAR_IMPORT:
|
||||
[qualifier] my.simple.name.ClassFarAway
|
||||
Vendored
+13
@@ -0,0 +1,13 @@
|
||||
// FILE: main.kt
|
||||
package a.b.c
|
||||
|
||||
class Outer {
|
||||
class Inner {
|
||||
companion object {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fun foo(): Class<*> {
|
||||
return <expr>a.b.c.Outer.Inner::class.java</expr>
|
||||
}
|
||||
Vendored
+8
@@ -0,0 +1,8 @@
|
||||
Before shortening: a.b.c.Outer.Inner::class.java
|
||||
with DO_NOT_SHORTEN:
|
||||
with SHORTEN_IF_ALREADY_IMPORTED:
|
||||
[qualifier] a.b.c.Outer
|
||||
with SHORTEN_AND_IMPORT:
|
||||
[qualifier] a.b.c.Outer.Inner
|
||||
with SHORTEN_AND_STAR_IMPORT:
|
||||
[qualifier] a.b.c.Outer.Inner
|
||||
Vendored
+12
@@ -0,0 +1,12 @@
|
||||
// FILE: main.kt
|
||||
package a.b.c
|
||||
|
||||
class Outer {
|
||||
class Middle {
|
||||
class Inner {
|
||||
fun foo(): Class<*> {
|
||||
return <expr>a.b.c.Outer.Middle.Inner::class.java</expr>
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Vendored
+8
@@ -0,0 +1,8 @@
|
||||
Before shortening: a.b.c.Outer.Middle.Inner::class.java
|
||||
with DO_NOT_SHORTEN:
|
||||
with SHORTEN_IF_ALREADY_IMPORTED:
|
||||
[qualifier] a.b.c.Outer.Middle.Inner
|
||||
with SHORTEN_AND_IMPORT:
|
||||
[qualifier] a.b.c.Outer.Middle.Inner
|
||||
with SHORTEN_AND_STAR_IMPORT:
|
||||
[qualifier] a.b.c.Outer.Middle.Inner
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
// FILE: main.kt
|
||||
package a.b.c
|
||||
|
||||
class Outer {
|
||||
class Inner {
|
||||
companion object {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fun foo(): Class<*> {
|
||||
class Outer
|
||||
return <expr>a.b.c.Outer.Inner::class.java</expr>
|
||||
}
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
Before shortening: a.b.c.Outer.Inner::class.java
|
||||
with DO_NOT_SHORTEN:
|
||||
with SHORTEN_IF_ALREADY_IMPORTED:
|
||||
with SHORTEN_AND_IMPORT:
|
||||
[qualifier] a.b.c.Outer.Inner
|
||||
with SHORTEN_AND_STAR_IMPORT:
|
||||
[qualifier] a.b.c.Outer.Inner
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
// FILE: main.kt
|
||||
package a.b.c
|
||||
|
||||
class Outer {
|
||||
class Inner {
|
||||
fun foo(): Class<*> {
|
||||
class Outer
|
||||
return <expr>a.b.c.Outer.Inner::class.java</expr>
|
||||
}
|
||||
companion object {
|
||||
}
|
||||
}
|
||||
}
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
Before shortening: a.b.c.Outer.Inner::class.java
|
||||
with DO_NOT_SHORTEN:
|
||||
with SHORTEN_IF_ALREADY_IMPORTED:
|
||||
[qualifier] a.b.c.Outer.Inner
|
||||
with SHORTEN_AND_IMPORT:
|
||||
[qualifier] a.b.c.Outer.Inner
|
||||
with SHORTEN_AND_STAR_IMPORT:
|
||||
[qualifier] a.b.c.Outer.Inner
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
// FILE: main.kt
|
||||
package a.b.c
|
||||
|
||||
class Outer {
|
||||
class Outer
|
||||
class Inner {
|
||||
fun foo(): Class<*> {
|
||||
return <expr>a.b.c.Outer.Inner::class.java</expr>
|
||||
}
|
||||
companion object {
|
||||
}
|
||||
}
|
||||
}
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
Before shortening: a.b.c.Outer.Inner::class.java
|
||||
with DO_NOT_SHORTEN:
|
||||
with SHORTEN_IF_ALREADY_IMPORTED:
|
||||
[qualifier] a.b.c.Outer.Inner
|
||||
with SHORTEN_AND_IMPORT:
|
||||
[qualifier] a.b.c.Outer.Inner
|
||||
with SHORTEN_AND_STAR_IMPORT:
|
||||
[qualifier] a.b.c.Outer.Inner
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
// FILE: main.kt
|
||||
package foo.www.ddd
|
||||
|
||||
class Check {
|
||||
class BBD {
|
||||
class Bwd {
|
||||
fun dad() {
|
||||
val Bwd = 42
|
||||
|
||||
class BBD
|
||||
|
||||
val a = <expr>foo.www.ddd.Check.BBD.Bwd::class.java.annotatedInterfaces.size</expr>
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
Before shortening: foo.www.ddd.Check.BBD.Bwd::class.java.annotatedInterfaces.size
|
||||
with DO_NOT_SHORTEN:
|
||||
with SHORTEN_IF_ALREADY_IMPORTED:
|
||||
[qualifier] foo.www.ddd.Check
|
||||
with SHORTEN_AND_IMPORT:
|
||||
[qualifier] foo.www.ddd.Check.BBD.Bwd
|
||||
with SHORTEN_AND_STAR_IMPORT:
|
||||
[qualifier] foo.www.ddd.Check.BBD.Bwd
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
// FILE: main.kt
|
||||
package foo.www.ddd
|
||||
|
||||
class Check {
|
||||
class BBD {
|
||||
class Bwd {
|
||||
fun dad() {
|
||||
val Bwd = 42
|
||||
|
||||
val BBD = 3
|
||||
|
||||
val a = <expr>foo.www.ddd.Check.BBD.Bwd::class.java.annotatedInterfaces.size</expr>
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
Before shortening: foo.www.ddd.Check.BBD.Bwd::class.java.annotatedInterfaces.size
|
||||
with DO_NOT_SHORTEN:
|
||||
with SHORTEN_IF_ALREADY_IMPORTED:
|
||||
[qualifier] foo.www.ddd.Check
|
||||
with SHORTEN_AND_IMPORT:
|
||||
[qualifier] foo.www.ddd.Check.BBD.Bwd
|
||||
with SHORTEN_AND_STAR_IMPORT:
|
||||
[qualifier] foo.www.ddd.Check.BBD.Bwd
|
||||
+15
@@ -0,0 +1,15 @@
|
||||
// FILE: main.kt
|
||||
package foo.www.ddd
|
||||
|
||||
class Check {
|
||||
class BBD {
|
||||
class Bwd {
|
||||
class BBD
|
||||
fun dad() {
|
||||
val Bwd = 42
|
||||
|
||||
val a = <expr>foo.www.ddd.Check.BBD.Bwd::class.java.annotatedInterfaces.size</expr>
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
Before shortening: foo.www.ddd.Check.BBD.Bwd::class.java.annotatedInterfaces.size
|
||||
with DO_NOT_SHORTEN:
|
||||
with SHORTEN_IF_ALREADY_IMPORTED:
|
||||
[qualifier] foo.www.ddd.Check
|
||||
with SHORTEN_AND_IMPORT:
|
||||
[qualifier] foo.www.ddd.Check.BBD.Bwd
|
||||
with SHORTEN_AND_STAR_IMPORT:
|
||||
[qualifier] foo.www.ddd.Check.BBD.Bwd
|
||||
+15
@@ -0,0 +1,15 @@
|
||||
// FILE: main.kt
|
||||
package foo.www.ddd
|
||||
|
||||
class Check {
|
||||
class BBD {
|
||||
class BBD
|
||||
class Bwd {
|
||||
fun dad() {
|
||||
val Bwd = 42
|
||||
|
||||
val a = <expr>foo.www.ddd.Check.BBD.Bwd::class.java.annotatedInterfaces.size</expr>
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
Before shortening: foo.www.ddd.Check.BBD.Bwd::class.java.annotatedInterfaces.size
|
||||
with DO_NOT_SHORTEN:
|
||||
with SHORTEN_IF_ALREADY_IMPORTED:
|
||||
[qualifier] foo.www.ddd.Check
|
||||
with SHORTEN_AND_IMPORT:
|
||||
[qualifier] foo.www.ddd.Check.BBD.Bwd
|
||||
with SHORTEN_AND_STAR_IMPORT:
|
||||
[qualifier] foo.www.ddd.Check.BBD.Bwd
|
||||
+17
@@ -0,0 +1,17 @@
|
||||
// FILE: main.kt
|
||||
package foo.www.ddd
|
||||
|
||||
class BBD {
|
||||
class Bwd
|
||||
}
|
||||
class Check {
|
||||
class BBD {
|
||||
class Bwd {
|
||||
fun dad() {
|
||||
val Bwd = 42
|
||||
|
||||
val a = <expr>foo.www.ddd.Check.BBD.Bwd::class.java.annotatedInterfaces.size</expr>
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
Before shortening: foo.www.ddd.Check.BBD.Bwd::class.java.annotatedInterfaces.size
|
||||
with DO_NOT_SHORTEN:
|
||||
with SHORTEN_IF_ALREADY_IMPORTED:
|
||||
[qualifier] foo.www.ddd.Check.BBD
|
||||
with SHORTEN_AND_IMPORT:
|
||||
[qualifier] foo.www.ddd.Check.BBD.Bwd
|
||||
with SHORTEN_AND_STAR_IMPORT:
|
||||
[qualifier] foo.www.ddd.Check.BBD.Bwd
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
// FILE: main.kt
|
||||
package foo.www.ddd
|
||||
|
||||
class Check {
|
||||
class BBD {
|
||||
class Bwd {
|
||||
fun dad() {
|
||||
|
||||
val a = <expr>foo.www.ddd.Check.BBD.Bwd::class.java.annotatedInterfaces.size</expr>
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
Before shortening: foo.www.ddd.Check.BBD.Bwd::class.java.annotatedInterfaces.size
|
||||
with DO_NOT_SHORTEN:
|
||||
with SHORTEN_IF_ALREADY_IMPORTED:
|
||||
[qualifier] foo.www.ddd.Check.BBD.Bwd
|
||||
with SHORTEN_AND_IMPORT:
|
||||
[qualifier] foo.www.ddd.Check.BBD.Bwd
|
||||
with SHORTEN_AND_STAR_IMPORT:
|
||||
[qualifier] foo.www.ddd.Check.BBD.Bwd
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
// FILE: main.kt
|
||||
package foo.www.ddd
|
||||
|
||||
class Check {
|
||||
class BBD {
|
||||
companion object Bwd {
|
||||
fun dad() {
|
||||
val Bwd = 42
|
||||
val a = <expr>foo.www.ddd.Check.BBD.Bwd::class.java.annotatedInterfaces.size</expr>
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
Before shortening: foo.www.ddd.Check.BBD.Bwd::class.java.annotatedInterfaces.size
|
||||
with DO_NOT_SHORTEN:
|
||||
with SHORTEN_IF_ALREADY_IMPORTED:
|
||||
[qualifier] foo.www.ddd.Check.BBD
|
||||
with SHORTEN_AND_IMPORT:
|
||||
[qualifier] foo.www.ddd.Check.BBD.Bwd
|
||||
with SHORTEN_AND_STAR_IMPORT:
|
||||
[qualifier] foo.www.ddd.Check.BBD.Bwd
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
// FILE: main.kt
|
||||
package foo.www.ddd
|
||||
|
||||
class Check {
|
||||
class BBD {
|
||||
object Bwd {
|
||||
fun dad() {
|
||||
val Bwd = 42
|
||||
val a = <expr>foo.www.ddd.Check.BBD.Bwd::class.java.annotatedInterfaces.size</expr>
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
Before shortening: foo.www.ddd.Check.BBD.Bwd::class.java.annotatedInterfaces.size
|
||||
with DO_NOT_SHORTEN:
|
||||
with SHORTEN_IF_ALREADY_IMPORTED:
|
||||
[qualifier] foo.www.ddd.Check.BBD
|
||||
with SHORTEN_AND_IMPORT:
|
||||
[qualifier] foo.www.ddd.Check.BBD.Bwd
|
||||
with SHORTEN_AND_STAR_IMPORT:
|
||||
[qualifier] foo.www.ddd.Check.BBD.Bwd
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
// FILE: main.kt
|
||||
package foo.www.ddd
|
||||
|
||||
class Check {
|
||||
class BBD {
|
||||
companion object {
|
||||
fun dad() {
|
||||
val Bwd = 42
|
||||
val a = <expr>foo.www.ddd.Check.BBD.Companion::class.java.annotatedInterfaces.size</expr>
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
Before shortening: foo.www.ddd.Check.BBD.Companion::class.java.annotatedInterfaces.size
|
||||
with DO_NOT_SHORTEN:
|
||||
with SHORTEN_IF_ALREADY_IMPORTED:
|
||||
[qualifier] foo.www.ddd.Check.BBD.Companion
|
||||
with SHORTEN_AND_IMPORT:
|
||||
[qualifier] foo.www.ddd.Check.BBD.Companion
|
||||
with SHORTEN_AND_STAR_IMPORT:
|
||||
[qualifier] foo.www.ddd.Check.BBD.Companion
|
||||
+19
@@ -0,0 +1,19 @@
|
||||
// FILE: main.kt
|
||||
package a.b.c
|
||||
|
||||
class Outer {
|
||||
fun <E> E.foo(x: E, y: E, z: E) = x.hashCode() + y.hashCode() + z.hashCode()
|
||||
|
||||
class Inner {
|
||||
fun foo(a: Int, b: Boolean, c: String) = c + a + b
|
||||
|
||||
companion object {
|
||||
fun <T, E, D> foo(a: T, b: E, c: D) = a.hashCode() + b.hashCode() + c.hashCode()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fun test(): Int {
|
||||
fun foo(a: Int, b: Boolean, c: Int) = a + b.hashCode() + c
|
||||
return <expr>a.b.c.Outer.Inner.Companion.foo(1, false, "bar")</expr>
|
||||
}
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
Before shortening: a.b.c.Outer.Inner.Companion.foo(1, false, "bar")
|
||||
with DO_NOT_SHORTEN:
|
||||
with SHORTEN_IF_ALREADY_IMPORTED:
|
||||
[qualifier] a.b.c.Outer
|
||||
with SHORTEN_AND_IMPORT:
|
||||
[qualifier] a.b.c.Outer.Inner.Companion
|
||||
with SHORTEN_AND_STAR_IMPORT:
|
||||
[qualifier] a.b.c.Outer.Inner.Companion
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
// FILE: main.kt
|
||||
package a.b.c
|
||||
|
||||
class MyClass(val id: Int) {
|
||||
companion object {
|
||||
fun foo() = ""
|
||||
}
|
||||
}
|
||||
|
||||
fun test() {
|
||||
<expr>a.b.c.MyClass.Companion.foo()</expr>
|
||||
}
|
||||
|
||||
fun foo() = ""
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
Before shortening: a.b.c.MyClass.Companion.foo()
|
||||
with DO_NOT_SHORTEN:
|
||||
with SHORTEN_IF_ALREADY_IMPORTED:
|
||||
[qualifier] a.b.c.MyClass
|
||||
with SHORTEN_AND_IMPORT:
|
||||
[qualifier] a.b.c.MyClass.Companion
|
||||
with SHORTEN_AND_STAR_IMPORT:
|
||||
[qualifier] a.b.c.MyClass.Companion
|
||||
+18
@@ -0,0 +1,18 @@
|
||||
package a.b.c
|
||||
|
||||
import a.b.c.MyEnum.Companion.foo
|
||||
|
||||
enum class MyEnum(val id: Int) {
|
||||
A(1),
|
||||
B(2);
|
||||
|
||||
companion object {
|
||||
fun foo() = ""
|
||||
}
|
||||
}
|
||||
|
||||
fun test() {
|
||||
<expr>a.b.c.MyEnum.Companion.foo()</expr>
|
||||
}
|
||||
|
||||
fun foo() = ""
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
Before shortening: a.b.c.MyEnum.Companion.foo()
|
||||
with DO_NOT_SHORTEN:
|
||||
with SHORTEN_IF_ALREADY_IMPORTED:
|
||||
[qualifier] a.b.c.MyEnum
|
||||
[qualifier] a.b.c.MyEnum.Companion.foo()
|
||||
with SHORTEN_AND_IMPORT:
|
||||
[qualifier] a.b.c.MyEnum.Companion
|
||||
[qualifier] a.b.c.MyEnum.Companion.foo()
|
||||
with SHORTEN_AND_STAR_IMPORT:
|
||||
[qualifier] a.b.c.MyEnum.Companion
|
||||
[qualifier] a.b.c.MyEnum.Companion.foo()
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
enum class C(val i: Int) {
|
||||
ONE(<expr>C.K</expr>)
|
||||
;
|
||||
|
||||
companion object {
|
||||
const val K = 1
|
||||
}
|
||||
}
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
Before shortening: C.K
|
||||
with DO_NOT_SHORTEN:
|
||||
with SHORTEN_IF_ALREADY_IMPORTED:
|
||||
with SHORTEN_AND_IMPORT:
|
||||
[qualifier] C.K
|
||||
with SHORTEN_AND_STAR_IMPORT:
|
||||
[qualifier] C.K
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
enum class C(val i: Int) {
|
||||
ONE(<expr>C.foo()</expr>)
|
||||
;
|
||||
|
||||
companion object {
|
||||
fun foo() = 1
|
||||
}
|
||||
}
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
Before shortening: C.foo()
|
||||
with DO_NOT_SHORTEN:
|
||||
with SHORTEN_IF_ALREADY_IMPORTED:
|
||||
with SHORTEN_AND_IMPORT:
|
||||
[qualifier] C.foo()
|
||||
with SHORTEN_AND_STAR_IMPORT:
|
||||
[qualifier] C.foo()
|
||||
Vendored
+23
@@ -0,0 +1,23 @@
|
||||
// FILE: main.kt
|
||||
package a.b.c
|
||||
|
||||
fun <T, E, D> foo(a: T, b: E, c: D) = a.hashCode() + b.hashCode() + c.hashCode()
|
||||
|
||||
fun <E> E.foo() = hashCode()
|
||||
|
||||
class Outer {
|
||||
fun <E> E.foo(x: E, y: E, z: E) = x.hashCode() + y.hashCode() + z.hashCode()
|
||||
|
||||
class Inner {
|
||||
fun foo(a: Int, b: Boolean, c: String) = c + a + b
|
||||
|
||||
fun test(): Int {
|
||||
fun foo(a: Int, b: Boolean, c: Int) = a + b.hashCode() + c
|
||||
return <expr>Inner.foo(1, false, "bar")</expr>
|
||||
}
|
||||
|
||||
companion object {
|
||||
fun <T, E, D> foo(a: T, b: E, c: D) = a.hashCode() + b.hashCode() + c.hashCode()
|
||||
}
|
||||
}
|
||||
}
|
||||
Vendored
+5
@@ -0,0 +1,5 @@
|
||||
Before shortening: Inner.foo(1, false, "bar")
|
||||
with DO_NOT_SHORTEN:
|
||||
with SHORTEN_IF_ALREADY_IMPORTED:
|
||||
with SHORTEN_AND_IMPORT:
|
||||
with SHORTEN_AND_STAR_IMPORT:
|
||||
Vendored
+23
@@ -0,0 +1,23 @@
|
||||
// FILE: main.kt
|
||||
package a.b.c
|
||||
|
||||
fun <T, E, D> foo(a: T, b: E, c: D) = a.hashCode() + b.hashCode() + c.hashCode()
|
||||
|
||||
fun <E> E.foo() = hashCode()
|
||||
|
||||
class Outer {
|
||||
fun <E> E.foo(x: E, y: E, z: E) = x.hashCode() + y.hashCode() + z.hashCode()
|
||||
|
||||
class Inner {
|
||||
fun foo(a: Int, b: Boolean, c: String) = c + a + b
|
||||
|
||||
fun test(): Int {
|
||||
fun foo(a: Int, b: Boolean, c: String) = a.hashCode() + b.hashCode() + c.hashCode()
|
||||
return <expr>a.b.c.foo(1, false, "bar")</expr>
|
||||
}
|
||||
|
||||
companion object {
|
||||
fun <T, E, D> foo(a: T, b: E, c: D) = a.hashCode() + b.hashCode() + c.hashCode()
|
||||
}
|
||||
}
|
||||
}
|
||||
Vendored
+5
@@ -0,0 +1,5 @@
|
||||
Before shortening: a.b.c.foo(1, false, "bar")
|
||||
with DO_NOT_SHORTEN:
|
||||
with SHORTEN_IF_ALREADY_IMPORTED:
|
||||
with SHORTEN_AND_IMPORT:
|
||||
with SHORTEN_AND_STAR_IMPORT:
|
||||
Vendored
+23
@@ -0,0 +1,23 @@
|
||||
// FILE: main.kt
|
||||
package a.b.c
|
||||
|
||||
fun <T, E, D> foo(a: T, b: E, c: D) = a.hashCode() + b.hashCode() + c.hashCode()
|
||||
|
||||
fun <E> E.foo() = hashCode()
|
||||
|
||||
class Outer {
|
||||
fun <E> E.foo(x: E, y: E, z: E) = x.hashCode() + y.hashCode() + z.hashCode()
|
||||
|
||||
class Inner {
|
||||
fun foo(a: Int, b: Boolean, c: String) = c + a + b
|
||||
|
||||
fun test(): Int {
|
||||
fun foo(a: Int, b: Boolean, c: Int) = a + b.hashCode() + c
|
||||
return <expr>Inner.Companion.foo(1, false, "bar")</expr>
|
||||
}
|
||||
|
||||
companion object {
|
||||
fun <T, E, D> foo(a: T, b: E, c: D) = a.hashCode() + b.hashCode() + c.hashCode()
|
||||
}
|
||||
}
|
||||
}
|
||||
Vendored
+8
@@ -0,0 +1,8 @@
|
||||
Before shortening: Inner.Companion.foo(1, false, "bar")
|
||||
with DO_NOT_SHORTEN:
|
||||
with SHORTEN_IF_ALREADY_IMPORTED:
|
||||
[qualifier] Inner.Companion
|
||||
with SHORTEN_AND_IMPORT:
|
||||
[qualifier] Inner.Companion
|
||||
with SHORTEN_AND_STAR_IMPORT:
|
||||
[qualifier] Inner.Companion
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
// FILE: main.kt
|
||||
package test
|
||||
|
||||
import dependency.T
|
||||
|
||||
class T
|
||||
|
||||
fun foo(t: <expr>test.T</expr>) {}
|
||||
|
||||
// FILE: dep.kt
|
||||
package dependency
|
||||
|
||||
class T
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
Before shortening: test.T
|
||||
with DO_NOT_SHORTEN:
|
||||
with SHORTEN_IF_ALREADY_IMPORTED:
|
||||
with SHORTEN_AND_IMPORT:
|
||||
with SHORTEN_AND_STAR_IMPORT:
|
||||
Vendored
+17
@@ -0,0 +1,17 @@
|
||||
// FILE: main.kt
|
||||
package a.b.c
|
||||
|
||||
fun <T, E, D> foo(a: T, b: E, c: D) = a.hashCode() + b.hashCode() + c.hashCode()
|
||||
|
||||
fun <E> E.foo() = hashCode()
|
||||
|
||||
object Receiver {
|
||||
fun <E> E.foo(x: E, y: E, z: E) = x.hashCode() + y.hashCode() + z.hashCode()
|
||||
|
||||
fun foo(a: Int, b: Boolean, c: String) = a.hashCode() + b.hashCode() + c.hashCode()
|
||||
|
||||
fun test(): Int {
|
||||
fun foo(a: Int, b: Boolean, c: String) = a + b.hashCode() + c.hashCode()
|
||||
return <expr>Receiver.foo(1, false, "bar")</expr>
|
||||
}
|
||||
}
|
||||
Vendored
+5
@@ -0,0 +1,5 @@
|
||||
Before shortening: Receiver.foo(1, false, "bar")
|
||||
with DO_NOT_SHORTEN:
|
||||
with SHORTEN_IF_ALREADY_IMPORTED:
|
||||
with SHORTEN_AND_IMPORT:
|
||||
with SHORTEN_AND_STAR_IMPORT:
|
||||
Vendored
+18
@@ -0,0 +1,18 @@
|
||||
// IGNORE_FIR
|
||||
// FILE: main.kt
|
||||
package a.b.c
|
||||
|
||||
fun <T, E, D> foo(a: T, b: E, c: D) = a.hashCode() + b.hashCode() + c.hashCode()
|
||||
|
||||
fun <E> E.foo() = hashCode()
|
||||
|
||||
object Receiver {
|
||||
fun <E> E.foo(x: E, y: E, z: E) = x.hashCode() + y.hashCode() + z.hashCode()
|
||||
|
||||
fun foo(a: Int, b: Boolean, c: String) = a.hashCode() + b.hashCode() + c.hashCode()
|
||||
|
||||
fun test(): Int {
|
||||
fun foo(a: Int, b: Boolean, c: Int) = a + b.hashCode() + c
|
||||
return <expr>Receiver.foo(1, false, "bar")</expr>
|
||||
}
|
||||
}
|
||||
Vendored
+8
@@ -0,0 +1,8 @@
|
||||
Before shortening: Receiver.foo(1, false, "bar")
|
||||
with DO_NOT_SHORTEN:
|
||||
with SHORTEN_IF_ALREADY_IMPORTED:
|
||||
[qualifier] Receiver.foo(1, false, "bar")
|
||||
with SHORTEN_AND_IMPORT:
|
||||
[qualifier] Receiver.foo(1, false, "bar")
|
||||
with SHORTEN_AND_STAR_IMPORT:
|
||||
[qualifier] Receiver.foo(1, false, "bar")
|
||||
Vendored
+18
@@ -0,0 +1,18 @@
|
||||
// IGNORE_FIR
|
||||
// FILE: main.kt
|
||||
package a.b.c
|
||||
|
||||
fun <T, E, D> foo(a: T, b: E, c: D) = a.hashCode() + b.hashCode() + c.hashCode()
|
||||
|
||||
fun <E> E.foo() = hashCode()
|
||||
|
||||
object Receiver {
|
||||
fun <T, E, D> foo(a: T, b: E, c: D) = a.hashCode() + b.hashCode() + c.hashCode()
|
||||
|
||||
fun foo(a: Int, b: Boolean, c: String) = a.hashCode() + b.hashCode() + c.hashCode()
|
||||
|
||||
fun test(): Int {
|
||||
fun foo(a: Int, b: Boolean, c: Int) = a + b.hashCode() + c
|
||||
return <expr>Receiver.foo(1, false, "bar")</expr>
|
||||
}
|
||||
}
|
||||
Vendored
+8
@@ -0,0 +1,8 @@
|
||||
Before shortening: Receiver.foo(1, false, "bar")
|
||||
with DO_NOT_SHORTEN:
|
||||
with SHORTEN_IF_ALREADY_IMPORTED:
|
||||
[qualifier] Receiver.foo(1, false, "bar")
|
||||
with SHORTEN_AND_IMPORT:
|
||||
[qualifier] Receiver.foo(1, false, "bar")
|
||||
with SHORTEN_AND_STAR_IMPORT:
|
||||
[qualifier] Receiver.foo(1, false, "bar")
|
||||
Vendored
+17
@@ -0,0 +1,17 @@
|
||||
// FILE: main.kt
|
||||
package a.b.c
|
||||
|
||||
fun <T, E, D> foo(a: T, b: E, c: D) = a.hashCode() + b.hashCode() + c.hashCode()
|
||||
|
||||
fun <E> E.foo() = hashCode()
|
||||
|
||||
object Receiver {
|
||||
fun <T, E, D> foo(a: T, b: E, c: D) = a.hashCode() + b.hashCode() + c.hashCode()
|
||||
|
||||
fun foo(a: Int, b: Boolean, c: String) = a.hashCode() + b.hashCode() + c.hashCode()
|
||||
|
||||
fun test(): Int {
|
||||
fun foo(a: Int, b: Boolean, c: Int) = a + b.hashCode() + c
|
||||
return <expr>a.b.c.foo(1, false, "bar")</expr>
|
||||
}
|
||||
}
|
||||
Vendored
+5
@@ -0,0 +1,5 @@
|
||||
Before shortening: a.b.c.foo(1, false, "bar")
|
||||
with DO_NOT_SHORTEN:
|
||||
with SHORTEN_IF_ALREADY_IMPORTED:
|
||||
with SHORTEN_AND_IMPORT:
|
||||
with SHORTEN_AND_STAR_IMPORT:
|
||||
+35
@@ -0,0 +1,35 @@
|
||||
// MODULE: commonMain
|
||||
// FILE: main.kt
|
||||
|
||||
package a.b.c
|
||||
|
||||
fun foo() {}
|
||||
|
||||
class Outer {
|
||||
fun foo() {}
|
||||
|
||||
class Inner {
|
||||
fun foo() {}
|
||||
|
||||
class InnerOfInner {
|
||||
fun foo() {}
|
||||
|
||||
private fun check() {
|
||||
fun foo() {}
|
||||
<expr>a.b.c.Outer.Inner.Companion.foo()</expr>
|
||||
}
|
||||
|
||||
companion object {
|
||||
fun foo() {}
|
||||
}
|
||||
}
|
||||
|
||||
companion object {
|
||||
fun foo() {}
|
||||
}
|
||||
}
|
||||
|
||||
companion object {
|
||||
fun foo() {}
|
||||
}
|
||||
}
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
Before shortening: a.b.c.Outer.Inner.Companion.foo()
|
||||
with DO_NOT_SHORTEN:
|
||||
with SHORTEN_IF_ALREADY_IMPORTED:
|
||||
[qualifier] a.b.c.Outer.Inner
|
||||
with SHORTEN_AND_IMPORT:
|
||||
[qualifier] a.b.c.Outer.Inner
|
||||
with SHORTEN_AND_STAR_IMPORT:
|
||||
[qualifier] a.b.c.Outer.Inner
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
// FILE: main.kt
|
||||
|
||||
fun foo() {}
|
||||
|
||||
fun test() {
|
||||
fun foo(a: Int) = a + 1
|
||||
<expr>foo()</expr>
|
||||
}
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
Before shortening: foo()
|
||||
with DO_NOT_SHORTEN:
|
||||
with SHORTEN_IF_ALREADY_IMPORTED:
|
||||
with SHORTEN_AND_IMPORT:
|
||||
with SHORTEN_AND_STAR_IMPORT:
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
package foo
|
||||
|
||||
class Foo {
|
||||
fun test() {
|
||||
<expr>foo.myRun {
|
||||
42
|
||||
}</expr>
|
||||
}
|
||||
}
|
||||
|
||||
inline fun <R> myRun(block: () -> R): R = block()
|
||||
|
||||
inline fun <T, R> T.myRun(block: T.() -> R): R = block()
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
Before shortening: foo.myRun {
|
||||
42
|
||||
}
|
||||
with DO_NOT_SHORTEN:
|
||||
with SHORTEN_IF_ALREADY_IMPORTED:
|
||||
with SHORTEN_AND_IMPORT:
|
||||
[qualifier] foo.myRun {
|
||||
42
|
||||
}
|
||||
with SHORTEN_AND_STAR_IMPORT:
|
||||
[qualifier] foo.myRun {
|
||||
42
|
||||
}
|
||||
+4
@@ -0,0 +1,4 @@
|
||||
// FILE: main.kt
|
||||
package test
|
||||
|
||||
<expr>fun foo(p1: dependency1.T, p2: dependency2.T) {}</expr>
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
Before shortening: fun foo(p1: dependency1.T, p2: dependency2.T) {}
|
||||
with DO_NOT_SHORTEN:
|
||||
with SHORTEN_IF_ALREADY_IMPORTED:
|
||||
with SHORTEN_AND_IMPORT:
|
||||
with SHORTEN_AND_STAR_IMPORT:
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
// FILE: main.kt
|
||||
package a.b.c
|
||||
|
||||
import dependency.T
|
||||
|
||||
class T
|
||||
|
||||
fun test() {
|
||||
class T(a: Int)
|
||||
<expr>dependency.T<Int>(3)</expr>
|
||||
}
|
||||
|
||||
// FILE: dep.kt
|
||||
package dependency
|
||||
|
||||
class T<E>(value: Int)
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
Before shortening: dependency.T<Int>(3)
|
||||
with DO_NOT_SHORTEN:
|
||||
with SHORTEN_IF_ALREADY_IMPORTED:
|
||||
[qualifier] dependency.T<Int>(3)
|
||||
with SHORTEN_AND_IMPORT:
|
||||
[qualifier] dependency.T<Int>(3)
|
||||
with SHORTEN_AND_STAR_IMPORT:
|
||||
[qualifier] dependency.T<Int>(3)
|
||||
+15
@@ -0,0 +1,15 @@
|
||||
// FILE: main.kt
|
||||
package a.b.c
|
||||
|
||||
import dependency.T
|
||||
|
||||
class T(a: Int)
|
||||
|
||||
fun test() {
|
||||
<expr>dependency.T::class.java</expr>
|
||||
}
|
||||
|
||||
// FILE: dep.kt
|
||||
package dependency
|
||||
|
||||
class T<E>(value: Int)
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
Before shortening: dependency.T::class.java
|
||||
with DO_NOT_SHORTEN:
|
||||
with SHORTEN_IF_ALREADY_IMPORTED:
|
||||
[qualifier] dependency.T
|
||||
with SHORTEN_AND_IMPORT:
|
||||
[qualifier] dependency.T
|
||||
with SHORTEN_AND_STAR_IMPORT:
|
||||
[qualifier] dependency.T
|
||||
+20
@@ -0,0 +1,20 @@
|
||||
// FILE: main.kt
|
||||
package a.b.c
|
||||
|
||||
import dependency.foo
|
||||
|
||||
fun foo() {}
|
||||
|
||||
class Outer {
|
||||
fun foo() {}
|
||||
class Inner {
|
||||
fun test() {
|
||||
<expr>a.b.c.foo()</expr>
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// FILE: dep.kt
|
||||
package dependency
|
||||
|
||||
fun foo() {}
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
Before shortening: a.b.c.foo()
|
||||
with DO_NOT_SHORTEN:
|
||||
with SHORTEN_IF_ALREADY_IMPORTED:
|
||||
with SHORTEN_AND_IMPORT:
|
||||
with SHORTEN_AND_STAR_IMPORT:
|
||||
+22
@@ -0,0 +1,22 @@
|
||||
// FILE: main.kt
|
||||
package a.b.c
|
||||
|
||||
import dependency.foo
|
||||
|
||||
fun foo() {}
|
||||
|
||||
class Outer {
|
||||
class Inner {
|
||||
fun test() {
|
||||
<expr>Outer.Inner.foo()</expr>
|
||||
}
|
||||
companion object {
|
||||
fun foo() {}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// FILE: dep.kt
|
||||
package dependency
|
||||
|
||||
fun foo() {}
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
Before shortening: Outer.Inner.foo()
|
||||
with DO_NOT_SHORTEN:
|
||||
with SHORTEN_IF_ALREADY_IMPORTED:
|
||||
[qualifier] Outer.Inner
|
||||
[qualifier] Outer.Inner.foo()
|
||||
with SHORTEN_AND_IMPORT:
|
||||
[qualifier] Outer.Inner
|
||||
[qualifier] Outer.Inner.foo()
|
||||
with SHORTEN_AND_STAR_IMPORT:
|
||||
[qualifier] Outer.Inner
|
||||
[qualifier] Outer.Inner.foo()
|
||||
+23
@@ -0,0 +1,23 @@
|
||||
// FILE: main.kt
|
||||
package a.b.c
|
||||
|
||||
import dependency.foo
|
||||
|
||||
fun foo() {}
|
||||
|
||||
class Outer {
|
||||
class Inner {
|
||||
fun foo() {}
|
||||
fun test() {
|
||||
<expr>Outer.Inner.foo()</expr>
|
||||
}
|
||||
companion object {
|
||||
fun foo() {}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// FILE: dep.kt
|
||||
package dependency
|
||||
|
||||
fun foo() {}
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
Before shortening: Outer.Inner.foo()
|
||||
with DO_NOT_SHORTEN:
|
||||
with SHORTEN_IF_ALREADY_IMPORTED:
|
||||
[qualifier] Outer.Inner
|
||||
with SHORTEN_AND_IMPORT:
|
||||
[qualifier] Outer.Inner
|
||||
with SHORTEN_AND_STAR_IMPORT:
|
||||
[qualifier] Outer.Inner
|
||||
+23
@@ -0,0 +1,23 @@
|
||||
// FILE: main.kt
|
||||
package a.b.c
|
||||
|
||||
import dependency.foo
|
||||
|
||||
fun foo() {}
|
||||
|
||||
open class Base {
|
||||
companion object {
|
||||
fun foo() {}
|
||||
}
|
||||
}
|
||||
|
||||
class Child : Base() {
|
||||
fun test() {
|
||||
<expr>Base.foo()</expr>
|
||||
}
|
||||
}
|
||||
|
||||
// FILE: dep.kt
|
||||
package dependency
|
||||
|
||||
fun foo() {}
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
Before shortening: Base.foo()
|
||||
with DO_NOT_SHORTEN:
|
||||
with SHORTEN_IF_ALREADY_IMPORTED:
|
||||
[qualifier] Base.foo()
|
||||
with SHORTEN_AND_IMPORT:
|
||||
[qualifier] Base.foo()
|
||||
with SHORTEN_AND_STAR_IMPORT:
|
||||
[qualifier] Base.foo()
|
||||
Vendored
+14
@@ -0,0 +1,14 @@
|
||||
// FILE: main.kt
|
||||
package my.simple.name
|
||||
|
||||
fun one() {}
|
||||
|
||||
open class Parent {
|
||||
fun one() {}
|
||||
}
|
||||
|
||||
class Child: Parent() {
|
||||
fun test() {
|
||||
<expr>my.simple.name.one()</expr>
|
||||
}
|
||||
}
|
||||
Vendored
+5
@@ -0,0 +1,5 @@
|
||||
Before shortening: my.simple.name.one()
|
||||
with DO_NOT_SHORTEN:
|
||||
with SHORTEN_IF_ALREADY_IMPORTED:
|
||||
with SHORTEN_AND_IMPORT:
|
||||
with SHORTEN_AND_STAR_IMPORT:
|
||||
Vendored
+9
@@ -0,0 +1,9 @@
|
||||
// FILE: main.kt
|
||||
package a.b.c
|
||||
|
||||
fun <T> foo(a: T, b: T) = a.hashCode() + b.hashCode()
|
||||
|
||||
fun test(): Int {
|
||||
fun foo(a: Int, b: Int) = a + b
|
||||
return <expr>a.b.c.foo(1, 2)</expr>
|
||||
}
|
||||
Vendored
+5
@@ -0,0 +1,5 @@
|
||||
Before shortening: a.b.c.foo(1, 2)
|
||||
with DO_NOT_SHORTEN:
|
||||
with SHORTEN_IF_ALREADY_IMPORTED:
|
||||
with SHORTEN_AND_IMPORT:
|
||||
with SHORTEN_AND_STAR_IMPORT:
|
||||
Vendored
+10
@@ -0,0 +1,10 @@
|
||||
fun <T> foo(a: T, b: T) = a.hashCode() + b.hashCode()
|
||||
|
||||
fun <E> E.foo() = hashCode()
|
||||
|
||||
fun <E> E.foo(x: E, y: E) = x.hashCode() + y.hashCode()
|
||||
|
||||
fun test(): Int {
|
||||
fun foo(a: Int, b: Int) = a + b
|
||||
return <expr>foo<Int>(1, 2)</expr>
|
||||
}
|
||||
Vendored
+5
@@ -0,0 +1,5 @@
|
||||
Before shortening: foo<Int>(1, 2)
|
||||
with DO_NOT_SHORTEN:
|
||||
with SHORTEN_IF_ALREADY_IMPORTED:
|
||||
with SHORTEN_AND_IMPORT:
|
||||
with SHORTEN_AND_STAR_IMPORT:
|
||||
Vendored
+17
@@ -0,0 +1,17 @@
|
||||
// FILE: main.kt
|
||||
package a.b.c
|
||||
|
||||
val foo = 3
|
||||
|
||||
val <E> E.foo: Int
|
||||
get() = 4
|
||||
|
||||
object Receiver {
|
||||
val foo: Int
|
||||
get() = 5
|
||||
|
||||
fun test(): Int {
|
||||
val foo = 6
|
||||
return <expr>Receiver.foo</expr>
|
||||
}
|
||||
}
|
||||
Vendored
+5
@@ -0,0 +1,5 @@
|
||||
Before shortening: Receiver.foo
|
||||
with DO_NOT_SHORTEN:
|
||||
with SHORTEN_IF_ALREADY_IMPORTED:
|
||||
with SHORTEN_AND_IMPORT:
|
||||
with SHORTEN_AND_STAR_IMPORT:
|
||||
Vendored
+16
@@ -0,0 +1,16 @@
|
||||
// FILE: main.kt
|
||||
package a.b.c
|
||||
|
||||
val foo = 3
|
||||
|
||||
val <E> E.foo: Int
|
||||
get() = 4
|
||||
|
||||
object Receiver {
|
||||
val foo: Int
|
||||
get() = 5
|
||||
|
||||
fun test(): Int {
|
||||
return <expr>Receiver.foo</expr>
|
||||
}
|
||||
}
|
||||
Vendored
+8
@@ -0,0 +1,8 @@
|
||||
Before shortening: Receiver.foo
|
||||
with DO_NOT_SHORTEN:
|
||||
with SHORTEN_IF_ALREADY_IMPORTED:
|
||||
[qualifier] Receiver.foo
|
||||
with SHORTEN_AND_IMPORT:
|
||||
[qualifier] Receiver.foo
|
||||
with SHORTEN_AND_STAR_IMPORT:
|
||||
[qualifier] Receiver.foo
|
||||
Reference in New Issue
Block a user