workaround for opened captures (IDEA-132717)

This commit is contained in:
Anna Kozlova
2014-11-12 17:54:51 +01:00
parent 983808535d
commit 05ff6e8a83
3 changed files with 15 additions and 1 deletions

View File

@@ -1395,7 +1395,8 @@ public class InferenceSession {
}
public PsiType substituteWithInferenceVariables(PsiType type) {
return myInferenceSubstitution.substitute(type);
final PsiType substituted = myInferenceSubstitution.substitute(type);
return isProperType(substituted) ? type : substituted;
}
public InferenceSession findNestedCallSession(PsiExpression arg) {

View File

@@ -0,0 +1,9 @@
import java.util.*;
import java.util.stream.Stream;
abstract class Example {
abstract <E> Optional<E> findById(Class<E> type);
void main(Stream<Class<? extends String>> stream) {
stream.map(this::findById).map(Optional::get);
}
}

View File

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