method reference: use site substitutor if nothing else was inferred

This commit is contained in:
Anna Kozlova
2014-03-31 18:47:53 +02:00
parent 990094f360
commit e28d3f5c95
3 changed files with 25 additions and 0 deletions

View File

@@ -734,6 +734,7 @@ public class InferenceSession {
substitutor = substitutor.put(typeParameter, runtimeException);
}
else {
if (substitutor.getSubstitutionMap().get(typeParameter) != null) continue;
substitutor = substitutor.put(typeParameter, myErased ? null : getUpperBound(var, substitutor));
}
}

View File

@@ -0,0 +1,20 @@
import java.util.List;
import java.util.function.Function;
class Base {
interface Seq<Eq> extends Iterable<Eq> {
static <E> Seq<E> of(Iterable<? extends E> source) {
return null;
}
<R> Seq<R> map(Function<? super Eq, ? extends R> mapper);
}
}
class Test3 extends Base {
void test4(Seq<List<String>> map) {
Seq<Seq<String>> mapped = map.map(Seq::of);
}
}

View File

@@ -213,6 +213,10 @@ public class NewMethodRefHighlightingTest extends LightDaemonAnalyzerTestCase {
doTest();
}
public void testIDEA122018comment() throws Exception {
doTest();
}
private void doTest() {
doTest(false);
}