mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
inference: fix index for non-proper captured wildcard bounds (IDEA-188487)
This commit is contained in:
+5
-2
@@ -726,8 +726,11 @@ public class InferenceSession {
|
||||
InferenceVariable[] variables = initBounds(null, restParamSubstitution, capturedParams.toArray(PsiTypeParameter.EMPTY_ARRAY));
|
||||
int idx = 0;
|
||||
for (PsiType parameter : parameters) {
|
||||
if (parameter instanceof PsiCapturedWildcardType && isProperType(((PsiCapturedWildcardType)parameter).getWildcard())) {
|
||||
variables[idx++].putUserData(ORIGINAL_CAPTURE, (PsiCapturedWildcardType)parameter);
|
||||
if (parameter instanceof PsiCapturedWildcardType) {
|
||||
InferenceVariable variable = variables[idx++];
|
||||
if (isProperType(((PsiCapturedWildcardType)parameter).getWildcard())) {
|
||||
variable.putUserData(ORIGINAL_CAPTURE, (PsiCapturedWildcardType)parameter);
|
||||
}
|
||||
}
|
||||
}
|
||||
return variables;
|
||||
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
class MyTest {
|
||||
|
||||
private static <T> Map<? super T, ? super String> foo() {
|
||||
return null;
|
||||
}
|
||||
|
||||
{
|
||||
Map<? super Integer, ? super String> action2 = foo();
|
||||
}
|
||||
}
|
||||
+1
@@ -190,6 +190,7 @@ public class GraphInferenceHighlightingTest extends LightDaemonAnalyzerTestCase
|
||||
public void testIntersectionWithSameInterfaceButDifferentTypeArgument() { doTest(); }
|
||||
public void testVarargsMethodPreferred() { doTest(); }
|
||||
public void testSameNamedFreshVariables() { doTest(); }
|
||||
public void testEnsureOrderOfFreshVariablesWhenCaptureNonProperTypes() { doTest(); }
|
||||
|
||||
public void testApplicabilityCheckFailsExpressionTypeCheckPasses() {
|
||||
doTest();
|
||||
|
||||
Reference in New Issue
Block a user