Regular checkType() is now called during condition analysis, TYPE_MISMATCH_IN_CONDITION removed #KT-11998 Fixed
This commit is contained in:
committed by
Mikhail Glukhikh
parent
e6ab2f1c2d
commit
6b945ba103
@@ -0,0 +1,30 @@
|
||||
// See also: KT-11998
|
||||
data class My(val x: Boolean?)
|
||||
|
||||
fun doIt() {}
|
||||
|
||||
fun foo(my: My) {
|
||||
if (my.x != null) {
|
||||
// my.x should be smart-cast
|
||||
if (<!DEBUG_INFO_SMARTCAST!>my.x<!>) doIt()
|
||||
when (<!DEBUG_INFO_SMARTCAST!>my.x<!>) {
|
||||
true -> doIt()
|
||||
}
|
||||
when {
|
||||
<!DEBUG_INFO_SMARTCAST!>my.x<!> -> doIt()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fun bar(x: Boolean?) {
|
||||
if (x != null) {
|
||||
// x should be smart-cast
|
||||
if (<!DEBUG_INFO_SMARTCAST!>x<!>) doIt()
|
||||
when (<!DEBUG_INFO_SMARTCAST!>x<!>) {
|
||||
true -> doIt()
|
||||
}
|
||||
when {
|
||||
<!DEBUG_INFO_SMARTCAST!>x<!> -> doIt()
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
package
|
||||
|
||||
public fun bar(/*0*/ x: kotlin.Boolean?): kotlin.Unit
|
||||
public fun doIt(): kotlin.Unit
|
||||
public fun foo(/*0*/ my: My): kotlin.Unit
|
||||
|
||||
public final data class My {
|
||||
public constructor My(/*0*/ x: kotlin.Boolean?)
|
||||
public final val x: kotlin.Boolean?
|
||||
public final operator /*synthesized*/ fun component1(): kotlin.Boolean?
|
||||
public final /*synthesized*/ fun copy(/*0*/ x: kotlin.Boolean? = ...): My
|
||||
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
|
||||
}
|
||||
Reference in New Issue
Block a user