[AA] Add tests for KDoc reference resolution of companion object members

^KTIJ-25995
This commit is contained in:
Marco Pennekamp
2023-10-10 18:54:55 +02:00
committed by Space Team
parent 3dbae89cdd
commit 367b84d45e
27 changed files with 570 additions and 0 deletions
@@ -0,0 +1,12 @@
// UNRESOLVED_REFERENCE
open class Base {
companion object {
fun foo() {}
}
}
/**
* [Child.f<caret>oo]
*/
class Child : Base() { }
@@ -0,0 +1,16 @@
class C {
class X {
companion object {
class YY {
class ZZ { }
}
}
}
/**
* [X.YY.Z<caret>Z]
*/
fun g() {
}
}
@@ -0,0 +1,2 @@
Resolved to:
0: (in C.X.Companion.YY) class ZZ
@@ -0,0 +1,10 @@
class ClassWithCompanion {
companion object {
fun foo() { }
}
}
/**
* [ClassWithCompanion.f<caret>oo]
*/
fun test() { }
@@ -0,0 +1,2 @@
Resolved to:
0: (in ClassWithCompanion.Companion) fun foo()
@@ -0,0 +1,14 @@
// FILE: ClassWithCompanion.kt
class ClassWithCompanion {
companion object {
fun foo() { }
}
}
// FILE: main.kt
/**
* [ClassWithCompanion.f<caret>oo]
*/
fun test() { }
@@ -0,0 +1,2 @@
Resolved to:
0: (in ClassWithCompanion.Companion) fun foo()
@@ -0,0 +1,16 @@
// FILE: ClassWithCompanion.kt
package bar
class ClassWithCompanion {
companion object {
fun foo() { }
}
}
// FILE: main.kt
import bar.ClassWithCompanion
/**
* [ClassWithCompanion.f<caret>oo]
*/
fun test() { }
@@ -0,0 +1,2 @@
Resolved to:
0: (in bar.ClassWithCompanion.Companion) fun foo()
@@ -0,0 +1,8 @@
/**
* [Base.f<caret>oo]
*/
class Base {
companion object {
fun foo() {}
}
}
@@ -0,0 +1,2 @@
Resolved to:
0: (in Base.Companion) fun foo()
@@ -0,0 +1,10 @@
open class Base {
companion object {
fun foo() {}
}
}
/**
* [Base.f<caret>oo]
*/
class Child : Base() { }
@@ -0,0 +1,2 @@
Resolved to:
0: (in Base.Companion) fun foo()
@@ -0,0 +1,14 @@
// FILE: Base.kt
open class Base {
companion object {
fun foo() {}
}
}
// FILE: main.kt
/**
* [Base.f<caret>oo]
*/
class Child : Base() { }
@@ -0,0 +1,2 @@
Resolved to:
0: (in Base.Companion) fun foo()
@@ -0,0 +1,16 @@
class C {
class X {
companion object {
class YY {
fun aa() {}
}
}
}
/**
* [X.YY.a<caret>a]
*/
fun g() {
}
}
@@ -0,0 +1,2 @@
Resolved to:
0: (in C.X.Companion.YY) fun aa()
@@ -0,0 +1,8 @@
/**
* [f<caret>oo]
*/
class Base {
companion object {
fun foo() {}
}
}
@@ -0,0 +1,2 @@
Resolved to:
0: (in Base.Companion) fun foo()
@@ -0,0 +1,12 @@
// UNRESOLVED_REFERENCE
open class Base {
companion object {
fun foo() {}
}
}
/**
* [f<caret>oo]
*/
class Child : Base() { }
@@ -0,0 +1,10 @@
class A {
companion object {
fun toName(): String = ""
}
}
/**
* [A.<caret>toName.length]
*/
fun foo() {}
@@ -0,0 +1,2 @@
Resolved to:
0: (in A.Companion) fun toName(): kotlin.String