resolve references from @param to type parameters of functions
#KT-12001 Fixed
This commit is contained in:
@@ -102,7 +102,7 @@ fun getParamDescriptors(fromDescriptor: DeclarationDescriptor): List<Declaration
|
||||
// TODO resolve parameters of functions passed as parameters
|
||||
when (fromDescriptor) {
|
||||
is CallableDescriptor ->
|
||||
return fromDescriptor.valueParameters
|
||||
return fromDescriptor.valueParameters + fromDescriptor.typeParameters
|
||||
is ClassifierDescriptor -> {
|
||||
val typeParams = fromDescriptor.typeConstructor.parameters
|
||||
if (fromDescriptor is ClassDescriptor) {
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
/**
|
||||
Some documentation
|
||||
|
||||
* @param T the type parameter
|
||||
* @param a Some int
|
||||
* @param b String
|
||||
*/
|
||||
fun <T> testMethod(a: Int, b: String) {
|
||||
|
||||
}
|
||||
|
||||
fun test() {
|
||||
<caret>testMethod(1, "value")
|
||||
}
|
||||
|
||||
//INFO: <b>public</b> <b>fun</b> <T> testMethod(a: Int, b: String): Unit <i>defined in</i> root package<p>Some documentation</p>
|
||||
//INFO: <dl><dt><b>Parameters:</b></dt><dd><code>T</code> - the type parameter</dd><dd><code>a</code> - Some int</dd><dd><code>b</code> - String</dd></dl>
|
||||
@@ -0,0 +1,4 @@
|
||||
/**
|
||||
* @param T this is a type parameter
|
||||
*/
|
||||
fun <<caret>T> f(s: String) { }
|
||||
@@ -0,0 +1,4 @@
|
||||
/**
|
||||
* @param R this is a type parameter
|
||||
*/
|
||||
fun <<caret>R> f(s: String) { }
|
||||
+6
@@ -155,6 +155,12 @@ public class QuickDocProviderTestGenerated extends AbstractQuickDocProviderTest
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("OnMethodUsageWithTypeParameter.kt")
|
||||
public void testOnMethodUsageWithTypeParameter() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/editor/quickDoc/OnMethodUsageWithTypeParameter.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("TopLevelMethodFromJava.java")
|
||||
public void testTopLevelMethodFromJava() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/editor/quickDoc/TopLevelMethodFromJava.java");
|
||||
|
||||
@@ -36,6 +36,10 @@ public class KdocRenameTest extends LightCodeInsightTestCase {
|
||||
doTest("bar");
|
||||
}
|
||||
|
||||
public void testTypeParamReference() throws Exception {
|
||||
doTest("R");
|
||||
}
|
||||
|
||||
public void testCodeReference() throws Exception {
|
||||
doTest("xyzzy");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user