lambda: ensure ground type is taken before lambda parameter type is calculated (IDEA-129791)

This commit is contained in:
Anna Kozlova
2014-09-12 21:36:55 +04:00
parent ea883dd1e7
commit c07c3f5c5b
3 changed files with 26 additions and 1 deletions
@@ -0,0 +1,18 @@
import java.util.Optional;
import java.util.function.Function;
class CyclicInferenceTest2 {
void test(final Extractor2<String, ?> pE, final Match2<String, Integer> pMatch) {
Match2<String, Integer> matcher = pMatch.or(pE, i -> 2); // "i" is red-highlighted
}
}
class Match2<T, V> {
public <W> Match2<T, V> or(Extractor2<T, W> e, Function<W, V> c) {
return this;
}
}
interface Extractor2<T, W> {
Optional<W> unapply(T t);
}