store unsubstituted descriptor as REFERENCE_TARGET
This commit is contained in:
@@ -521,10 +521,10 @@ public class CandidateResolver {
|
||||
if (!(callElement instanceof JetCallExpression)) return;
|
||||
|
||||
JetCallExpression callExpression = (JetCallExpression) callElement;
|
||||
CallableDescriptor resultingDescriptor = context.candidateCall.getResultingDescriptor();
|
||||
if (BindingContextUtils.isCallExpressionWithValidReference(callExpression, context.trace.getBindingContext())) {
|
||||
CallableDescriptor resultingDescriptor = context.candidateCall.getResultingDescriptor();
|
||||
context.trace.record(BindingContext.EXPRESSION_TYPE, callExpression, resultingDescriptor.getReturnType());
|
||||
context.trace.record(BindingContext.REFERENCE_TARGET, callExpression, resultingDescriptor);
|
||||
context.trace.record(BindingContext.REFERENCE_TARGET, callExpression, context.candidateCall.getCandidateDescriptor());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+2
-2
@@ -59,9 +59,9 @@ public class TracingStrategyImpl implements TracingStrategy {
|
||||
|
||||
@Override
|
||||
public <D extends CallableDescriptor> void bindReference(@NotNull BindingTrace trace, @NotNull ResolvedCallWithTrace<D> resolvedCall) {
|
||||
CallableDescriptor descriptor = resolvedCall.getResultingDescriptor();
|
||||
CallableDescriptor descriptor = resolvedCall.getCandidateDescriptor();
|
||||
if (resolvedCall instanceof VariableAsFunctionResolvedCall) {
|
||||
descriptor = ((VariableAsFunctionResolvedCall) resolvedCall).getVariableCall().getResultingDescriptor();
|
||||
descriptor = ((VariableAsFunctionResolvedCall) resolvedCall).getVariableCall().getCandidateDescriptor();
|
||||
}
|
||||
DeclarationDescriptor storedReference = trace.get(REFERENCE_TARGET, reference);
|
||||
if (storedReference == null || !ErrorUtils.isError(descriptor)) {
|
||||
|
||||
@@ -27,6 +27,8 @@ package testData.libraries
|
||||
|
||||
[public fun func(str: jet.String): jet.Unit { /* compiled code */ }]
|
||||
|
||||
[public fun <T> genericFunc(): T { /* compiled code */ }]
|
||||
|
||||
[public fun main(args: jet.Array<jet.String>): jet.Unit { /* compiled code */ }]
|
||||
|
||||
[public fun processDouble(d: jet.Double): jet.Unit { /* compiled code */ }]
|
||||
|
||||
@@ -102,6 +102,8 @@ public fun func() {
|
||||
public fun func(cs : CharSequence) {
|
||||
}
|
||||
|
||||
public fun <T> genericFunc() : T = throw Exception()
|
||||
|
||||
public inline fun <T> T.filter(predicate: (T)-> Boolean) : T? = this
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
import testData.libraries.*
|
||||
|
||||
fun test() {
|
||||
genericFunc<String>()
|
||||
}
|
||||
|
||||
// main.kt
|
||||
//public fun <T> <1>genericFunc() : T = throw Exception()
|
||||
@@ -0,0 +1,9 @@
|
||||
import testData.libraries.*
|
||||
|
||||
|
||||
fun test() {
|
||||
val s : String = genericFunc()
|
||||
}
|
||||
|
||||
// main.kt
|
||||
//public fun <T> <1>genericFunc() : T = throw Exception()
|
||||
@@ -86,6 +86,14 @@ public class NavigateToLibrarySourceTest extends AbstractNavigateToLibraryTest {
|
||||
doTest();
|
||||
}
|
||||
|
||||
public void testGenericFunctionWithInferredTypeArguments() {
|
||||
doTest();
|
||||
}
|
||||
|
||||
public void testGenericFunctionWithExplicitlyDeclaredTypeArguments() {
|
||||
doTest();
|
||||
}
|
||||
|
||||
private void doTest() {
|
||||
myFixture.configureByFile(TEST_DATA_PATH + "/usercode/" + getTestName(false) + ".kt");
|
||||
|
||||
|
||||
Reference in New Issue
Block a user