mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-01-08 06:39:38 +07:00
conditional: ensure to convert type from parent to ll >= 1.8 so assignments would be correct, etc (IDEA-161854)
This commit is contained in:
@@ -71,7 +71,11 @@ public class PsiConditionalExpressionImpl extends ExpressionPsiElement implement
|
||||
!MethodCandidateInfo.ourOverloadGuard.currentStack().contains(PsiUtil.skipParenthesizedExprUp(this.getParent()))) {
|
||||
//15.25.3 Reference Conditional Expressions
|
||||
// The type of a poly reference conditional expression is the same as its target type.
|
||||
return InferenceSession.getTargetType(this);
|
||||
final PsiType targetType = InferenceSession.getTargetType(this);
|
||||
if (targetType instanceof PsiClassType) {
|
||||
return ((PsiClassType)targetType).setLanguageLevel(PsiUtil.getLanguageLevel(this));
|
||||
}
|
||||
return targetType;
|
||||
}
|
||||
|
||||
final int typeRank1 = TypeConversionUtil.getTypeRank(type1);
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
package p;
|
||||
class A {
|
||||
public void foo(Object o) {}
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
package p;
|
||||
class B {
|
||||
void bar(A a) {
|
||||
a.foo(true ? "1" : 1);
|
||||
}
|
||||
}
|
||||
@@ -253,6 +253,14 @@ public class MultipleJdksHighlightingTest extends UsefulTestCase {
|
||||
assertContainsElements(MethodReferencesSearch.search(method).findAll(), ref);
|
||||
}
|
||||
|
||||
public void testConditionalAssignedToJava3Object() throws Exception {
|
||||
ModuleRootModificationUtil.addDependency(myJava8Module, myJava3Module);
|
||||
final String name = getTestName(false);
|
||||
myFixture.copyFileToProject("java3/p/" + name + ".java");
|
||||
myFixture.configureByFiles("java8/p/" + name + ".java");
|
||||
myFixture.checkHighlighting();
|
||||
}
|
||||
|
||||
private void doTestWithoutLibrary() {
|
||||
final String name = getTestName(false);
|
||||
myFixture.configureByFiles("java7/p/" + name + ".java", "java8/p/" + name + ".java");
|
||||
|
||||
Reference in New Issue
Block a user