mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-13 09:19:13 +07:00
captured wildcard in subtyping constraints: use upper bound only (IDEA-139046)
This commit is contained in:
+2
-2
@@ -72,9 +72,9 @@ public class SubtypingConstraint implements ConstraintFormula {
|
||||
}
|
||||
|
||||
if (tBound instanceof PsiCapturedWildcardType) {
|
||||
tBound = ((PsiWildcardType)myT).isExtends() ? ((PsiCapturedWildcardType)tBound).getUpperBound()
|
||||
: ((PsiCapturedWildcardType)tBound).getLowerBound();
|
||||
tBound = ((PsiCapturedWildcardType)tBound).getUpperBound();
|
||||
}
|
||||
|
||||
if (myS instanceof PsiCapturedWildcardType) {
|
||||
myS = ((PsiCapturedWildcardType)myS).getWildcard();
|
||||
}
|
||||
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
import java.util.Map;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
import static java.util.stream.Collectors.toMap;
|
||||
|
||||
class Test {
|
||||
Map<String, String> foo(Stream<? extends String> stream) {
|
||||
return stream.collect(toMap(s -> s, s -> s));
|
||||
}
|
||||
}
|
||||
|
||||
+4
-3
@@ -20,9 +20,6 @@ import com.intellij.openapi.projectRoots.Sdk;
|
||||
import com.intellij.testFramework.IdeaTestUtil;
|
||||
import org.jetbrains.annotations.NonNls;
|
||||
|
||||
/**
|
||||
* Created by anna on 1/31/14.
|
||||
*/
|
||||
public class ConstraintsInferenceMiscTest extends LightDaemonAnalyzerTestCase {
|
||||
@NonNls static final String BASE_PATH = "/codeInsight/daemonCodeAnalyzer/lambda/constraints";
|
||||
|
||||
@@ -62,6 +59,10 @@ public class ConstraintsInferenceMiscTest extends LightDaemonAnalyzerTestCase {
|
||||
doTest(false);
|
||||
}
|
||||
|
||||
public void testSubtypingConstraintWithSuperCapturedWildcard() throws Exception {
|
||||
doTest(false);
|
||||
}
|
||||
|
||||
private void doTest(final boolean checkWarnings) {
|
||||
doTest(BASE_PATH + "/" + getTestName(false) + ".java", checkWarnings, false);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user