Skip to content

Commit 091fd1d

Browse files
committed
[KEEP-0389] Minor fixes and adjustments
See KT-76607
1 parent 91f719f commit 091fd1d

File tree

1 file changed

+39
-1
lines changed

1 file changed

+39
-1
lines changed

proposals/KEEP-0389-kdoc-streamline-ambiguous-KDoc-links.md

Lines changed: 39 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -573,7 +573,7 @@ fun foo(x: Int) {}
573573

574574
And while some of them are generic and can be used for all kinds of declarations, e.g., `@see`,
575575
most of them are clearly supposed to accept specific kinds of declarations.
576-
* `@param` should be used for function / constructor parameters.
576+
* `@param` should be used for function / constructor parameters / context parameters.
577577
* `@property` should be used for links to class properties:
578578
both from the primary constructor and from the class body. .
579579
* `@exception` / `@throws` should be used for `Throwable`s.
@@ -1341,6 +1341,9 @@ class C
13411341
// FILE: Usage.kt
13421342
package usage
13431343

1344+
/**
1345+
* [A.B.C] - should be resolved
1346+
*/
13441347
fun usage() {
13451348
A.B.C() // RESOLVED
13461349
}
@@ -1353,6 +1356,9 @@ But take a look at how it changes after introducing other declarations in the sa
13531356

13541357
fun A() = 5 // Function
13551358

1359+
/**
1360+
* [A.B.C] - should be resolved
1361+
*/
13561362
fun usage() {
13571363
A.B.C() // RESOLVED
13581364
}
@@ -1363,6 +1369,9 @@ fun usage() {
13631369

13641370
val A = 5 // Property
13651371

1372+
/**
1373+
* [A.B.C] - should be unresolved
1374+
*/
13661375
fun usage() {
13671376
A.B.C() // UNRESOLVED
13681377
}
@@ -1373,6 +1382,9 @@ fun usage() {
13731382

13741383
class A // Class
13751384

1385+
/**
1386+
* [A.B.C] - should be unresolved
1387+
*/
13761388
fun usage() {
13771389
A.B.C() // UNRESOLVED
13781390
}
@@ -1385,6 +1397,9 @@ class Something
13851397

13861398
fun Something.A() {} // Extension
13871399

1400+
/**
1401+
* [A.B.C] - should be resolved
1402+
*/
13881403
fun Something.usage() {
13891404
A.B.C() // RESOLVED
13901405
}
@@ -1398,6 +1413,9 @@ class Something
13981413
val Something.A: Int // Extension
13991414
get() = 5
14001415

1416+
/**
1417+
* [A.B.C] - should be unresolved
1418+
*/
14011419
fun Something.usage() {
14021420
A.B.C() // UNRESOLVED
14031421
}
@@ -1486,6 +1504,26 @@ both KDoc comments. If we stop the resolution pipeline after encountering `val A
14861504
the `A.B` link in `Usage1` will be unresolved, even though it's a valid link from
14871505
the language perspective.
14881506

1507+
Additionaly, the language resolution doesn't always apply these restrictions when resolving multi-segment names.
1508+
Take a look at the following example:
1509+
```kotlin
1510+
class A {
1511+
class B
1512+
}
1513+
1514+
class Usage {
1515+
class A
1516+
1517+
fun foo() {
1518+
val x: A.B = A.B()
1519+
}
1520+
}
1521+
```
1522+
Here the type specification `x: A.B` is resolved, however, the actual constructor call `A.B()` is not.
1523+
That's because the language only applies these restrictions to multi-segment calls resolution.
1524+
However, when resolving types from type specifications, the compiler goes through all the scopes until it finds
1525+
a successful chain.
1526+
14891527
Since we would like the KDoc resolution to be a superset of the language resolution and not a subset,
14901528
we have to reject this idea.
14911529

0 commit comments

Comments
 (0)