[NI] remove redundant replacing receiver in lambda function descriptor
#KT-30927 Fixed #KT-31057 Fixed
This commit is contained in:
@@ -0,0 +1,51 @@
|
||||
// !DIAGNOSTICS: -UNUSED_EXPRESSION
|
||||
// !WITH_NEW_INFERENCE
|
||||
// !CHECK_TYPE
|
||||
|
||||
fun case_0() {
|
||||
val z: Any? = 10
|
||||
val y = z.run {
|
||||
this as Int
|
||||
<!NI;DEBUG_INFO_SMARTCAST!>this<!> // error in NI: required Int, found Any?; just inferred to Any? in OI
|
||||
}
|
||||
y checkType { <!NI;DEBUG_INFO_UNRESOLVED_WITH_TARGET, NI;UNRESOLVED_REFERENCE_WRONG_RECEIVER!>_<!><Any?>() }
|
||||
y checkType { <!OI;TYPE_MISMATCH!>_<!><Int>() }
|
||||
}
|
||||
|
||||
fun case_1(z: Any?) {
|
||||
val y = z.run {
|
||||
when (this) {
|
||||
is String -> return@run <!NI;DEBUG_INFO_SMARTCAST!>this<!> // type mismatch in the new inference (required String, found Any?)
|
||||
is Float -> ""
|
||||
else -> return@run ""
|
||||
}
|
||||
}
|
||||
y checkType { <!NI;DEBUG_INFO_UNRESOLVED_WITH_TARGET, NI;UNRESOLVED_REFERENCE_WRONG_RECEIVER!>_<!><Any?>() }
|
||||
y checkType { <!OI;TYPE_MISMATCH!>_<!><kotlin.String>() }
|
||||
// y is inferred to Any?
|
||||
}
|
||||
|
||||
fun case_2(z: Any?) {
|
||||
val y = z.run {
|
||||
when (this) {
|
||||
is String -> <!DEBUG_INFO_SMARTCAST!>this<!>
|
||||
is Float -> ""
|
||||
else -> return@run ""
|
||||
}
|
||||
}
|
||||
y checkType { _<kotlin.String>() }
|
||||
// y is inferred to String
|
||||
}
|
||||
|
||||
fun case_3(z: Any?) {
|
||||
val y = z.let {
|
||||
when (it) {
|
||||
is String -> return@let <!NI;DEBUG_INFO_SMARTCAST!>it<!>
|
||||
is Float -> ""
|
||||
else -> return@let ""
|
||||
}
|
||||
}
|
||||
y checkType { <!NI;DEBUG_INFO_UNRESOLVED_WITH_TARGET, NI;UNRESOLVED_REFERENCE_WRONG_RECEIVER!>_<!><Any?>() }
|
||||
y checkType { <!OI;TYPE_MISMATCH!>_<!><kotlin.String>() }
|
||||
// y is inferred to String
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
package
|
||||
|
||||
public fun case_0(): kotlin.Unit
|
||||
public fun case_1(/*0*/ z: kotlin.Any?): kotlin.Unit
|
||||
public fun case_2(/*0*/ z: kotlin.Any?): kotlin.Unit
|
||||
public fun case_3(/*0*/ z: kotlin.Any?): kotlin.Unit
|
||||
Reference in New Issue
Block a user