lambda/diamond inference: accept wildcards in lambda return types (IDEA-108955)

This commit is contained in:
Anna Kozlova
2013-06-14 13:30:18 +04:00
parent e21ac0491c
commit c976e88894
3 changed files with 16 additions and 0 deletions
@@ -1048,6 +1048,7 @@ public class PsiResolveHelperImpl implements PsiResolveHelper {
if (expectedType == null) {
return null;
}
expectedType = GenericsUtil.eliminateWildcards(expectedType);
} else if (parent instanceof PsiConditionalExpression) {
if (PsiUtil.isLanguageLevel8OrHigher(parent)) {
try {
@@ -0,0 +1,14 @@
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
class Demo {
public static void main(String[] args) {
Function<? super String, ? extends List<String>> mappingFunction = key -> new ArrayList<>();
}
interface Function<T, R> {
public R apply(T t);
}
}
@@ -88,6 +88,7 @@ public class LambdaHighlightingTest extends LightDaemonAnalyzerTestCase {
public void testDeclaredTypeParameterBoundsAndUnboundedWildcard() { doTest(); }
public void testConflictResolution() throws Exception {doTest();}
public void testIDEA108195() throws Exception {doTest();}
public void testDiamondInference() throws Exception { doTest();}
private void doTest() {
doTest(false);