conditional: treat nulls separately and accept them as numeric/boolean branches (IDEA-157025)

This commit is contained in:
Anna Kozlova
2016-06-03 14:37:23 +03:00
parent c3e2e41b56
commit 3e7b1dca62
2 changed files with 12 additions and 3 deletions

View File

@@ -6,6 +6,11 @@ class Conditional {
int a2 = b ? null : 1;
int a3 = b ? null : f1();
int a4 = b ? null : f2();
Long someNum = b ? getNum(5L) : <error descr="Incompatible types. Found: 'int', required: 'java.lang.Long'">0</error>;
}
private static <T> T getNum(T num) {
return num;
}
private static <T> T f() {