Data flow information: take language version into account while processing safe calls and bound values #KT-14350 Fixed
This commit is contained in:
committed by
mglukhikh
parent
ebd577e52a
commit
905e67e713
@@ -0,0 +1,52 @@
|
||||
// !LANGUAGE: -SafeCallBoundSmartCasts
|
||||
|
||||
fun foo(arg: Int?) {
|
||||
val x = arg
|
||||
if (x != null) {
|
||||
arg<!UNSAFE_CALL!>.<!>hashCode()
|
||||
}
|
||||
val y: Any? = arg
|
||||
if (y != null) {
|
||||
arg<!UNSAFE_CALL!>.<!>hashCode()
|
||||
}
|
||||
val yy: Any?
|
||||
yy = arg
|
||||
if (yy != null) {
|
||||
arg<!UNSAFE_CALL!>.<!>hashCode()
|
||||
}
|
||||
var z = arg
|
||||
z = z?.let { 42 }
|
||||
if (z != null) {
|
||||
arg<!UNSAFE_CALL!>.<!>hashCode()
|
||||
}
|
||||
}
|
||||
|
||||
fun kt6840_1(s: String?) {
|
||||
val hash = s?.hashCode()
|
||||
if (hash != null) {
|
||||
s<!UNSAFE_CALL!>.<!>length
|
||||
}
|
||||
}
|
||||
|
||||
fun kt6840_2(s: String?) {
|
||||
if (s?.hashCode() != null) {
|
||||
s<!UNSAFE_CALL!>.<!>length
|
||||
}
|
||||
}
|
||||
|
||||
fun kt1635(s: String?) {
|
||||
s?.hashCode()!!
|
||||
s<!UNSAFE_CALL!>.<!>hashCode()
|
||||
}
|
||||
|
||||
fun kt2127() {
|
||||
val s: String? = ""
|
||||
if (s?.length != null) {
|
||||
s<!UNSAFE_CALL!>.<!>hashCode()
|
||||
}
|
||||
}
|
||||
|
||||
fun kt3356(s: String?): Int {
|
||||
if (s?.length != 1) return 0
|
||||
return s<!UNSAFE_CALL!>.<!>length
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
package
|
||||
|
||||
public fun foo(/*0*/ arg: kotlin.Int?): kotlin.Unit
|
||||
public fun kt1635(/*0*/ s: kotlin.String?): kotlin.Unit
|
||||
public fun kt2127(): kotlin.Unit
|
||||
public fun kt3356(/*0*/ s: kotlin.String?): kotlin.Int
|
||||
public fun kt6840_1(/*0*/ s: kotlin.String?): kotlin.Unit
|
||||
public fun kt6840_2(/*0*/ s: kotlin.String?): kotlin.Unit
|
||||
Reference in New Issue
Block a user