Files
kotlin-fork/compiler/testData/codegen/box/involvesIrInterpreter/kt57028.kt
T
Ivan Kylchik 7747643945 [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
2023-05-03 12:47:35 +00:00

15 lines
449 B
Kotlin
Vendored

// 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"
}