mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
lambda/diamond inference: accept wildcards in lambda return types (IDEA-108955)
This commit is contained in:
@@ -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 {
|
||||
|
||||
+14
@@ -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);
|
||||
}
|
||||
}
|
||||
+1
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user