new inference: ensure erased target type if substitutor was raw (IDEA-143183)

This commit is contained in:
Anna Kozlova
2015-07-28 20:19:59 +02:00
parent 5ce2084be3
commit 1df6b8e711
3 changed files with 24 additions and 1 deletions

View File

@@ -710,7 +710,9 @@ public class InferenceSession {
}
final int i = ArrayUtilRt.find(args, arg);
if (i < 0) return null;
return getParameterType(parameters, i, substitutor, varargs);
final PsiType parameterType = getParameterType(parameters, i, substitutor, varargs);
final boolean isRaw = substitutor != null && PsiUtil.isRawSubstitutor((PsiMethod)parentMethod, substitutor);
return isRaw ? TypeConversionUtil.erasure(parameterType) : parameterType;
}
return null;
}

View File

@@ -0,0 +1,17 @@
import java.util.Collection;
class Test {
Expression expression;
void foo() {
expression.in(parameter(Collection.class));
}
<T> Expression<T> parameter(Class<T> paramClass) {
return null;
}
interface Expression<T> {
Expression in(Expression<Collection<?>> values);
}
}

View File

@@ -283,6 +283,10 @@ public class GraphInferenceHighlightingTest extends LightDaemonAnalyzerTestCase
doTest();
}
public void testOuterMethodCallOnRawType() throws Exception {
doTest();
}
private void doTest() throws Exception {
doTest(false);
}