From 418db53ba477123225e01470e64279e6a677b9be Mon Sep 17 00:00:00 2001 From: Ilya Gorbunov Date: Fri, 25 May 2018 18:16:55 +0300 Subject: [PATCH] Array.copyOf docs: do not use 'primitive default' term, rewrite description #KT-22298 --- .../stdlib/common/src/generated/_Arrays.kt | 72 +++++++++---------- .../stdlib/js/src/generated/_ArraysJs.kt | 72 +++++++++---------- .../stdlib/jvm/src/generated/_ArraysJvm.kt | 72 +++++++++---------- .../kotlin-stdlib-gen/src/templates/Arrays.kt | 8 +-- .../src/templates/dsl/FamilyProperties.kt | 8 +++ 5 files changed, 120 insertions(+), 112 deletions(-) diff --git a/libraries/stdlib/common/src/generated/_Arrays.kt b/libraries/stdlib/common/src/generated/_Arrays.kt index 822614b25d2..3b19ecbd564 100644 --- a/libraries/stdlib/common/src/generated/_Arrays.kt +++ b/libraries/stdlib/common/src/generated/_Arrays.kt @@ -5637,99 +5637,99 @@ public expect fun BooleanArray.copyOf(): BooleanArray public expect fun CharArray.copyOf(): CharArray /** - * Returns new array which is a copy of the original array, resized to the given [newSize], - * truncating original values or padding new array with primitive default values if necessary. + * Returns new array which is a copy of the original array, resized to the given [newSize]. + * The copy is either truncated or padded at the end with zero values if necessary. * - * For all indices that are valid in both the original array and the copy, the two arrays contents will be identical. - * For all indices that are valid in the copy, but not in the original, the copy will contain primitive default values. + * - If [newSize] is less than the size of the original array, the copy array is truncated to the [newSize]. + * - If [newSize] is greater than the size of the original array, the extra elements in the copy array are filled with zero values. * * @sample samples.collections.Arrays.CopyOfOperations.resizedPrimitiveCopyOf */ public expect fun ByteArray.copyOf(newSize: Int): ByteArray /** - * Returns new array which is a copy of the original array, resized to the given [newSize], - * truncating original values or padding new array with primitive default values if necessary. + * Returns new array which is a copy of the original array, resized to the given [newSize]. + * The copy is either truncated or padded at the end with zero values if necessary. * - * For all indices that are valid in both the original array and the copy, the two arrays contents will be identical. - * For all indices that are valid in the copy, but not in the original, the copy will contain primitive default values. + * - If [newSize] is less than the size of the original array, the copy array is truncated to the [newSize]. + * - If [newSize] is greater than the size of the original array, the extra elements in the copy array are filled with zero values. * * @sample samples.collections.Arrays.CopyOfOperations.resizedPrimitiveCopyOf */ public expect fun ShortArray.copyOf(newSize: Int): ShortArray /** - * Returns new array which is a copy of the original array, resized to the given [newSize], - * truncating original values or padding new array with primitive default values if necessary. + * Returns new array which is a copy of the original array, resized to the given [newSize]. + * The copy is either truncated or padded at the end with zero values if necessary. * - * For all indices that are valid in both the original array and the copy, the two arrays contents will be identical. - * For all indices that are valid in the copy, but not in the original, the copy will contain primitive default values. + * - If [newSize] is less than the size of the original array, the copy array is truncated to the [newSize]. + * - If [newSize] is greater than the size of the original array, the extra elements in the copy array are filled with zero values. * * @sample samples.collections.Arrays.CopyOfOperations.resizedPrimitiveCopyOf */ public expect fun IntArray.copyOf(newSize: Int): IntArray /** - * Returns new array which is a copy of the original array, resized to the given [newSize], - * truncating original values or padding new array with primitive default values if necessary. + * Returns new array which is a copy of the original array, resized to the given [newSize]. + * The copy is either truncated or padded at the end with zero values if necessary. * - * For all indices that are valid in both the original array and the copy, the two arrays contents will be identical. - * For all indices that are valid in the copy, but not in the original, the copy will contain primitive default values. + * - If [newSize] is less than the size of the original array, the copy array is truncated to the [newSize]. + * - If [newSize] is greater than the size of the original array, the extra elements in the copy array are filled with zero values. * * @sample samples.collections.Arrays.CopyOfOperations.resizedPrimitiveCopyOf */ public expect fun LongArray.copyOf(newSize: Int): LongArray /** - * Returns new array which is a copy of the original array, resized to the given [newSize], - * truncating original values or padding new array with primitive default values if necessary. + * Returns new array which is a copy of the original array, resized to the given [newSize]. + * The copy is either truncated or padded at the end with zero values if necessary. * - * For all indices that are valid in both the original array and the copy, the two arrays contents will be identical. - * For all indices that are valid in the copy, but not in the original, the copy will contain primitive default values. + * - If [newSize] is less than the size of the original array, the copy array is truncated to the [newSize]. + * - If [newSize] is greater than the size of the original array, the extra elements in the copy array are filled with zero values. * * @sample samples.collections.Arrays.CopyOfOperations.resizedPrimitiveCopyOf */ public expect fun FloatArray.copyOf(newSize: Int): FloatArray /** - * Returns new array which is a copy of the original array, resized to the given [newSize], - * truncating original values or padding new array with primitive default values if necessary. + * Returns new array which is a copy of the original array, resized to the given [newSize]. + * The copy is either truncated or padded at the end with zero values if necessary. * - * For all indices that are valid in both the original array and the copy, the two arrays contents will be identical. - * For all indices that are valid in the copy, but not in the original, the copy will contain primitive default values. + * - If [newSize] is less than the size of the original array, the copy array is truncated to the [newSize]. + * - If [newSize] is greater than the size of the original array, the extra elements in the copy array are filled with zero values. * * @sample samples.collections.Arrays.CopyOfOperations.resizedPrimitiveCopyOf */ public expect fun DoubleArray.copyOf(newSize: Int): DoubleArray /** - * Returns new array which is a copy of the original array, resized to the given [newSize], - * truncating original values or padding new array with primitive default values if necessary. + * Returns new array which is a copy of the original array, resized to the given [newSize]. + * The copy is either truncated or padded at the end with `false` values if necessary. * - * For all indices that are valid in both the original array and the copy, the two arrays contents will be identical. - * For all indices that are valid in the copy, but not in the original, the copy will contain primitive default values. + * - If [newSize] is less than the size of the original array, the copy array is truncated to the [newSize]. + * - If [newSize] is greater than the size of the original array, the extra elements in the copy array are filled with `false` values. * * @sample samples.collections.Arrays.CopyOfOperations.resizedPrimitiveCopyOf */ public expect fun BooleanArray.copyOf(newSize: Int): BooleanArray /** - * Returns new array which is a copy of the original array, resized to the given [newSize], - * truncating original values or padding new array with primitive default values if necessary. + * Returns new array which is a copy of the original array, resized to the given [newSize]. + * The copy is either truncated or padded at the end with null char (`\u0000`) values if necessary. * - * For all indices that are valid in both the original array and the copy, the two arrays contents will be identical. - * For all indices that are valid in the copy, but not in the original, the copy will contain primitive default values. + * - If [newSize] is less than the size of the original array, the copy array is truncated to the [newSize]. + * - If [newSize] is greater than the size of the original array, the extra elements in the copy array are filled with null char (`\u0000`) values. * * @sample samples.collections.Arrays.CopyOfOperations.resizedPrimitiveCopyOf */ public expect fun CharArray.copyOf(newSize: Int): CharArray /** - * Returns new array which is a copy of the original array, resized to the given [newSize], - * truncating original values or padding new array with null values if necessary. + * Returns new array which is a copy of the original array, resized to the given [newSize]. + * The copy is either truncated or padded at the end with `null` values if necessary. * - * For all indices that are valid in both the original array and the copy, the two arrays contents will be identical. - * For all indices that are valid in the copy, but not in the original, the copy will contain null values. + * - If [newSize] is less than the size of the original array, the copy array is truncated to the [newSize]. + * - If [newSize] is greater than the size of the original array, the extra elements in the copy array are filled with `null` values. * * @sample samples.collections.Arrays.CopyOfOperations.resizingCopyOf */ diff --git a/libraries/stdlib/js/src/generated/_ArraysJs.kt b/libraries/stdlib/js/src/generated/_ArraysJs.kt index 1b29280afa2..c97524bf45c 100644 --- a/libraries/stdlib/js/src/generated/_ArraysJs.kt +++ b/libraries/stdlib/js/src/generated/_ArraysJs.kt @@ -495,11 +495,11 @@ public actual fun CharArray.copyOf(): CharArray { } /** - * Returns new array which is a copy of the original array, resized to the given [newSize], - * truncating original values or padding new array with primitive default values if necessary. + * Returns new array which is a copy of the original array, resized to the given [newSize]. + * The copy is either truncated or padded at the end with zero values if necessary. * - * For all indices that are valid in both the original array and the copy, the two arrays contents will be identical. - * For all indices that are valid in the copy, but not in the original, the copy will contain primitive default values. + * - If [newSize] is less than the size of the original array, the copy array is truncated to the [newSize]. + * - If [newSize] is greater than the size of the original array, the extra elements in the copy array are filled with zero values. * * @sample samples.collections.Arrays.CopyOfOperations.resizedPrimitiveCopyOf */ @@ -508,11 +508,11 @@ public actual fun ByteArray.copyOf(newSize: Int): ByteArray { } /** - * Returns new array which is a copy of the original array, resized to the given [newSize], - * truncating original values or padding new array with primitive default values if necessary. + * Returns new array which is a copy of the original array, resized to the given [newSize]. + * The copy is either truncated or padded at the end with zero values if necessary. * - * For all indices that are valid in both the original array and the copy, the two arrays contents will be identical. - * For all indices that are valid in the copy, but not in the original, the copy will contain primitive default values. + * - If [newSize] is less than the size of the original array, the copy array is truncated to the [newSize]. + * - If [newSize] is greater than the size of the original array, the extra elements in the copy array are filled with zero values. * * @sample samples.collections.Arrays.CopyOfOperations.resizedPrimitiveCopyOf */ @@ -521,11 +521,11 @@ public actual fun ShortArray.copyOf(newSize: Int): ShortArray { } /** - * Returns new array which is a copy of the original array, resized to the given [newSize], - * truncating original values or padding new array with primitive default values if necessary. + * Returns new array which is a copy of the original array, resized to the given [newSize]. + * The copy is either truncated or padded at the end with zero values if necessary. * - * For all indices that are valid in both the original array and the copy, the two arrays contents will be identical. - * For all indices that are valid in the copy, but not in the original, the copy will contain primitive default values. + * - If [newSize] is less than the size of the original array, the copy array is truncated to the [newSize]. + * - If [newSize] is greater than the size of the original array, the extra elements in the copy array are filled with zero values. * * @sample samples.collections.Arrays.CopyOfOperations.resizedPrimitiveCopyOf */ @@ -534,11 +534,11 @@ public actual fun IntArray.copyOf(newSize: Int): IntArray { } /** - * Returns new array which is a copy of the original array, resized to the given [newSize], - * truncating original values or padding new array with primitive default values if necessary. + * Returns new array which is a copy of the original array, resized to the given [newSize]. + * The copy is either truncated or padded at the end with zero values if necessary. * - * For all indices that are valid in both the original array and the copy, the two arrays contents will be identical. - * For all indices that are valid in the copy, but not in the original, the copy will contain primitive default values. + * - If [newSize] is less than the size of the original array, the copy array is truncated to the [newSize]. + * - If [newSize] is greater than the size of the original array, the extra elements in the copy array are filled with zero values. * * @sample samples.collections.Arrays.CopyOfOperations.resizedPrimitiveCopyOf */ @@ -547,11 +547,11 @@ public actual fun LongArray.copyOf(newSize: Int): LongArray { } /** - * Returns new array which is a copy of the original array, resized to the given [newSize], - * truncating original values or padding new array with primitive default values if necessary. + * Returns new array which is a copy of the original array, resized to the given [newSize]. + * The copy is either truncated or padded at the end with zero values if necessary. * - * For all indices that are valid in both the original array and the copy, the two arrays contents will be identical. - * For all indices that are valid in the copy, but not in the original, the copy will contain primitive default values. + * - If [newSize] is less than the size of the original array, the copy array is truncated to the [newSize]. + * - If [newSize] is greater than the size of the original array, the extra elements in the copy array are filled with zero values. * * @sample samples.collections.Arrays.CopyOfOperations.resizedPrimitiveCopyOf */ @@ -560,11 +560,11 @@ public actual fun FloatArray.copyOf(newSize: Int): FloatArray { } /** - * Returns new array which is a copy of the original array, resized to the given [newSize], - * truncating original values or padding new array with primitive default values if necessary. + * Returns new array which is a copy of the original array, resized to the given [newSize]. + * The copy is either truncated or padded at the end with zero values if necessary. * - * For all indices that are valid in both the original array and the copy, the two arrays contents will be identical. - * For all indices that are valid in the copy, but not in the original, the copy will contain primitive default values. + * - If [newSize] is less than the size of the original array, the copy array is truncated to the [newSize]. + * - If [newSize] is greater than the size of the original array, the extra elements in the copy array are filled with zero values. * * @sample samples.collections.Arrays.CopyOfOperations.resizedPrimitiveCopyOf */ @@ -573,11 +573,11 @@ public actual fun DoubleArray.copyOf(newSize: Int): DoubleArray { } /** - * Returns new array which is a copy of the original array, resized to the given [newSize], - * truncating original values or padding new array with primitive default values if necessary. + * Returns new array which is a copy of the original array, resized to the given [newSize]. + * The copy is either truncated or padded at the end with `false` values if necessary. * - * For all indices that are valid in both the original array and the copy, the two arrays contents will be identical. - * For all indices that are valid in the copy, but not in the original, the copy will contain primitive default values. + * - If [newSize] is less than the size of the original array, the copy array is truncated to the [newSize]. + * - If [newSize] is greater than the size of the original array, the extra elements in the copy array are filled with `false` values. * * @sample samples.collections.Arrays.CopyOfOperations.resizedPrimitiveCopyOf */ @@ -586,11 +586,11 @@ public actual fun BooleanArray.copyOf(newSize: Int): BooleanArray { } /** - * Returns new array which is a copy of the original array, resized to the given [newSize], - * truncating original values or padding new array with primitive default values if necessary. + * Returns new array which is a copy of the original array, resized to the given [newSize]. + * The copy is either truncated or padded at the end with null char (`\u0000`) values if necessary. * - * For all indices that are valid in both the original array and the copy, the two arrays contents will be identical. - * For all indices that are valid in the copy, but not in the original, the copy will contain primitive default values. + * - If [newSize] is less than the size of the original array, the copy array is truncated to the [newSize]. + * - If [newSize] is greater than the size of the original array, the extra elements in the copy array are filled with null char (`\u0000`) values. * * @sample samples.collections.Arrays.CopyOfOperations.resizedPrimitiveCopyOf */ @@ -599,11 +599,11 @@ public actual fun CharArray.copyOf(newSize: Int): CharArray { } /** - * Returns new array which is a copy of the original array, resized to the given [newSize], - * truncating original values or padding new array with null values if necessary. + * Returns new array which is a copy of the original array, resized to the given [newSize]. + * The copy is either truncated or padded at the end with `null` values if necessary. * - * For all indices that are valid in both the original array and the copy, the two arrays contents will be identical. - * For all indices that are valid in the copy, but not in the original, the copy will contain null values. + * - If [newSize] is less than the size of the original array, the copy array is truncated to the [newSize]. + * - If [newSize] is greater than the size of the original array, the extra elements in the copy array are filled with `null` values. * * @sample samples.collections.Arrays.CopyOfOperations.resizingCopyOf */ diff --git a/libraries/stdlib/jvm/src/generated/_ArraysJvm.kt b/libraries/stdlib/jvm/src/generated/_ArraysJvm.kt index 137c35edaed..a1a4f9c6ee4 100644 --- a/libraries/stdlib/jvm/src/generated/_ArraysJvm.kt +++ b/libraries/stdlib/jvm/src/generated/_ArraysJvm.kt @@ -688,11 +688,11 @@ public actual inline fun CharArray.copyOf(): CharArray { } /** - * Returns new array which is a copy of the original array, resized to the given [newSize], - * truncating original values or padding new array with primitive default values if necessary. + * Returns new array which is a copy of the original array, resized to the given [newSize]. + * The copy is either truncated or padded at the end with zero values if necessary. * - * For all indices that are valid in both the original array and the copy, the two arrays contents will be identical. - * For all indices that are valid in the copy, but not in the original, the copy will contain primitive default values. + * - If [newSize] is less than the size of the original array, the copy array is truncated to the [newSize]. + * - If [newSize] is greater than the size of the original array, the extra elements in the copy array are filled with zero values. * * @sample samples.collections.Arrays.CopyOfOperations.resizedPrimitiveCopyOf */ @@ -702,11 +702,11 @@ public actual inline fun ByteArray.copyOf(newSize: Int): ByteArray { } /** - * Returns new array which is a copy of the original array, resized to the given [newSize], - * truncating original values or padding new array with primitive default values if necessary. + * Returns new array which is a copy of the original array, resized to the given [newSize]. + * The copy is either truncated or padded at the end with zero values if necessary. * - * For all indices that are valid in both the original array and the copy, the two arrays contents will be identical. - * For all indices that are valid in the copy, but not in the original, the copy will contain primitive default values. + * - If [newSize] is less than the size of the original array, the copy array is truncated to the [newSize]. + * - If [newSize] is greater than the size of the original array, the extra elements in the copy array are filled with zero values. * * @sample samples.collections.Arrays.CopyOfOperations.resizedPrimitiveCopyOf */ @@ -716,11 +716,11 @@ public actual inline fun ShortArray.copyOf(newSize: Int): ShortArray { } /** - * Returns new array which is a copy of the original array, resized to the given [newSize], - * truncating original values or padding new array with primitive default values if necessary. + * Returns new array which is a copy of the original array, resized to the given [newSize]. + * The copy is either truncated or padded at the end with zero values if necessary. * - * For all indices that are valid in both the original array and the copy, the two arrays contents will be identical. - * For all indices that are valid in the copy, but not in the original, the copy will contain primitive default values. + * - If [newSize] is less than the size of the original array, the copy array is truncated to the [newSize]. + * - If [newSize] is greater than the size of the original array, the extra elements in the copy array are filled with zero values. * * @sample samples.collections.Arrays.CopyOfOperations.resizedPrimitiveCopyOf */ @@ -730,11 +730,11 @@ public actual inline fun IntArray.copyOf(newSize: Int): IntArray { } /** - * Returns new array which is a copy of the original array, resized to the given [newSize], - * truncating original values or padding new array with primitive default values if necessary. + * Returns new array which is a copy of the original array, resized to the given [newSize]. + * The copy is either truncated or padded at the end with zero values if necessary. * - * For all indices that are valid in both the original array and the copy, the two arrays contents will be identical. - * For all indices that are valid in the copy, but not in the original, the copy will contain primitive default values. + * - If [newSize] is less than the size of the original array, the copy array is truncated to the [newSize]. + * - If [newSize] is greater than the size of the original array, the extra elements in the copy array are filled with zero values. * * @sample samples.collections.Arrays.CopyOfOperations.resizedPrimitiveCopyOf */ @@ -744,11 +744,11 @@ public actual inline fun LongArray.copyOf(newSize: Int): LongArray { } /** - * Returns new array which is a copy of the original array, resized to the given [newSize], - * truncating original values or padding new array with primitive default values if necessary. + * Returns new array which is a copy of the original array, resized to the given [newSize]. + * The copy is either truncated or padded at the end with zero values if necessary. * - * For all indices that are valid in both the original array and the copy, the two arrays contents will be identical. - * For all indices that are valid in the copy, but not in the original, the copy will contain primitive default values. + * - If [newSize] is less than the size of the original array, the copy array is truncated to the [newSize]. + * - If [newSize] is greater than the size of the original array, the extra elements in the copy array are filled with zero values. * * @sample samples.collections.Arrays.CopyOfOperations.resizedPrimitiveCopyOf */ @@ -758,11 +758,11 @@ public actual inline fun FloatArray.copyOf(newSize: Int): FloatArray { } /** - * Returns new array which is a copy of the original array, resized to the given [newSize], - * truncating original values or padding new array with primitive default values if necessary. + * Returns new array which is a copy of the original array, resized to the given [newSize]. + * The copy is either truncated or padded at the end with zero values if necessary. * - * For all indices that are valid in both the original array and the copy, the two arrays contents will be identical. - * For all indices that are valid in the copy, but not in the original, the copy will contain primitive default values. + * - If [newSize] is less than the size of the original array, the copy array is truncated to the [newSize]. + * - If [newSize] is greater than the size of the original array, the extra elements in the copy array are filled with zero values. * * @sample samples.collections.Arrays.CopyOfOperations.resizedPrimitiveCopyOf */ @@ -772,11 +772,11 @@ public actual inline fun DoubleArray.copyOf(newSize: Int): DoubleArray { } /** - * Returns new array which is a copy of the original array, resized to the given [newSize], - * truncating original values or padding new array with primitive default values if necessary. + * Returns new array which is a copy of the original array, resized to the given [newSize]. + * The copy is either truncated or padded at the end with `false` values if necessary. * - * For all indices that are valid in both the original array and the copy, the two arrays contents will be identical. - * For all indices that are valid in the copy, but not in the original, the copy will contain primitive default values. + * - If [newSize] is less than the size of the original array, the copy array is truncated to the [newSize]. + * - If [newSize] is greater than the size of the original array, the extra elements in the copy array are filled with `false` values. * * @sample samples.collections.Arrays.CopyOfOperations.resizedPrimitiveCopyOf */ @@ -786,11 +786,11 @@ public actual inline fun BooleanArray.copyOf(newSize: Int): BooleanArray { } /** - * Returns new array which is a copy of the original array, resized to the given [newSize], - * truncating original values or padding new array with primitive default values if necessary. + * Returns new array which is a copy of the original array, resized to the given [newSize]. + * The copy is either truncated or padded at the end with null char (`\u0000`) values if necessary. * - * For all indices that are valid in both the original array and the copy, the two arrays contents will be identical. - * For all indices that are valid in the copy, but not in the original, the copy will contain primitive default values. + * - If [newSize] is less than the size of the original array, the copy array is truncated to the [newSize]. + * - If [newSize] is greater than the size of the original array, the extra elements in the copy array are filled with null char (`\u0000`) values. * * @sample samples.collections.Arrays.CopyOfOperations.resizedPrimitiveCopyOf */ @@ -800,11 +800,11 @@ public actual inline fun CharArray.copyOf(newSize: Int): CharArray { } /** - * Returns new array which is a copy of the original array, resized to the given [newSize], - * truncating original values or padding new array with null values if necessary. + * Returns new array which is a copy of the original array, resized to the given [newSize]. + * The copy is either truncated or padded at the end with `null` values if necessary. * - * For all indices that are valid in both the original array and the copy, the two arrays contents will be identical. - * For all indices that are valid in the copy, but not in the original, the copy will contain null values. + * - If [newSize] is less than the size of the original array, the copy array is truncated to the [newSize]. + * - If [newSize] is greater than the size of the original array, the extra elements in the copy array are filled with `null` values. * * @sample samples.collections.Arrays.CopyOfOperations.resizingCopyOf */ diff --git a/libraries/tools/kotlin-stdlib-gen/src/templates/Arrays.kt b/libraries/tools/kotlin-stdlib-gen/src/templates/Arrays.kt index 536bafb62fa..bed61de4d98 100644 --- a/libraries/tools/kotlin-stdlib-gen/src/templates/Arrays.kt +++ b/libraries/tools/kotlin-stdlib-gen/src/templates/Arrays.kt @@ -446,11 +446,11 @@ object ArrayOps : TemplateGroupBase() { } builder { doc { """ - Returns new array which is a copy of the original array, resized to the given [newSize], - truncating original values or padding new array with ${if(family == ArraysOfPrimitives) "primitive default" else "null"} values if necessary. + Returns new array which is a copy of the original array, resized to the given [newSize]. + The copy is either truncated or padded at the end with ${primitive.zero} values if necessary. - For all indices that are valid in both the original array and the copy, the two arrays contents will be identical. - For all indices that are valid in the copy, but not in the original, the copy will contain ${if(family == ArraysOfPrimitives) "primitive default" else "null"} values. + - If [newSize] is less than the size of the original array, the copy array is truncated to the [newSize]. + - If [newSize] is greater than the size of the original array, the extra elements in the copy array are filled with ${primitive.zero} values. """ } specialFor(ArraysOfPrimitives) { diff --git a/libraries/tools/kotlin-stdlib-gen/src/templates/dsl/FamilyProperties.kt b/libraries/tools/kotlin-stdlib-gen/src/templates/dsl/FamilyProperties.kt index d5a73bdb4a9..d19b8abecfd 100644 --- a/libraries/tools/kotlin-stdlib-gen/src/templates/dsl/FamilyProperties.kt +++ b/libraries/tools/kotlin-stdlib-gen/src/templates/dsl/FamilyProperties.kt @@ -43,6 +43,14 @@ object DocExtensions { else -> "list" } + val PrimitiveType?.zero: String + get() = when (this) { + null -> "`null`" + PrimitiveType.Boolean -> "`false`" + PrimitiveType.Char -> "null char (`\\u0000`)" + else -> "zero" + } + fun textWhen(condition: Boolean, text: () -> String): String = if (condition) text() else "" private fun String.singularize() = removeSuffix("s")