resolve references from @param to type parameters of functions

#KT-12001 Fixed
This commit is contained in:
Dmitry Jemerov
2016-04-28 12:03:30 +02:00
parent 97c3c633a7
commit c967cc8a23
6 changed files with 36 additions and 1 deletions
@@ -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> &lt;T&gt; 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>
+4
View File
@@ -0,0 +1,4 @@
/**
* @param T this is a type parameter
*/
fun <<caret>T> f(s: String) { }
+4
View File
@@ -0,0 +1,4 @@
/**
* @param R this is a type parameter
*/
fun <<caret>R> f(s: String) { }
@@ -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");
}