Assert that the separation of two annotations on function type during rendering it, is any whitespace-like symbol, not only whitespace itself

E.g. in quick doc mode (HTML), it may be line break

^KT-38747 Fixed
This commit is contained in:
Victor Petukhov
2021-03-30 15:27:20 +03:00
parent cf73f182c7
commit f80b98cd0e
3 changed files with 15 additions and 1 deletions
@@ -323,7 +323,7 @@ internal class DescriptorRendererImpl(
insert(lengthBefore, '(')
} else {
if (hasAnnotations) {
assert(last() == ' ')
assert(last().isWhitespace())
if (get(lastIndex - 1) != ')') {
// last annotation rendered without parenthesis - need to add them otherwise parsing will be incorrect
insert(lastIndex, "()")
@@ -0,0 +1,9 @@
fun myFun<caret>(param: @MyAnnotation (String.() -> Unit)) {} // quick documentation myFun
@Target(AnnotationTarget.TYPE)
annotation class MyAnnotation
//INFO: <div class='definition'><pre><font color="808080"><i>renderAnnotatedExtensionFunctionType.kt</i></font><br>public fun <b>myFun</b>(
//INFO: param: @<a href="psi_element://MyAnnotation">MyAnnotation</a>()
//INFO: (String.() &rarr; Unit)
//INFO: ): Unit</pre></div></pre></div><table class='sections'><p></table>
@@ -274,6 +274,11 @@ public class QuickDocProviderTestGenerated extends AbstractQuickDocProviderTest
runTest("idea/testData/editor/quickDoc/OnMethodUsageWithTypeParameter.kt");
}
@TestMetadata("renderAnnotatedExtensionFunctionType.kt")
public void testRenderAnnotatedExtensionFunctionType() throws Exception {
runTest("idea/testData/editor/quickDoc/renderAnnotatedExtensionFunctionType.kt");
}
@TestMetadata("Samples.kt")
public void testSamples() throws Exception {
runTest("idea/testData/editor/quickDoc/Samples.kt");