PsiPolyExpressionUtil#isBooleanOrNumericType: do not check bounds

JLS 15.25 says: ...has return type boolean or Boolean. or ...is convertible to a numeric type.
JLS 5.1.8 says:
A type is said to be convertible to a numeric type if it is a numeric type (§4.2), or it is a reference type that may be converted to a numeric type by unboxing conversion.

Nothing about bounds
PolyConditionalExpressionWithTargetPrimitive test behavior matches Java 9+ now (with --release=8)

GitOrigin-RevId: fa14e909ad623a3ab6bb8355bbbe396003cd782c
This commit is contained in:
Tagir Valeev
2020-04-23 15:37:44 +07:00
committed by intellij-monorepo-bot
parent 796a999ec3
commit ec8510b0a6
2 changed files with 2 additions and 12 deletions

View File

@@ -1,11 +1,11 @@
class Conditional {
void m(Object p, boolean b) {
int a = b ? <error descr="Incompatible types. Found: 'null', required: 'int'">null</error> : ((Getter<Integer>) p).get();
int a = b ? null : ((Getter<Integer>) p).get();
int a1 = b ? <error descr="Incompatible types. Found: 'null', required: 'int'">null</error> : Conditional.<Integer>f();
int a2 = b ? null : 1;
int a3 = b ? null : f1();
int a4 = b ? null : f2();
int a4 = b ? <error descr="Incompatible types. Found: 'null', required: 'int'">null</error> : f2();
Long someNum = b ? getNum(5L) : <error descr="Incompatible types. Found: 'int', required: 'java.lang.Long'">0</error>;
}