mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-13 21:55:01 +07:00
inference: don't include constraints to resolve if input bounds have proper instantiation but depends on the output of another constraints (IDEA-153164)
This commit is contained in:
-1
@@ -1390,7 +1390,6 @@ public class InferenceSession {
|
||||
boolean dependsOnOutput = false;
|
||||
for (InferenceVariable inputVariable : inputVariables) {
|
||||
if (dependsOnOutput) break;
|
||||
if (inputVariable.hasInstantiation(this)) continue;
|
||||
final Set<InferenceVariable> dependencies = inputVariable.getDependencies(this);
|
||||
dependencies.add(inputVariable);
|
||||
if (!hasCapture(inputVariable)) {
|
||||
|
||||
-10
@@ -152,16 +152,6 @@ public class InferenceVariable extends LightTypeParameter {
|
||||
}
|
||||
}
|
||||
|
||||
public boolean hasInstantiation(InferenceSession session) {
|
||||
List<PsiType> bounds = getBounds(InferenceBound.EQ);
|
||||
if (bounds != null) {
|
||||
for (PsiType bound : bounds) {
|
||||
if (session.isProperType(bound)) return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean isThrownBound() {
|
||||
return myThrownBound;
|
||||
}
|
||||
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
import java.util.Collection;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.function.Function;
|
||||
|
||||
class Test {
|
||||
{
|
||||
final Map<Comparable, List<Collection<?>>> families = sortingMerge(<error descr="Incompatible equality constraint: Integer and Comparable">(s) -> 0</error>);
|
||||
}
|
||||
|
||||
private <C extends Comparable<C>, T> Map<C, List<T>> sortingMerge(Function<T, C> keyFunction) {
|
||||
|
||||
return new HashMap<C, List<T>>();
|
||||
}
|
||||
}
|
||||
+19
@@ -0,0 +1,19 @@
|
||||
// "Replace with lambda" "true"
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.function.Function;
|
||||
|
||||
class Test {
|
||||
{
|
||||
Map<Comparable, List<Collection<?>>> families = sortingMerge((Function<Collection<?>, Comparable>) family -> new Integer(0));
|
||||
}
|
||||
|
||||
<C extends Comparable<C>, T> Map<C, List<T>> sortingMerge(
|
||||
Function<T, C> keyFunction) {
|
||||
|
||||
return new HashMap<C, List<T>>();
|
||||
}
|
||||
}
|
||||
+24
@@ -0,0 +1,24 @@
|
||||
// "Replace with lambda" "true"
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.function.Function;
|
||||
|
||||
class Test {
|
||||
{
|
||||
Map<Comparable, List<Collection<?>>> families = sortingMerge(new Fun<caret>ction<Collection<?>, Comparable>() {
|
||||
@Override
|
||||
public Comparable<Integer> apply(Collection<?> family) {
|
||||
return new Integer(0);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
<C extends Comparable<C>, T> Map<C, List<T>> sortingMerge(
|
||||
Function<T, C> keyFunction) {
|
||||
|
||||
return new HashMap<C, List<T>>();
|
||||
}
|
||||
}
|
||||
+4
@@ -280,6 +280,10 @@ public class NewLambdaHighlightingTest extends LightDaemonAnalyzerTestCase {
|
||||
doTest();
|
||||
}
|
||||
|
||||
public void testAdditionalConstraintsOrderWhenOutputVariablesAlreadyHaveProperEqualBound() throws Exception {
|
||||
doTest();
|
||||
}
|
||||
|
||||
private void doTest() {
|
||||
doTest(false);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user