Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[K2] Ambiguous KDoc link with the same name #3451

Open
vmishenev opened this issue Jan 16, 2024 · 5 comments
Open

[K2] Ambiguous KDoc link with the same name #3451

vmishenev opened this issue Jan 16, 2024 · 5 comments
Labels
bug kdoc-spec An issue that requires clarification from the KDoc spec's perspective topic: K2 Issues / PRs that are related to the K2 migration. See #2888

Comments

@vmishenev
Copy link
Contributor

            /**
            *  [AllKDocTagsClass]
            */
            class AllKDocTagsClass {
                class AllKDocTagsClass
            }

In K1 [AllKDocTagsClass] leads to AllKDocTagsClass.AllKDocTagsClass class.
In K2 it leads to the first AllKDocTagsClass.

Related: #3179

@vmishenev vmishenev added bug kdoc-spec An issue that requires clarification from the KDoc spec's perspective topic: K2 Issues / PRs that are related to the K2 migration. See #2888 labels Jan 16, 2024
@vmishenev
Copy link
Contributor Author

fun x(){}
/**
* ref to [x]
*/
val x = 0

In K1 the [x] leads to fun x.
In K2 it leads only to the property.

But in the following example

fun x(){}
val x = 0
/**
* ref to [x]
*/
val x2 = 0

K2 x has 2 candidates. see #3447

@IgnatBeresnev
Copy link
Member

This is a question for the KDoc specification. Maybe we don't need to do anything, maybe some changes will be required on our side or on the Analysis API side. Depends on how we decide it should work

@IgnatBeresnev IgnatBeresnev changed the title Ambiguous link to a nested class with the same name [K2] Ambiguous link to a nested class with the same name Mar 15, 2024
@vmishenev vmishenev changed the title [K2] Ambiguous link to a nested class with the same name [K2] Ambiguous KDoc link with the same name May 27, 2024
@vmishenev
Copy link
Contributor Author

vmishenev commented May 27, 2024

K2 behavior for factory functions:

/**
 * [SomeCl] leads to the class
 */
class SomeCl(i: Int)

/**
 * [SomeCl] leads to the factory function 
 * In K1, it leads to the class
 * [a] and [b] lead to the params in K1 and K2
 */
fun SomeCl(i: Int, b: Int): SomeCl = TODO()

/**
 * [SomeCl] leads to the class (In Dokka)
 */
fun other() {}

Non-obvious side effect: (fix!?)

/**
 * [CoroutineScope.cancel] is resolved
 */
interface CoroutineScope
/**
 * [CoroutineScope.cancel] is unresolved since here [CoroutineScope] is a function
 */
fun CoroutineScope(i:Int): CoroutineScope = TODO()
/**
 * [CoroutineScope.cancel] is resolved
 */
fun CoroutineScope.cancel(): CoroutineScope = TODO()

image

@vmishenev
Copy link
Contributor Author

vmishenev commented May 28, 2024

one more case:

    public open class C2 {
        class A2
    }

    public class A2

    /**
     * [A2] leads to C2.A2
     */
    public class SomeClass : C2()

@vmishenev
Copy link
Contributor Author

This issues was addressed in Kotlin/KEEP#389

@vmishenev vmishenev assigned vmishenev and unassigned vmishenev Dec 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug kdoc-spec An issue that requires clarification from the KDoc spec's perspective topic: K2 Issues / PRs that are related to the K2 migration. See #2888
Projects
None yet
Development

No branches or pull requests

2 participants