QuickDoc: Show sample code containing type parameters correctly
#KT-20777 Fixed
This commit is contained in:
@@ -124,7 +124,7 @@ object KDocRenderer {
|
|||||||
if (target == null)
|
if (target == null)
|
||||||
to.append("// Unresolved")
|
to.append("// Unresolved")
|
||||||
else {
|
else {
|
||||||
to.append(trimCommonIndent(target.extractExampleText()))
|
to.append(trimCommonIndent(target.extractExampleText()).htmlEscape())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+11
@@ -0,0 +1,11 @@
|
|||||||
|
/**
|
||||||
|
* @sample samples.nestedTypeParameter
|
||||||
|
*/
|
||||||
|
fun some<caret>() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
//INFO: <div class='definition'><pre><font color="808080"><i>usageNestedTypeParameters.kt</i></font><br>public fun <b>some</b>(): Unit</pre></div><div class='content'></div><table class='sections'><tr><td valign='top' class='section'><p>Samples:</td><td valign='top'><p><a href="psi_element://samples.nestedTypeParameter"><code>samples.nestedTypeParameter</code></a><pre><code>
|
||||||
|
//INFO: val m = mapOf<String, Pair<Int, Long>>()
|
||||||
|
//INFO: println(m)
|
||||||
|
//INFO: </code></pre></td></table>
|
||||||
+11
@@ -0,0 +1,11 @@
|
|||||||
|
/**
|
||||||
|
* @sample samples.singleTypeParameter
|
||||||
|
*/
|
||||||
|
fun some<caret>() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
//INFO: <div class='definition'><pre><font color="808080"><i>usageSingleTypeParameter.kt</i></font><br>public fun <b>some</b>(): Unit</pre></div><div class='content'></div><table class='sections'><tr><td valign='top' class='section'><p>Samples:</td><td valign='top'><p><a href="psi_element://samples.singleTypeParameter"><code>samples.singleTypeParameter</code></a><pre><code>
|
||||||
|
//INFO: val l = listOf<String>()
|
||||||
|
//INFO: println(l)
|
||||||
|
//INFO: </code></pre></td></table>
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
package samples
|
||||||
|
|
||||||
|
fun nestedTypeParameter() {
|
||||||
|
val m = mapOf<String, Pair<Int, Long>>()
|
||||||
|
println(m)
|
||||||
|
}
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
package samples
|
||||||
|
|
||||||
|
fun singleTypeParameter() {
|
||||||
|
val l = listOf<String>()
|
||||||
|
println(l)
|
||||||
|
}
|
||||||
@@ -58,6 +58,17 @@ class KDocSampleTest : AbstractMultiModuleTest() {
|
|||||||
doResolveTest("fqName/code/usage.kt", "samplez.a.b.c.Samplez")
|
doResolveTest("fqName/code/usage.kt", "samplez.a.b.c.Samplez")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun testTypeParameters() {
|
||||||
|
|
||||||
|
val code = module("code")
|
||||||
|
val samples = module("samples", hasTestRoot = true)
|
||||||
|
|
||||||
|
samples.addDependency(code)
|
||||||
|
|
||||||
|
doInfoTest("typeParameters/code/usageSingleTypeParameter.kt")
|
||||||
|
doInfoTest("typeParameters/code/usageNestedTypeParameters.kt")
|
||||||
|
}
|
||||||
|
|
||||||
fun doResolveTest(path: String, link: String) {
|
fun doResolveTest(path: String, link: String) {
|
||||||
|
|
||||||
configureByFile(path)
|
configureByFile(path)
|
||||||
|
|||||||
Reference in New Issue
Block a user