Expand KDoc of inc() and dec() operators #KT-43701

This commit is contained in:
Abduqodiri Qurbonzoda
2021-01-18 00:50:15 +03:00
parent b311820159
commit 98d31a1813
16 changed files with 418 additions and 75 deletions
+10 -2
View File
@@ -43,11 +43,19 @@ public class Char private constructor(public val value: Char) : Comparable<Char>
public inline operator fun minus(other: Int): Char =
(this.toInt() - other).toChar()
/** Increments this value. */
/**
* Returns this value incremented by one.
*
* @sample samples.misc.Builtins.inc
*/
public inline operator fun inc(): Char =
(this.toInt() + 1).toChar()
/** Decrements this value. */
/**
* Returns this value decremented by one.
*
* @sample samples.misc.Builtins.dec
*/
public inline operator fun dec(): Char =
(this.toInt() - 1).toChar()
@@ -209,11 +209,19 @@ public class Byte private constructor(public val value: Byte) : Number(), Compar
public inline operator fun rem(other: Double): Double =
this.toDouble() % other
/** Increments this value. */
/**
* Returns this value incremented by one.
*
* @sample samples.misc.Builtins.inc
*/
public inline operator fun inc(): Byte =
(this + 1).toByte()
/** Decrements this value. */
/**
* Returns this value decremented by one.
*
* @sample samples.misc.Builtins.dec
*/
public inline operator fun dec(): Byte =
(this - 1).toByte()
@@ -545,11 +553,19 @@ public class Short private constructor(public val value: Short) : Number(), Comp
public inline operator fun rem(other: Double): Double =
this.toDouble() % other
/** Increments this value. */
/**
* Returns this value incremented by one.
*
* @sample samples.misc.Builtins.inc
*/
public inline operator fun inc(): Short =
(this + 1).toShort()
/** Decrements this value. */
/**
* Returns this value decremented by one.
*
* @sample samples.misc.Builtins.dec
*/
public inline operator fun dec(): Short =
(this - 1).toShort()
@@ -885,11 +901,19 @@ public class Int private constructor(val value: Int) : Number(), Comparable<Int>
public inline operator fun rem(other: Double): Double =
this.toDouble() % other
/** Increments this value. */
/**
* Returns this value incremented by one.
*
* @sample samples.misc.Builtins.inc
*/
public inline operator fun inc(): Int =
this + 1
/** Decrements this value. */
/**
* Returns this value decremented by one.
*
* @sample samples.misc.Builtins.dec
*/
// TODO: Fix test compiler/testData/codegen/box/functions/invoke/invoke.kt with inline dec
public operator fun dec(): Int =
this - 1
@@ -1275,11 +1299,19 @@ public class Long private constructor(val value: Long) : Number(), Comparable<Lo
public inline operator fun rem(other: Double): Double =
this.toDouble() % other
/** Increments this value. */
/**
* Returns this value incremented by one.
*
* @sample samples.misc.Builtins.inc
*/
public inline operator fun inc(): Long =
this + 1L
/** Decrements this value. */
/**
* Returns this value decremented by one.
*
* @sample samples.misc.Builtins.dec
*/
public inline operator fun dec(): Long =
this - 1L
@@ -1651,11 +1683,19 @@ public class Float private constructor(public val value: Float) : Number(), Comp
public inline operator fun rem(other: Double): Double =
this.toDouble() % other
/** Increments this value. */
/**
* Returns this value incremented by one.
*
* @sample samples.misc.Builtins.inc
*/
public inline operator fun inc(): Float =
this + 1.0f
/** Decrements this value. */
/**
* Returns this value decremented by one.
*
* @sample samples.misc.Builtins.dec
*/
public inline operator fun dec(): Float =
this - 1.0f
@@ -1957,11 +1997,19 @@ public class Double private constructor(public val value: Double) : Number(), Co
public operator fun rem(other: Double): Double =
this - (wasm_f64_nearest(this / other) * other)
/** Increments this value. */
/**
* Returns this value incremented by one.
*
* @sample samples.misc.Builtins.inc
*/
public inline operator fun inc(): Double =
this + 1.0
/** Decrements this value. */
/**
* Returns this value decremented by one.
*
* @sample samples.misc.Builtins.dec
*/
public inline operator fun dec(): Double =
this - 1.0