diff options
-rw-r--r-- | core/src/main/kotlin/Kotlin/DocumentationBuilder.kt | 1 | ||||
-rw-r--r-- | core/src/test/kotlin/format/MarkdownFormatTest.kt | 4 | ||||
-rw-r--r-- | core/src/test/kotlin/model/FunctionTest.kt | 14 | ||||
-rw-r--r-- | core/testdata/format/annotatedTypeParameter.md | 2 | ||||
-rw-r--r-- | core/testdata/format/extensionFunctionParameter.md | 2 | ||||
-rw-r--r-- | core/testdata/format/genericInheritedExtensions.md | 6 | ||||
-rw-r--r-- | core/testdata/format/htmlEscaping.html | 2 | ||||
-rw-r--r-- | core/testdata/format/nullability.md | 2 | ||||
-rw-r--r-- | core/testdata/format/parameterAnchor.html | 2 | ||||
-rw-r--r-- | core/testdata/format/receiverParameterTypeBound.md | 2 | ||||
-rw-r--r-- | core/testdata/format/summarizeSignatures.md | 2 | ||||
-rw-r--r-- | core/testdata/format/typeAliases.md | 4 | ||||
-rw-r--r-- | core/testdata/format/typeAliases.package.md | 4 | ||||
-rw-r--r-- | core/testdata/format/typeParameterBounds.md | 2 | ||||
-rw-r--r-- | core/testdata/format/typeParameterReference.kt | 6 | ||||
-rw-r--r-- | core/testdata/format/typeParameterReference.md | 8 | ||||
-rw-r--r-- | core/testdata/format/typeProjectionVariance.md | 2 |
17 files changed, 43 insertions, 22 deletions
diff --git a/core/src/main/kotlin/Kotlin/DocumentationBuilder.kt b/core/src/main/kotlin/Kotlin/DocumentationBuilder.kt index 177c6f50..856127d3 100644 --- a/core/src/main/kotlin/Kotlin/DocumentationBuilder.kt +++ b/core/src/main/kotlin/Kotlin/DocumentationBuilder.kt @@ -726,6 +726,7 @@ class DocumentationBuilder } node.appendType(constraint, NodeKind.UpperBound) } + register(this, node) return node } diff --git a/core/src/test/kotlin/format/MarkdownFormatTest.kt b/core/src/test/kotlin/format/MarkdownFormatTest.kt index 5fbd80fb..a2891c47 100644 --- a/core/src/test/kotlin/format/MarkdownFormatTest.kt +++ b/core/src/test/kotlin/format/MarkdownFormatTest.kt @@ -388,6 +388,10 @@ class MarkdownFormatTest { verifyMarkdownNodeByName("extensionScope", "test") } + @Test fun typeParameterReference() { + verifyMarkdownNode("typeParameterReference") + } + private fun buildMultiplePlatforms(path: String): DocumentationModule { val module = DocumentationModule("test") val options = DocumentationOptions("", "html", generateIndexPages = false, noStdlibLink = true) diff --git a/core/src/test/kotlin/model/FunctionTest.kt b/core/src/test/kotlin/model/FunctionTest.kt index 065decef..32910682 100644 --- a/core/src/test/kotlin/model/FunctionTest.kt +++ b/core/src/test/kotlin/model/FunctionTest.kt @@ -5,6 +5,7 @@ import org.jetbrains.dokka.NodeKind import org.junit.Assert.assertEquals import org.junit.Assert.assertTrue import org.junit.Test +import kotlin.test.assertNotNull class FunctionTest { @Test fun function() { @@ -83,9 +84,10 @@ class FunctionTest { assertEquals(NodeKind.Function, kind) assertEquals("generic function", content.summary.toTestString()) - assertEquals("public", details.elementAt(0).name) - assertEquals("final", details.elementAt(1).name) - with(details.elementAt(3)) { + val functionDetails = details + assertEquals("public", functionDetails.elementAt(0).name) + assertEquals("final", functionDetails.elementAt(1).name) + with(functionDetails.elementAt(3)) { assertEquals("T", name) assertEquals(NodeKind.TypeParameter, kind) assertEquals(Content.Empty, content) @@ -95,19 +97,19 @@ class FunctionTest { assertEquals(Content.Empty, content) assertTrue(details.none()) assertTrue(members.none()) - assertTrue(links.none()) + assertTrue(links.singleOrNull() == functionDetails.elementAt(4)) } assertTrue(members.none()) assertTrue(links.none()) } - with(details.elementAt(4)) { + with(functionDetails.elementAt(4)) { assertEquals("R", name) assertEquals(NodeKind.TypeParameter, kind) assertEquals(Content.Empty, content) assertTrue(members.none()) assertTrue(links.none()) } - assertEquals("Unit", details.elementAt(5).name) + assertEquals("Unit", functionDetails.elementAt(5).name) assertTrue(members.none()) assertTrue(links.none()) diff --git a/core/testdata/format/annotatedTypeParameter.md b/core/testdata/format/annotatedTypeParameter.md index 0aa1b9d7..aa8b8592 100644 --- a/core/testdata/format/annotatedTypeParameter.md +++ b/core/testdata/format/annotatedTypeParameter.md @@ -2,4 +2,4 @@ # containsAll -`fun <E> containsAll(elements: Collection<@UnsafeVariance E>): @UnsafeVariance E`
\ No newline at end of file +`fun <E> containsAll(elements: Collection<@UnsafeVariance `[`E`](test/contains-all#E)`>): @UnsafeVariance `[`E`](test/contains-all#E)
\ No newline at end of file diff --git a/core/testdata/format/extensionFunctionParameter.md b/core/testdata/format/extensionFunctionParameter.md index b459d49e..501d731d 100644 --- a/core/testdata/format/extensionFunctionParameter.md +++ b/core/testdata/format/extensionFunctionParameter.md @@ -2,4 +2,4 @@ # apply -`inline fun <T> T.apply(f: T.() -> Unit): T`
\ No newline at end of file +`inline fun <T> `[`T`](test/apply#T)`.apply(f: `[`T`](test/apply#T)`.() -> Unit): `[`T`](test/apply#T)
\ No newline at end of file diff --git a/core/testdata/format/genericInheritedExtensions.md b/core/testdata/format/genericInheritedExtensions.md index a3091aeb..163ff0c9 100644 --- a/core/testdata/format/genericInheritedExtensions.md +++ b/core/testdata/format/genericInheritedExtensions.md @@ -2,7 +2,7 @@ # Bar -`class Bar<T> : `[`Foo`](test/-foo/index)`<T>` +`class Bar<T> : `[`Foo`](test/-foo/index)`<`[`T`](test/-bar/index#T)`>` ### Constructors @@ -10,6 +10,6 @@ ### Extension Functions -| [first](test/first) | `fun <T> `[`Foo`](test/-foo/index)`<T>.first(): Unit` | -| [second](test/second) | `fun <T> `[`Bar`](test/-bar/index)`<T>.second(): Unit` | +| [first](test/first) | `fun <T> `[`Foo`](test/-foo/index)`<`[`T`](test/first#T)`>.first(): Unit` | +| [second](test/second) | `fun <T> `[`Bar`](test/-bar/index)`<`[`T`](test/second#T)`>.second(): Unit` | diff --git a/core/testdata/format/htmlEscaping.html b/core/testdata/format/htmlEscaping.html index fd9a3235..17d48161 100644 --- a/core/testdata/format/htmlEscaping.html +++ b/core/testdata/format/htmlEscaping.html @@ -8,7 +8,7 @@ <br/> <h1>x</h1> <a name="$x()"></a> -<code><span class="keyword">fun </span><span class="symbol"><</span><span class="identifier">T</span><span class="symbol">></span> <span class="identifier">x</span><span class="symbol">(</span><span class="symbol">)</span><span class="symbol">: </span><span class="identifier">T</span><span class="symbol">?</span></code> +<code><span class="keyword">fun </span><span class="symbol"><</span><span class="identifier">T</span><span class="symbol">></span> <span class="identifier">x</span><span class="symbol">(</span><span class="symbol">)</span><span class="symbol">: </span><a href="test/x#T"><span class="identifier">T</span></a><span class="symbol">?</span></code> <p>Special characters: < is "less than", > is "greater than", & is "ampersand"</p> </BODY> </HTML> diff --git a/core/testdata/format/nullability.md b/core/testdata/format/nullability.md index 6a4c3761..014eb485 100644 --- a/core/testdata/format/nullability.md +++ b/core/testdata/format/nullability.md @@ -10,5 +10,5 @@ ### Functions -| [foo](test/-c/foo) | `fun foo(): Comparable<T>?` | +| [foo](test/-c/foo) | `fun foo(): Comparable<`[`T`](test/-c/index#T)`>?` | diff --git a/core/testdata/format/parameterAnchor.html b/core/testdata/format/parameterAnchor.html index ecb89fe6..3ffcf595 100644 --- a/core/testdata/format/parameterAnchor.html +++ b/core/testdata/format/parameterAnchor.html @@ -8,7 +8,7 @@ <br/> <h1>processFiles</h1> <a name="$processFiles(kotlin.Function0((processFiles.T)))"></a> -<code><span class="keyword">fun </span><span class="symbol"><</span><span class="identifier">T</span><span class="symbol">></span> <span class="identifier">processFiles</span><span class="symbol">(</span><span class="identifier" id="$processFiles(kotlin.Function0((processFiles.T)))/processor">processor</span><span class="symbol">:</span> <span class="symbol">(</span><span class="symbol">)</span> <span class="symbol">-></span> <span class="identifier">T</span><span class="symbol">)</span><span class="symbol">: </span><span class="identifier">List</span><span class="symbol"><</span><span class="identifier">T</span><span class="symbol">></span></code> +<code><span class="keyword">fun </span><span class="symbol"><</span><span class="identifier">T</span><span class="symbol">></span> <span class="identifier">processFiles</span><span class="symbol">(</span><span class="identifier" id="$processFiles(kotlin.Function0((processFiles.T)))/processor">processor</span><span class="symbol">:</span> <span class="symbol">(</span><span class="symbol">)</span> <span class="symbol">-></span> <a href="test/process-files#T"><span class="identifier">T</span></a><span class="symbol">)</span><span class="symbol">: </span><span class="identifier">List</span><span class="symbol"><</span><a href="test/process-files#T"><span class="identifier">T</span></a><span class="symbol">></span></code> <p>Runs <a href="test/process-files#$processFiles(kotlin.Function0((processFiles.T)))/processor">processor</a> for each file and collects its results into single list</p> <h3>Parameters</h3> <p><a name="processor"></a> diff --git a/core/testdata/format/receiverParameterTypeBound.md b/core/testdata/format/receiverParameterTypeBound.md index 8a8c4220..9c767449 100644 --- a/core/testdata/format/receiverParameterTypeBound.md +++ b/core/testdata/format/receiverParameterTypeBound.md @@ -10,5 +10,5 @@ ### Extension Functions -| [xyzzy](test/xyzzy) | `fun <T : `[`Foo`](test/-foo/index)`> T.xyzzy(): Unit` | +| [xyzzy](test/xyzzy) | `fun <T : `[`Foo`](test/-foo/index)`> `[`T`](test/xyzzy#T)`.xyzzy(): Unit` | diff --git a/core/testdata/format/summarizeSignatures.md b/core/testdata/format/summarizeSignatures.md index d37f2301..c1830fb5 100644 --- a/core/testdata/format/summarizeSignatures.md +++ b/core/testdata/format/summarizeSignatures.md @@ -10,5 +10,5 @@ ### Functions -| [foo](test/kotlin/foo) | `fun <T> any_array<T>.foo(predicate: (T) -> Boolean): Boolean`<br>Returns true if foo. | +| [foo](test/kotlin/foo) | `fun <T> any_array<T>.foo(predicate: (`[`T`](test/kotlin/foo#T)`) -> Boolean): Boolean`<br>Returns true if foo. | diff --git a/core/testdata/format/typeAliases.md b/core/testdata/format/typeAliases.md index 55e9317e..2a813c32 100644 --- a/core/testdata/format/typeAliases.md +++ b/core/testdata/format/typeAliases.md @@ -30,11 +30,11 @@ # H -`typealias H<T> = `[`C`](test/-c/index)`<T>`[test](test/index) / [I](test/-i) +`typealias H<T> = `[`C`](test/-c/index)`<`[`T`](test/-h#T)`>`[test](test/index) / [I](test/-i) # I -`typealias I<T> = `[`H`](test/-h)`<T>`[test](test/index) / [J](test/-j) +`typealias I<T> = `[`H`](test/-h)`<`[`T`](test/-i#T)`>`[test](test/index) / [J](test/-j) # J diff --git a/core/testdata/format/typeAliases.package.md b/core/testdata/format/typeAliases.package.md index 0eff1ed5..9407588b 100644 --- a/core/testdata/format/typeAliases.package.md +++ b/core/testdata/format/typeAliases.package.md @@ -14,8 +14,8 @@ | [E](test/-e) | `typealias E = `[`D`](test/-d) | | [F](test/-f) | `typealias F = (`[`A`](test/-a/index)`) -> `[`B`](test/-b/index) | | [G](test/-g) | `typealias G = `[`C`](test/-c/index)`<`[`A`](test/-a/index)`>` | -| [H](test/-h) | `typealias H<T> = `[`C`](test/-c/index)`<T>` | -| [I](test/-i) | `typealias I<T> = `[`H`](test/-h)`<T>` | +| [H](test/-h) | `typealias H<T> = `[`C`](test/-c/index)`<`[`T`](test/-h#T)`>` | +| [I](test/-i) | `typealias I<T> = `[`H`](test/-h)`<`[`T`](test/-i#T)`>` | | [J](test/-j) | `typealias J = `[`H`](test/-h)`<`[`A`](test/-a/index)`>` | | [K](test/-k) | `typealias K = `[`H`](test/-h)`<`[`J`](test/-j)`>` | | [L](test/-l) | `typealias L = (`[`K`](test/-k)`, `[`B`](test/-b/index)`) -> `[`J`](test/-j) | diff --git a/core/testdata/format/typeParameterBounds.md b/core/testdata/format/typeParameterBounds.md index 58df82a3..8f369ed6 100644 --- a/core/testdata/format/typeParameterBounds.md +++ b/core/testdata/format/typeParameterBounds.md @@ -2,7 +2,7 @@ # generic -`fun <T : R, R> generic(): Unit` +`fun <T : `[`R`](test/generic#R)`, R> generic(): Unit` generic function diff --git a/core/testdata/format/typeParameterReference.kt b/core/testdata/format/typeParameterReference.kt new file mode 100644 index 00000000..f196112d --- /dev/null +++ b/core/testdata/format/typeParameterReference.kt @@ -0,0 +1,6 @@ +/** + * Correct ref to [T] + */ +fun <T> T.tt() { + println("T.tt") +}
\ No newline at end of file diff --git a/core/testdata/format/typeParameterReference.md b/core/testdata/format/typeParameterReference.md new file mode 100644 index 00000000..ea49d48a --- /dev/null +++ b/core/testdata/format/typeParameterReference.md @@ -0,0 +1,8 @@ +[test](test/index) / [tt](test/tt) + +# tt + +`fun <T> `[`T`](test/tt#T)`.tt(): Unit` + +Correct ref to [T](test/tt#T) + diff --git a/core/testdata/format/typeProjectionVariance.md b/core/testdata/format/typeProjectionVariance.md index 5b8fc190..072b9fc7 100644 --- a/core/testdata/format/typeProjectionVariance.md +++ b/core/testdata/format/typeProjectionVariance.md @@ -2,5 +2,5 @@ ### Extensions for kotlin.Array -| [foo](test/kotlin.-array/foo) | `fun <T> Array<out T>.foo(): Unit` | +| [foo](test/kotlin.-array/foo) | `fun <T> Array<out `[`T`](test/kotlin.-array/foo#T)`>.foo(): Unit` | |