KT-62695 [AA] Better resolve ambiguous receiver types in KDocReferenceResolver
When encountering multiple available same named types, resolve all of them together with corresponding extensions. This aligns well with the current resolve behavior of classes with the same name (see `SameNameClassesFromStarImports.kt`) Also, add extra test for resolving the ambiguous type without the extension function. The behavior is the same - resolve to the both classes.
This commit is contained in:
committed by
Space Team
parent
e5c6a5bac3
commit
d45662c2c3
+35
@@ -0,0 +1,35 @@
|
||||
package test
|
||||
|
||||
fun Any.ext() {}
|
||||
|
||||
class Foo
|
||||
|
||||
class Outer {
|
||||
class Foo
|
||||
|
||||
/**
|
||||
* [<caret_1>Foo.ext]
|
||||
*
|
||||
* [Outer.<caret_2>Foo.ext]
|
||||
* [test.Outer.<caret_3>Foo.ext]
|
||||
*
|
||||
* [test.<caret_4>Foo.ext]
|
||||
*/
|
||||
fun test1() {}
|
||||
|
||||
class Nested {
|
||||
|
||||
class Foo
|
||||
|
||||
/**
|
||||
* [<caret_nested_1>Foo.ext]
|
||||
*
|
||||
* [Nested.<caret_nested_2>Foo.ext]
|
||||
* [Outer.Nested.<caret_nested_3>Foo.ext]
|
||||
* [test.Outer.Nested.<caret_nested_4>Foo.ext]
|
||||
*
|
||||
* [test.<caret_nested_5>Foo.ext]
|
||||
*/
|
||||
fun test2() {}
|
||||
}
|
||||
}
|
||||
+26
@@ -0,0 +1,26 @@
|
||||
<caret_1> resolved to:
|
||||
0: (in test.Outer) class Foo
|
||||
|
||||
<caret_2> resolved to:
|
||||
0: (in test.Outer) class Foo
|
||||
|
||||
<caret_3> resolved to:
|
||||
0: (in test.Outer) class Foo
|
||||
|
||||
<caret_4> resolved to:
|
||||
0: (in test) class Foo
|
||||
|
||||
<caret_nested_1> resolved to:
|
||||
0: (in test.Outer.Nested) class Foo
|
||||
|
||||
<caret_nested_2> resolved to:
|
||||
0: (in test.Outer.Nested) class Foo
|
||||
|
||||
<caret_nested_3> resolved to:
|
||||
0: (in test.Outer.Nested) class Foo
|
||||
|
||||
<caret_nested_4> resolved to:
|
||||
0: (in test.Outer.Nested) class Foo
|
||||
|
||||
<caret_nested_5> resolved to:
|
||||
0: (in test) class Foo
|
||||
+44
@@ -0,0 +1,44 @@
|
||||
// FILE: main.kt
|
||||
package test
|
||||
|
||||
import dep2.*
|
||||
import dep1.*
|
||||
|
||||
fun Any.ext() {}
|
||||
|
||||
/**
|
||||
* [Foo.<caret_1>ext]
|
||||
* [<caret_2>Foo.ext]
|
||||
*
|
||||
* [Foo.<caret_3>depExtShared]
|
||||
* [<caret_4>Foo.depExtShared]
|
||||
*
|
||||
* [Foo.<caret_5>depExt1]
|
||||
* [<caret_6>Foo.depExt1]
|
||||
*
|
||||
* [Foo.<caret_7>depExt2]
|
||||
* [<caret_8>Foo.depExt2]
|
||||
*
|
||||
* [dep1.<caret_9>Foo.ext]
|
||||
* [dep2.<caret_10>Foo.ext]
|
||||
*/
|
||||
fun test() {}
|
||||
|
||||
// FILE: dep1.kt
|
||||
package dep1
|
||||
|
||||
class Foo
|
||||
|
||||
fun Foo.depExtShared() {}
|
||||
|
||||
fun Foo.depExt1() {}
|
||||
|
||||
// FILE: dep2.kt
|
||||
package dep2
|
||||
|
||||
class Foo
|
||||
|
||||
fun Foo.depExtShared() {}
|
||||
|
||||
fun Foo.depExt2() {}
|
||||
|
||||
+32
@@ -0,0 +1,32 @@
|
||||
<caret_1> resolved to:
|
||||
0: (in test) fun kotlin.Any.ext()
|
||||
|
||||
<caret_2> resolved to:
|
||||
0: (in dep1) class Foo
|
||||
1: (in dep2) class Foo
|
||||
|
||||
<caret_3> resolved to:
|
||||
0: (in dep1) fun dep1.Foo.depExtShared()
|
||||
1: (in dep2) fun dep2.Foo.depExtShared()
|
||||
|
||||
<caret_4> resolved to:
|
||||
0: (in dep1) class Foo
|
||||
1: (in dep2) class Foo
|
||||
|
||||
<caret_5> resolved to:
|
||||
0: (in dep1) fun dep1.Foo.depExt1()
|
||||
|
||||
<caret_6> resolved to:
|
||||
0: (in dep1) class Foo
|
||||
|
||||
<caret_7> resolved to:
|
||||
0: (in dep2) fun dep2.Foo.depExt2()
|
||||
|
||||
<caret_8> resolved to:
|
||||
0: (in dep2) class Foo
|
||||
|
||||
<caret_9> resolved to:
|
||||
0: (in dep1) class Foo
|
||||
|
||||
<caret_10> resolved to:
|
||||
0: (in dep2) class Foo
|
||||
Reference in New Issue
Block a user