loke
08/16/2026, 12:46 PMprivate fun String.isAstralPlane(): Boolean {
return this.any(Char::isHighSurrogate)
}
Now, because any is implemented as CharSequence.any, the emitted code will call invokevirtual on the CharSequence.length() function for each iteration, instead of getting the string length once and reusing it, which would be possible if there was an overload for String. One could also make the argument that the compiler should see that the type of this in the inlined code is a String and not a CharSequence, and thus generate more efficient code. Am I overreacting, or should this be fixed?Youssef Shoaib [MOD]
08/16/2026, 1:00 PMYoussef Shoaib [MOD]
08/16/2026, 1:01 PMString.any overload or similar solution