Skip to content

Commit 0a0c4ac

Browse files
committed
[KEEP-0389] Minor wording fixes
* Put everything inside "Other considered approaches and ideas" into the past tense * Fix typos See KT-76607
1 parent 091fd1d commit 0a0c4ac

File tree

1 file changed

+29
-29
lines changed

1 file changed

+29
-29
lines changed

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

Lines changed: 29 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ A context declaration is the documented declaration itself or some component of
181181
Both Javadoc and KDoc give documented declarations the highest priority among all other declarations with the same name.
182182
If no suitable context declaration with a matching name was found, the search proceeds to other declarations.
183183

184-
This mechanism is widely used in the various libraries (e.g. Kotlinx) because of its visual consistency and simplicity.
184+
This mechanism is widely used in the various libraries (e.g., Kotlinx) because of its visual consistency and simplicity.
185185

186186
Note that the K1 implementation doesn't prioritize the documented declaration itself, but only its components.
187187
See [this section](#inconsistency-with-context-declarations) for more details on this issue.
@@ -427,7 +427,7 @@ The link `[abc]` leads to the same position in a source file independently of wh
427427
#### Related problem: Availability/Visibility of constructor parameters
428428

429429
The K1 implementation considers primary constructor parameters as unavailable in class bodies.
430-
In K2, such parameters are available in all the nested scopes, even in scope of nested classes.
430+
In K2, such parameters are available in all the nested scopes, even in scopes of nested classes.
431431

432432
```kotlin
433433
class A(a: Int) {
@@ -575,12 +575,12 @@ And while some of them are generic and can be used for all kinds of declarations
575575
most of them are clearly supposed to accept specific kinds of declarations.
576576
* `@param` should be used for function / constructor parameters / context parameters.
577577
* `@property` should be used for links to class properties:
578-
both from the primary constructor and from the class body. .
578+
both from the primary constructor and from the class body.
579579
* `@exception` / `@throws` should be used for `Throwable`s.
580580

581581
However, a lot of users are not familiar with block tags.
582582
Additionally, the difference between parameter/property can easily be confusing in practice,
583-
so there are a lot of, e.g, links to parameters that are put in `@property` sections.
583+
so there are a lot of, e.g., links to parameters that are put in `@property` sections.
584584

585585
The most obvious solution for this issue is to restrict the use of tag sections to their corresponding declaration kinds.
586586
In fact, the K1 implementation already does this, however, just for the `@param` tag.
@@ -909,7 +909,7 @@ The resolver should also handle `[this]` receiver links in a proper way.
909909
If the documented declaration is an extension callable, then `[this]` should be resolved
910910
to the extension receiver of the current declaration.
911911
In Kotlin, `this` is a special hard keyword, no declarations are allowed to be named this way,
912-
so there won't be any ambiguity and this step can be performed at any moment.
912+
so there won't be any ambiguity, and this step can be performed at any moment.
913913

914914
### Step 2. Perform scope traversal
915915

@@ -1159,18 +1159,18 @@ but didn't work out as well as we expected.
11591159

11601160
### Special resolution context inside tag sections
11611161

1162-
The following KDoc tag sections should introduce their new scope in the documentation:
1162+
The following KDoc tag sections were to introduce their new scope in the documentation:
11631163
`@constructor`, `@param`, `@property`.
11641164
Previously, these tag sections never affected the resolution of links placed inside them.
1165-
All other tag sections must not affect the resolution in any sense.
1165+
All other tag sections would not affect the resolution in any sense.
11661166

11671167
#### @constructor section
11681168

1169-
The tag `@constructor` can be applied to classes
1170-
and has context where parameters of the primary constructor and the constructor itself are available and prioritized.
1171-
These declarations should not be accessible in the regular documentation section.
1169+
The `@constructor` tag could be applied to classes
1170+
and had context where parameters of the primary constructor and the constructor itself were available and prioritized.
1171+
These declarations would not be accessible from the regular documentation section.
11721172

1173-
The motivation behind this is rather simple: the class documentation should
1173+
The motivation behind this was rather simple: the class documentation is used to
11741174
describe the data the class represents and not how this class is constructed.
11751175

11761176
```kotlin
@@ -1208,7 +1208,7 @@ class A private constructor() {
12081208
}
12091209
```
12101210

1211-
Note that the constructor symbol is prioritized over parameter symbols:
1211+
Note that the constructor symbol would be prioritized over parameter symbols:
12121212
```kotlin
12131213
/**
12141214
* [abc] - to the class
@@ -1219,12 +1219,12 @@ class abc(var abc: String)
12191219

12201220
#### @param section
12211221

1222-
`@param` section can be applied to classes and functions.
1223-
When applied to classes, it also makes the constructor and its parameters available the same way `@constructor` does;
1224-
however, parameters have higher priority.
1222+
`@param` section could have been applied to classes and functions.
1223+
When applied to classes, it would also have made the constructor and its parameters available the same way `@constructor` did;
1224+
however, parameters would have had higher priority.
12251225

1226-
The motivation for this is the same as for the `@constructor` section:
1227-
the class documentation should describe the data the class and not some construction details.
1226+
The motivation for this was the same as for the `@constructor` section:
1227+
the class documentation should describe the data the class represents and not some construction details.
12281228

12291229
```kotlin
12301230
/**
@@ -1242,8 +1242,8 @@ class A(var abc: String)
12421242
class abc(var abc: String)
12431243
```
12441244

1245-
In the case of functions, all the parameters are available from a regular KDoc.
1246-
`@param` section can be used to refer to the parameter instead of the function in case of name clashes.
1245+
In the case of functions, all the parameters were supposed to be available from a regular KDoc.
1246+
`@param` section could be used to refer to the parameter instead of the function in case of name clashes.
12471247
```kotlin
12481248
/**
12491249
* [abc] - to the function
@@ -1254,8 +1254,8 @@ fun abc(var abc: String) {}
12541254

12551255
#### @property section
12561256

1257-
`@property` section can be applied to classes to prioritize properties from this class.
1258-
Note that class properties are accessible from other tag sections as well.
1257+
`@property` section could have been applied to classes to prioritize properties from this class.
1258+
Note that class properties would be accessible from other tag sections as well.
12591259

12601260
```kotlin
12611261
/**
@@ -1323,9 +1323,9 @@ introduce a number of problems for documentation writers:
13231323
13241324
### Restrictions of multi-segment name resolution
13251325
1326-
We would like our KDoc resolution to be as close as possible
1326+
We wanted our KDoc resolution to be as close as possible
13271327
to the way Kotlin resolves names in the code.
1328-
So we should only resolve multi-segment names when the language does so.
1328+
Hence, multi-segment names were expected to be resolved only when the language did so.
13291329
13301330
Imagine that we have some name `A.B.C` that we would like to point to.
13311331
The location of this declaration relatively to the given position is not important.
@@ -1427,10 +1427,10 @@ no other non-function (class or property) more local declarations that are resol
14271427
Otherwise, some segment prefix is resolved to this declaration and the rest of the chain is unresolved,
14281428
as the resolved declaration doesn't have any suitable nested symbols.
14291429

1430-
This should be also taken into account when resolving links in KDoc:
1431-
Before performing a [scope reduction](#scope-reduction-algorithm) for relative names, the resolver has to make sure that there are no
1430+
This was also to be taken into account when resolving links in KDoc:
1431+
Before performing a [scope reduction](#scope-reduction-algorithm) for relative names, the resolver had to make sure that there were no
14321432
non-function declarations matching some segment prefix of the given name in a more local scope.
1433-
If such a declaration is found in some scope, then there is no need to process all further scopes,
1433+
If such a declaration was found in some scope, then there is no need to process all further scopes,
14341434
as the compiler would resolve this segment prefix to the declaration in this scope.
14351435

14361436
```kotlin
@@ -1455,7 +1455,7 @@ class Usage {
14551455
#### Why this idea was rejected
14561456

14571457
The main problem is that KDoc resolution has a larger scope than the language does.
1458-
That's because KDoc links ignore all visibility / accessibility modifiers during the search.
1458+
That's because KDoc links ignore visibility and accessibility during the search.
14591459

14601460
Take a look at the example below:
14611461
```kotlin
@@ -1499,12 +1499,12 @@ Since `Usage1.A` is not visible from `Usage1.Nested`, `A.B` in `Usage1.Nested` i
14991499
However, `Usage2.A` is accessible from `Usage2.Nested`, so `A.B` in `Usage2.Nested` is unresolved,
15001500
as the first segment `A` is actually resolved to `Usage2.A` property.
15011501

1502-
But KDoc links ignore declaration visibility, so this `A` property is visible from
1502+
But KDoc links ignore declaration accessibility, so this `A` property is visible from
15031503
both KDoc comments. If we stop the resolution pipeline after encountering `val A`,
15041504
the `A.B` link in `Usage1` will be unresolved, even though it's a valid link from
15051505
the language perspective.
15061506

1507-
Additionaly, the language resolution doesn't always apply these restrictions when resolving multi-segment names.
1507+
Additionally, the language resolution doesn't always apply these restrictions when resolving multi-segment names.
15081508
Take a look at the following example:
15091509
```kotlin
15101510
class A {

0 commit comments

Comments
 (0)