DFA: count null comparison as identity comparison #KT-16538 Fixed

+ minor parameter refactoring
This commit is contained in:
mglukhikh
2017-03-24 13:05:12 +03:00
committed by Mikhail Glukhikh
parent b5aa529901
commit 4700936f66
7 changed files with 60 additions and 9 deletions
@@ -0,0 +1,25 @@
fun foo(x: String?) = x
class Test
class TestWithEquals {
override fun equals(other: Any?) = super.equals(other)
}
fun bar(i: Test?) {
if (i == null) foo(<!DEBUG_INFO_CONSTANT!>i<!>)
}
fun bar(i: TestWithEquals?) {
if (i == null) foo(<!DEBUG_INFO_CONSTANT!>i<!>)
if (null == i) foo(<!DEBUG_INFO_CONSTANT!>i<!>)
when (i) {
null -> foo(<!DEBUG_INFO_CONSTANT!>i<!>)
}
}
fun gav(i: TestWithEquals?, j: TestWithEquals?) {
if (j == null) {
if (i == <!DEBUG_INFO_CONSTANT!>j<!>) foo(<!DEBUG_INFO_CONSTANT!>i<!>)
}
}
@@ -0,0 +1,20 @@
package
public fun bar(/*0*/ i: Test?): kotlin.Unit
public fun bar(/*0*/ i: TestWithEquals?): kotlin.Unit
public fun foo(/*0*/ x: kotlin.String?): kotlin.String?
public fun gav(/*0*/ i: TestWithEquals?, /*1*/ j: TestWithEquals?): kotlin.Unit
public final class Test {
public constructor Test()
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
}
public final class TestWithEquals {
public constructor TestWithEquals()
public open override /*1*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
}