FIR checker: warn unnecessary safe calls

This commit is contained in:
Jinseong Jeon
2021-04-01 11:55:05 -07:00
committed by Mikhail Glukhikh
parent 2ecb6733ed
commit 5a0b75bd89
65 changed files with 232 additions and 349 deletions
@@ -38,7 +38,7 @@ fun case_4(x: Any) {
fun case_5(x: Any?) {
if (!(x !is Nothing?)) {
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Any? & kotlin.Nothing")!>x<!>
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Any? & kotlin.Nothing")!>x<!>?.inv()
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Any? & kotlin.Nothing")!>x<!><!UNNECESSARY_SAFE_CALL!>?.<!>inv()
}
}
@@ -70,7 +70,7 @@ fun case_8(x: Any?) {
fun case_9(x: Any?) {
if (!!(x !is Nothing?)) else {
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Any? & kotlin.Nothing")!>x<!>
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Any? & kotlin.Nothing")!>x<!>?.inv()
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Any? & kotlin.Nothing")!>x<!><!UNNECESSARY_SAFE_CALL!>?.<!>inv()
}
}
@@ -53,7 +53,7 @@ fun case_3(x: Class?) {
* ISSUES: KT-30376
*/
fun case_4(x: Class?) {
if (x!!?.prop_8?.prop_8?.prop_8?.prop_8 == null == true) else {
if (x!!<!UNNECESSARY_SAFE_CALL!>?.<!>prop_8?.prop_8?.prop_8?.prop_8 == null == true) else {
<!DEBUG_INFO_EXPRESSION_TYPE("Class? & Class")!>x<!>
<!DEBUG_INFO_EXPRESSION_TYPE("Class? & Class")!>x<!>.prop_8
<!DEBUG_INFO_EXPRESSION_TYPE("Class? & Class")!>x<!>.prop_8<!UNSAFE_CALL!>.<!>prop_8
@@ -68,7 +68,7 @@ fun case_4(x: Class?) {
* ISSUES: KT-30376
*/
fun case_5(x: Class?) {
if (x?.prop_8!!?.prop_8?.prop_8?.prop_8 == null == true) else {
if (x?.prop_8!!<!UNNECESSARY_SAFE_CALL!>?.<!>prop_8?.prop_8?.prop_8 == null == true) else {
<!DEBUG_INFO_EXPRESSION_TYPE("Class? & Class")!>x<!>
<!DEBUG_INFO_EXPRESSION_TYPE("Class? & Class")!>x<!>.prop_8
<!DEBUG_INFO_EXPRESSION_TYPE("Class? & Class")!>x<!>.prop_8.prop_8
@@ -83,7 +83,7 @@ fun case_5(x: Class?) {
* ISSUES: KT-30376
*/
fun case_6(x: Class?) {
if (x?.prop_8?.prop_8?.prop_8!!?.prop_8 == null == true) else {
if (x?.prop_8?.prop_8?.prop_8!!<!UNNECESSARY_SAFE_CALL!>?.<!>prop_8 == null == true) else {
<!DEBUG_INFO_EXPRESSION_TYPE("Class? & Class")!>x<!>
<!DEBUG_INFO_EXPRESSION_TYPE("Class? & Class")!>x<!>.prop_8
<!DEBUG_INFO_EXPRESSION_TYPE("Class? & Class")!>x<!>.prop_8.prop_8