Files
kotlin-fork/compiler/testData/ir/interpreter/helpers/utils/kotlinUtils.kt
T
Alexander Udalov cf425ffded Tests: fix stdlib declarations in IR interpreter test data
Fix some unresolved supertypes. This is necessary to be able to enable
IR fake override builder by default (KT-61514), because it traverses all
supertypes and asserts that they're classes, so that it can build fake
overrides for declarations from there. Without this change, for example
`IrFakeOverrideBuilder.buildFakeOverridesForClass` would crash.
2024-02-21 08:47:01 +00:00

29 lines
918 B
Kotlin
Vendored

package kotlin
public inline val Char.code: Int get() = this.toInt()
expect fun Double.isNaN(): Boolean
expect fun Float.isNaN(): Boolean
public data class Pair<out A, out B>(public val first: A, public val second: B) : java.io.Serializable {
public override fun toString(): String = "($first, $second)"
}
public infix fun <A, B> A.to(that: B): Pair<A, B> = Pair(this, that)
public fun <T> Pair<T, T>.toList(): List<T> = listOf(first, second)
public data class Triple<out A, out B, out C>(
public val first: A, public val second: B, public val third: C
) : java.io.Serializable {
public override fun toString(): String = "($first, $second, $third)"
}
public fun <T> Triple<T, T, T>.toList(): List<T> = listOf(first, second, third)
public fun checkIndexOverflow(index: Int): Int {
if (index < 0) {
throw kotlin.ArithmeticException("Index overflow has happened.")
}
return index
}