Mark all declarations that will be evaluated with ir interpreter

This commit is contained in:
Ivan Kylchik
2021-10-28 16:42:23 +03:00
parent 1ccd5d1a3a
commit 1564f2c549
21 changed files with 905 additions and 41 deletions
+1
View File
@@ -46,4 +46,5 @@ public expect fun Char(code: UShort): Char
@WasExperimental(ExperimentalStdlibApi::class)
@kotlin.internal.InlineOnly
@Suppress("DEPRECATION")
@kotlin.internal.IntrinsicConstEvaluation
public inline val Char.code: Int get() = this.toInt()
@@ -19,5 +19,6 @@ public expect interface KCallable<out R> {
* - property accessors: the getter for a property named "foo" will have the name "<get-foo>",
* the setter, similarly, will have the name "<set-foo>".
*/
@kotlin.internal.IntrinsicConstEvaluation
public val name: String
}
@@ -22,6 +22,7 @@ package kotlin.text
* @see trimIndent
* @see kotlin.text.isWhitespace
*/
@kotlin.internal.IntrinsicConstEvaluation
public fun String.trimMargin(marginPrefix: String = "|"): String =
replaceIndentByMargin("", marginPrefix)
@@ -60,6 +61,7 @@ public fun String.replaceIndentByMargin(newIndent: String = "", marginPrefix: St
* @see trimMargin
* @see kotlin.text.isBlank
*/
@kotlin.internal.IntrinsicConstEvaluation
public fun String.trimIndent(): String = replaceIndent("")
/**
@@ -14,6 +14,7 @@ import kotlin.math.sign
/** Divides this value by the other value, flooring the result to an integer that is closer to negative infinity. */
@SinceKotlin("1.5")
@kotlin.internal.InlineOnly
@kotlin.internal.IntrinsicConstEvaluation
public inline fun Byte.floorDiv(other: Byte): Int =
this.toInt().floorDiv(other.toInt())
@@ -24,12 +25,14 @@ public inline fun Byte.floorDiv(other: Byte): Int =
*/
@SinceKotlin("1.5")
@kotlin.internal.InlineOnly
@kotlin.internal.IntrinsicConstEvaluation
public inline fun Byte.mod(other: Byte): Byte =
this.toInt().mod(other.toInt()).toByte()
/** Divides this value by the other value, flooring the result to an integer that is closer to negative infinity. */
@SinceKotlin("1.5")
@kotlin.internal.InlineOnly
@kotlin.internal.IntrinsicConstEvaluation
public inline fun Byte.floorDiv(other: Short): Int =
this.toInt().floorDiv(other.toInt())
@@ -40,12 +43,14 @@ public inline fun Byte.floorDiv(other: Short): Int =
*/
@SinceKotlin("1.5")
@kotlin.internal.InlineOnly
@kotlin.internal.IntrinsicConstEvaluation
public inline fun Byte.mod(other: Short): Short =
this.toInt().mod(other.toInt()).toShort()
/** Divides this value by the other value, flooring the result to an integer that is closer to negative infinity. */
@SinceKotlin("1.5")
@kotlin.internal.InlineOnly
@kotlin.internal.IntrinsicConstEvaluation
public inline fun Byte.floorDiv(other: Int): Int =
this.toInt().floorDiv(other)
@@ -56,12 +61,14 @@ public inline fun Byte.floorDiv(other: Int): Int =
*/
@SinceKotlin("1.5")
@kotlin.internal.InlineOnly
@kotlin.internal.IntrinsicConstEvaluation
public inline fun Byte.mod(other: Int): Int =
this.toInt().mod(other)
/** Divides this value by the other value, flooring the result to an integer that is closer to negative infinity. */
@SinceKotlin("1.5")
@kotlin.internal.InlineOnly
@kotlin.internal.IntrinsicConstEvaluation
public inline fun Byte.floorDiv(other: Long): Long =
this.toLong().floorDiv(other)
@@ -72,12 +79,14 @@ public inline fun Byte.floorDiv(other: Long): Long =
*/
@SinceKotlin("1.5")
@kotlin.internal.InlineOnly
@kotlin.internal.IntrinsicConstEvaluation
public inline fun Byte.mod(other: Long): Long =
this.toLong().mod(other)
/** Divides this value by the other value, flooring the result to an integer that is closer to negative infinity. */
@SinceKotlin("1.5")
@kotlin.internal.InlineOnly
@kotlin.internal.IntrinsicConstEvaluation
public inline fun Short.floorDiv(other: Byte): Int =
this.toInt().floorDiv(other.toInt())
@@ -88,12 +97,14 @@ public inline fun Short.floorDiv(other: Byte): Int =
*/
@SinceKotlin("1.5")
@kotlin.internal.InlineOnly
@kotlin.internal.IntrinsicConstEvaluation
public inline fun Short.mod(other: Byte): Byte =
this.toInt().mod(other.toInt()).toByte()
/** Divides this value by the other value, flooring the result to an integer that is closer to negative infinity. */
@SinceKotlin("1.5")
@kotlin.internal.InlineOnly
@kotlin.internal.IntrinsicConstEvaluation
public inline fun Short.floorDiv(other: Short): Int =
this.toInt().floorDiv(other.toInt())
@@ -104,12 +115,14 @@ public inline fun Short.floorDiv(other: Short): Int =
*/
@SinceKotlin("1.5")
@kotlin.internal.InlineOnly
@kotlin.internal.IntrinsicConstEvaluation
public inline fun Short.mod(other: Short): Short =
this.toInt().mod(other.toInt()).toShort()
/** Divides this value by the other value, flooring the result to an integer that is closer to negative infinity. */
@SinceKotlin("1.5")
@kotlin.internal.InlineOnly
@kotlin.internal.IntrinsicConstEvaluation
public inline fun Short.floorDiv(other: Int): Int =
this.toInt().floorDiv(other)
@@ -120,12 +133,14 @@ public inline fun Short.floorDiv(other: Int): Int =
*/
@SinceKotlin("1.5")
@kotlin.internal.InlineOnly
@kotlin.internal.IntrinsicConstEvaluation
public inline fun Short.mod(other: Int): Int =
this.toInt().mod(other)
/** Divides this value by the other value, flooring the result to an integer that is closer to negative infinity. */
@SinceKotlin("1.5")
@kotlin.internal.InlineOnly
@kotlin.internal.IntrinsicConstEvaluation
public inline fun Short.floorDiv(other: Long): Long =
this.toLong().floorDiv(other)
@@ -136,12 +151,14 @@ public inline fun Short.floorDiv(other: Long): Long =
*/
@SinceKotlin("1.5")
@kotlin.internal.InlineOnly
@kotlin.internal.IntrinsicConstEvaluation
public inline fun Short.mod(other: Long): Long =
this.toLong().mod(other)
/** Divides this value by the other value, flooring the result to an integer that is closer to negative infinity. */
@SinceKotlin("1.5")
@kotlin.internal.InlineOnly
@kotlin.internal.IntrinsicConstEvaluation
public inline fun Int.floorDiv(other: Byte): Int =
this.floorDiv(other.toInt())
@@ -152,12 +169,14 @@ public inline fun Int.floorDiv(other: Byte): Int =
*/
@SinceKotlin("1.5")
@kotlin.internal.InlineOnly
@kotlin.internal.IntrinsicConstEvaluation
public inline fun Int.mod(other: Byte): Byte =
this.mod(other.toInt()).toByte()
/** Divides this value by the other value, flooring the result to an integer that is closer to negative infinity. */
@SinceKotlin("1.5")
@kotlin.internal.InlineOnly
@kotlin.internal.IntrinsicConstEvaluation
public inline fun Int.floorDiv(other: Short): Int =
this.floorDiv(other.toInt())
@@ -168,12 +187,14 @@ public inline fun Int.floorDiv(other: Short): Int =
*/
@SinceKotlin("1.5")
@kotlin.internal.InlineOnly
@kotlin.internal.IntrinsicConstEvaluation
public inline fun Int.mod(other: Short): Short =
this.mod(other.toInt()).toShort()
/** Divides this value by the other value, flooring the result to an integer that is closer to negative infinity. */
@SinceKotlin("1.5")
@kotlin.internal.InlineOnly
@kotlin.internal.IntrinsicConstEvaluation
public inline fun Int.floorDiv(other: Int): Int {
var q = this / other
if (this xor other < 0 && q * other != this) q--
@@ -187,6 +208,7 @@ public inline fun Int.floorDiv(other: Int): Int {
*/
@SinceKotlin("1.5")
@kotlin.internal.InlineOnly
@kotlin.internal.IntrinsicConstEvaluation
public inline fun Int.mod(other: Int): Int {
val r = this % other
return r + (other and (((r xor other) and (r or -r)) shr 31))
@@ -195,6 +217,7 @@ public inline fun Int.mod(other: Int): Int {
/** Divides this value by the other value, flooring the result to an integer that is closer to negative infinity. */
@SinceKotlin("1.5")
@kotlin.internal.InlineOnly
@kotlin.internal.IntrinsicConstEvaluation
public inline fun Int.floorDiv(other: Long): Long =
this.toLong().floorDiv(other)
@@ -205,12 +228,14 @@ public inline fun Int.floorDiv(other: Long): Long =
*/
@SinceKotlin("1.5")
@kotlin.internal.InlineOnly
@kotlin.internal.IntrinsicConstEvaluation
public inline fun Int.mod(other: Long): Long =
this.toLong().mod(other)
/** Divides this value by the other value, flooring the result to an integer that is closer to negative infinity. */
@SinceKotlin("1.5")
@kotlin.internal.InlineOnly
@kotlin.internal.IntrinsicConstEvaluation
public inline fun Long.floorDiv(other: Byte): Long =
this.floorDiv(other.toLong())
@@ -221,12 +246,14 @@ public inline fun Long.floorDiv(other: Byte): Long =
*/
@SinceKotlin("1.5")
@kotlin.internal.InlineOnly
@kotlin.internal.IntrinsicConstEvaluation
public inline fun Long.mod(other: Byte): Byte =
this.mod(other.toLong()).toByte()
/** Divides this value by the other value, flooring the result to an integer that is closer to negative infinity. */
@SinceKotlin("1.5")
@kotlin.internal.InlineOnly
@kotlin.internal.IntrinsicConstEvaluation
public inline fun Long.floorDiv(other: Short): Long =
this.floorDiv(other.toLong())
@@ -237,12 +264,14 @@ public inline fun Long.floorDiv(other: Short): Long =
*/
@SinceKotlin("1.5")
@kotlin.internal.InlineOnly
@kotlin.internal.IntrinsicConstEvaluation
public inline fun Long.mod(other: Short): Short =
this.mod(other.toLong()).toShort()
/** Divides this value by the other value, flooring the result to an integer that is closer to negative infinity. */
@SinceKotlin("1.5")
@kotlin.internal.InlineOnly
@kotlin.internal.IntrinsicConstEvaluation
public inline fun Long.floorDiv(other: Int): Long =
this.floorDiv(other.toLong())
@@ -253,12 +282,14 @@ public inline fun Long.floorDiv(other: Int): Long =
*/
@SinceKotlin("1.5")
@kotlin.internal.InlineOnly
@kotlin.internal.IntrinsicConstEvaluation
public inline fun Long.mod(other: Int): Int =
this.mod(other.toLong()).toInt()
/** Divides this value by the other value, flooring the result to an integer that is closer to negative infinity. */
@SinceKotlin("1.5")
@kotlin.internal.InlineOnly
@kotlin.internal.IntrinsicConstEvaluation
public inline fun Long.floorDiv(other: Long): Long {
var q = this / other
if (this xor other < 0 && q * other != this) q--
@@ -272,6 +303,7 @@ public inline fun Long.floorDiv(other: Long): Long {
*/
@SinceKotlin("1.5")
@kotlin.internal.InlineOnly
@kotlin.internal.IntrinsicConstEvaluation
public inline fun Long.mod(other: Long): Long {
val r = this % other
return r + (other and (((r xor other) and (r or -r)) shr 63))
@@ -286,6 +318,7 @@ public inline fun Long.mod(other: Long): Long {
*/
@SinceKotlin("1.5")
@kotlin.internal.InlineOnly
@kotlin.internal.IntrinsicConstEvaluation
public inline fun Float.mod(other: Float): Float {
val r = this % other
return if (r != 0.0.toFloat() && r.sign != other.sign) r + other else r
@@ -300,6 +333,7 @@ public inline fun Float.mod(other: Float): Float {
*/
@SinceKotlin("1.5")
@kotlin.internal.InlineOnly
@kotlin.internal.IntrinsicConstEvaluation
public inline fun Float.mod(other: Double): Double =
this.toDouble().mod(other)
@@ -312,6 +346,7 @@ public inline fun Float.mod(other: Double): Double =
*/
@SinceKotlin("1.5")
@kotlin.internal.InlineOnly
@kotlin.internal.IntrinsicConstEvaluation
public inline fun Double.mod(other: Float): Double =
this.mod(other.toDouble())
@@ -324,6 +359,7 @@ public inline fun Double.mod(other: Float): Double =
*/
@SinceKotlin("1.5")
@kotlin.internal.InlineOnly
@kotlin.internal.IntrinsicConstEvaluation
public inline fun Double.mod(other: Double): Double {
val r = this % other
return if (r != 0.0 && r.sign != other.sign) r + other else r