[FIR] Properly handle when subject expression in DFA of equality calls
^KT-50785 Fixed
This commit is contained in:
+31
@@ -0,0 +1,31 @@
|
||||
FILE: literalInWhenSubject.kt
|
||||
public final fun test_1(s: R|kotlin/String?|): R|kotlin/Unit| {
|
||||
when (Boolean(true)) {
|
||||
==($subj$, !=(R|<local>/s|, Null(null))) -> {
|
||||
R|<local>/s|.R|kotlin/String.length|
|
||||
}
|
||||
else -> {
|
||||
Null(null)
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
public final fun test_2(s: R|kotlin/String?|): R|kotlin/Unit| {
|
||||
when (!=(R|<local>/s|, Null(null))) {
|
||||
==($subj$, Boolean(true)) -> {
|
||||
R|<local>/s|.R|kotlin/String.length|
|
||||
}
|
||||
else -> {
|
||||
Null(null)
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
public final fun test_3(s: R|kotlin/String?|): R|kotlin/Unit| {
|
||||
when () {
|
||||
==(Boolean(true), !=(R|<local>/s|, Null(null))) -> {
|
||||
R|<local>/s|.R|kotlin/String.length|
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
+19
@@ -0,0 +1,19 @@
|
||||
// ISSUE: KT-50785
|
||||
|
||||
fun test_1(s: String?) {
|
||||
when (true) {
|
||||
(s != null) -> s.length
|
||||
else -> null
|
||||
}
|
||||
}
|
||||
|
||||
fun test_2(s: String?) {
|
||||
when (s != null) {
|
||||
true -> s.length
|
||||
else -> null
|
||||
}
|
||||
}
|
||||
|
||||
fun test_3(s: String?) {
|
||||
if (true == (s != null)) s.length
|
||||
}
|
||||
Reference in New Issue
Block a user