[IR] Filter chars and codePoints from allowed to interpret function

These two functions apparently are represented in Kotlin as methods
of `kotlin.String`. Because of that we accidentally treated them as
builtins.

To also minimize such cases, added filtration by return type. We are
allowing to interpret only these functions that have primitive or
unsigned return type.

#KT-57028 Fixed
This commit is contained in:
Ivan Kylchik
2023-04-24 18:32:35 +02:00
committed by Space Team
parent 81fe411ef6
commit 7747643945
8 changed files with 56 additions and 1 deletions
@@ -0,0 +1,14 @@
// TARGET_BACKEND: JVM
// WITH_STDLIB
// FULL_JDK
// java.lang.NoSuchMethodError: java.lang.String.chars
// IGNORE_BACKEND: ANDROID
import kotlin.streams.toList
fun box(): String {
val shoulNotBeEveluated1 = "HelloWorld".chars()
val shoulNotBeEveluated2 = "HelloWorld".codePoints()
val shoulNotBeEveluated3 = "HelloWorld".chars().toList().groupBy { it }.map { it.key to it.value.size }.joinToString().also(::println)
return "OK"
}