From a426c7879f19f2705a0e47d463910552d08f2f15 Mon Sep 17 00:00:00 2001 From: Ilya Gorbunov Date: Sat, 14 Nov 2015 18:34:06 +0300 Subject: [PATCH] Apply infix modifier on functions from stdlib where appropriate. --- libraries/stdlib/src/generated/_Arrays.kt | 106 +++++++++--------- .../stdlib/src/generated/_Collections.kt | 10 +- libraries/stdlib/src/generated/_Sequences.kt | 2 +- libraries/stdlib/src/generated/_Strings.kt | 4 +- libraries/stdlib/src/kotlin/util/Ordering.kt | 4 +- libraries/tools/idl2k/src/main/kotlin/idl.kt | 2 +- .../tools/idl2k/src/main/kotlin/render.kt | 8 +- .../src/templates/Generators.kt | 5 + .../kotlin-stdlib-gen/src/templates/Sets.kt | 3 + 9 files changed, 75 insertions(+), 69 deletions(-) diff --git a/libraries/stdlib/src/generated/_Arrays.kt b/libraries/stdlib/src/generated/_Arrays.kt index 218b64512a4..8d13a517be9 100644 --- a/libraries/stdlib/src/generated/_Arrays.kt +++ b/libraries/stdlib/src/generated/_Arrays.kt @@ -7307,7 +7307,7 @@ public inline fun ShortArray.distinctBy(keySelector: (Short) -> K): List Array.intersect(other: Iterable): Set { +public infix fun Array.intersect(other: Iterable): Set { val set = this.toMutableSet() set.retainAll(other) return set @@ -7316,7 +7316,7 @@ public fun Array.intersect(other: Iterable): Set { /** * Returns a set containing all elements that are contained by both this set and the specified collection. */ -public fun BooleanArray.intersect(other: Iterable): Set { +public infix fun BooleanArray.intersect(other: Iterable): Set { val set = this.toMutableSet() set.retainAll(other) return set @@ -7325,7 +7325,7 @@ public fun BooleanArray.intersect(other: Iterable): Set { /** * Returns a set containing all elements that are contained by both this set and the specified collection. */ -public fun ByteArray.intersect(other: Iterable): Set { +public infix fun ByteArray.intersect(other: Iterable): Set { val set = this.toMutableSet() set.retainAll(other) return set @@ -7334,7 +7334,7 @@ public fun ByteArray.intersect(other: Iterable): Set { /** * Returns a set containing all elements that are contained by both this set and the specified collection. */ -public fun CharArray.intersect(other: Iterable): Set { +public infix fun CharArray.intersect(other: Iterable): Set { val set = this.toMutableSet() set.retainAll(other) return set @@ -7343,7 +7343,7 @@ public fun CharArray.intersect(other: Iterable): Set { /** * Returns a set containing all elements that are contained by both this set and the specified collection. */ -public fun DoubleArray.intersect(other: Iterable): Set { +public infix fun DoubleArray.intersect(other: Iterable): Set { val set = this.toMutableSet() set.retainAll(other) return set @@ -7352,7 +7352,7 @@ public fun DoubleArray.intersect(other: Iterable): Set { /** * Returns a set containing all elements that are contained by both this set and the specified collection. */ -public fun FloatArray.intersect(other: Iterable): Set { +public infix fun FloatArray.intersect(other: Iterable): Set { val set = this.toMutableSet() set.retainAll(other) return set @@ -7361,7 +7361,7 @@ public fun FloatArray.intersect(other: Iterable): Set { /** * Returns a set containing all elements that are contained by both this set and the specified collection. */ -public fun IntArray.intersect(other: Iterable): Set { +public infix fun IntArray.intersect(other: Iterable): Set { val set = this.toMutableSet() set.retainAll(other) return set @@ -7370,7 +7370,7 @@ public fun IntArray.intersect(other: Iterable): Set { /** * Returns a set containing all elements that are contained by both this set and the specified collection. */ -public fun LongArray.intersect(other: Iterable): Set { +public infix fun LongArray.intersect(other: Iterable): Set { val set = this.toMutableSet() set.retainAll(other) return set @@ -7379,7 +7379,7 @@ public fun LongArray.intersect(other: Iterable): Set { /** * Returns a set containing all elements that are contained by both this set and the specified collection. */ -public fun ShortArray.intersect(other: Iterable): Set { +public infix fun ShortArray.intersect(other: Iterable): Set { val set = this.toMutableSet() set.retainAll(other) return set @@ -7388,7 +7388,7 @@ public fun ShortArray.intersect(other: Iterable): Set { /** * Returns a set containing all elements that are contained by this set and not contained by the specified collection. */ -public fun Array.subtract(other: Iterable): Set { +public infix fun Array.subtract(other: Iterable): Set { val set = this.toMutableSet() set.removeAll(other) return set @@ -7397,7 +7397,7 @@ public fun Array.subtract(other: Iterable): Set { /** * Returns a set containing all elements that are contained by this set and not contained by the specified collection. */ -public fun BooleanArray.subtract(other: Iterable): Set { +public infix fun BooleanArray.subtract(other: Iterable): Set { val set = this.toMutableSet() set.removeAll(other) return set @@ -7406,7 +7406,7 @@ public fun BooleanArray.subtract(other: Iterable): Set { /** * Returns a set containing all elements that are contained by this set and not contained by the specified collection. */ -public fun ByteArray.subtract(other: Iterable): Set { +public infix fun ByteArray.subtract(other: Iterable): Set { val set = this.toMutableSet() set.removeAll(other) return set @@ -7415,7 +7415,7 @@ public fun ByteArray.subtract(other: Iterable): Set { /** * Returns a set containing all elements that are contained by this set and not contained by the specified collection. */ -public fun CharArray.subtract(other: Iterable): Set { +public infix fun CharArray.subtract(other: Iterable): Set { val set = this.toMutableSet() set.removeAll(other) return set @@ -7424,7 +7424,7 @@ public fun CharArray.subtract(other: Iterable): Set { /** * Returns a set containing all elements that are contained by this set and not contained by the specified collection. */ -public fun DoubleArray.subtract(other: Iterable): Set { +public infix fun DoubleArray.subtract(other: Iterable): Set { val set = this.toMutableSet() set.removeAll(other) return set @@ -7433,7 +7433,7 @@ public fun DoubleArray.subtract(other: Iterable): Set { /** * Returns a set containing all elements that are contained by this set and not contained by the specified collection. */ -public fun FloatArray.subtract(other: Iterable): Set { +public infix fun FloatArray.subtract(other: Iterable): Set { val set = this.toMutableSet() set.removeAll(other) return set @@ -7442,7 +7442,7 @@ public fun FloatArray.subtract(other: Iterable): Set { /** * Returns a set containing all elements that are contained by this set and not contained by the specified collection. */ -public fun IntArray.subtract(other: Iterable): Set { +public infix fun IntArray.subtract(other: Iterable): Set { val set = this.toMutableSet() set.removeAll(other) return set @@ -7451,7 +7451,7 @@ public fun IntArray.subtract(other: Iterable): Set { /** * Returns a set containing all elements that are contained by this set and not contained by the specified collection. */ -public fun LongArray.subtract(other: Iterable): Set { +public infix fun LongArray.subtract(other: Iterable): Set { val set = this.toMutableSet() set.removeAll(other) return set @@ -7460,7 +7460,7 @@ public fun LongArray.subtract(other: Iterable): Set { /** * Returns a set containing all elements that are contained by this set and not contained by the specified collection. */ -public fun ShortArray.subtract(other: Iterable): Set { +public infix fun ShortArray.subtract(other: Iterable): Set { val set = this.toMutableSet() set.removeAll(other) return set @@ -7550,7 +7550,7 @@ public fun ShortArray.toMutableSet(): MutableSet { /** * Returns a set containing all distinct elements from both collections. */ -public fun Array.union(other: Iterable): Set { +public infix fun Array.union(other: Iterable): Set { val set = this.toMutableSet() set.addAll(other) return set @@ -7559,7 +7559,7 @@ public fun Array.union(other: Iterable): Set { /** * Returns a set containing all distinct elements from both collections. */ -public fun BooleanArray.union(other: Iterable): Set { +public infix fun BooleanArray.union(other: Iterable): Set { val set = this.toMutableSet() set.addAll(other) return set @@ -7568,7 +7568,7 @@ public fun BooleanArray.union(other: Iterable): Set { /** * Returns a set containing all distinct elements from both collections. */ -public fun ByteArray.union(other: Iterable): Set { +public infix fun ByteArray.union(other: Iterable): Set { val set = this.toMutableSet() set.addAll(other) return set @@ -7577,7 +7577,7 @@ public fun ByteArray.union(other: Iterable): Set { /** * Returns a set containing all distinct elements from both collections. */ -public fun CharArray.union(other: Iterable): Set { +public infix fun CharArray.union(other: Iterable): Set { val set = this.toMutableSet() set.addAll(other) return set @@ -7586,7 +7586,7 @@ public fun CharArray.union(other: Iterable): Set { /** * Returns a set containing all distinct elements from both collections. */ -public fun DoubleArray.union(other: Iterable): Set { +public infix fun DoubleArray.union(other: Iterable): Set { val set = this.toMutableSet() set.addAll(other) return set @@ -7595,7 +7595,7 @@ public fun DoubleArray.union(other: Iterable): Set { /** * Returns a set containing all distinct elements from both collections. */ -public fun FloatArray.union(other: Iterable): Set { +public infix fun FloatArray.union(other: Iterable): Set { val set = this.toMutableSet() set.addAll(other) return set @@ -7604,7 +7604,7 @@ public fun FloatArray.union(other: Iterable): Set { /** * Returns a set containing all distinct elements from both collections. */ -public fun IntArray.union(other: Iterable): Set { +public infix fun IntArray.union(other: Iterable): Set { val set = this.toMutableSet() set.addAll(other) return set @@ -7613,7 +7613,7 @@ public fun IntArray.union(other: Iterable): Set { /** * Returns a set containing all distinct elements from both collections. */ -public fun LongArray.union(other: Iterable): Set { +public infix fun LongArray.union(other: Iterable): Set { val set = this.toMutableSet() set.addAll(other) return set @@ -7622,7 +7622,7 @@ public fun LongArray.union(other: Iterable): Set { /** * Returns a set containing all distinct elements from both collections. */ -public fun ShortArray.union(other: Iterable): Set { +public infix fun ShortArray.union(other: Iterable): Set { val set = this.toMutableSet() set.addAll(other) return set @@ -9597,63 +9597,63 @@ public inline fun ShortArray.partition(predicate: (Short) -> Boolean): Pair Array.zip(array: Array): List> { +public infix fun Array.zip(array: Array): List> { return zip(array) { t1, t2 -> t1 to t2 } } /** * Returns a list of pairs built from elements of both collections with same indexes. List has length of shortest collection. */ -public fun BooleanArray.zip(array: Array): List> { +public infix fun BooleanArray.zip(array: Array): List> { return zip(array) { t1, t2 -> t1 to t2 } } /** * Returns a list of pairs built from elements of both collections with same indexes. List has length of shortest collection. */ -public fun ByteArray.zip(array: Array): List> { +public infix fun ByteArray.zip(array: Array): List> { return zip(array) { t1, t2 -> t1 to t2 } } /** * Returns a list of pairs built from elements of both collections with same indexes. List has length of shortest collection. */ -public fun CharArray.zip(array: Array): List> { +public infix fun CharArray.zip(array: Array): List> { return zip(array) { t1, t2 -> t1 to t2 } } /** * Returns a list of pairs built from elements of both collections with same indexes. List has length of shortest collection. */ -public fun DoubleArray.zip(array: Array): List> { +public infix fun DoubleArray.zip(array: Array): List> { return zip(array) { t1, t2 -> t1 to t2 } } /** * Returns a list of pairs built from elements of both collections with same indexes. List has length of shortest collection. */ -public fun FloatArray.zip(array: Array): List> { +public infix fun FloatArray.zip(array: Array): List> { return zip(array) { t1, t2 -> t1 to t2 } } /** * Returns a list of pairs built from elements of both collections with same indexes. List has length of shortest collection. */ -public fun IntArray.zip(array: Array): List> { +public infix fun IntArray.zip(array: Array): List> { return zip(array) { t1, t2 -> t1 to t2 } } /** * Returns a list of pairs built from elements of both collections with same indexes. List has length of shortest collection. */ -public fun LongArray.zip(array: Array): List> { +public infix fun LongArray.zip(array: Array): List> { return zip(array) { t1, t2 -> t1 to t2 } } /** * Returns a list of pairs built from elements of both collections with same indexes. List has length of shortest collection. */ -public fun ShortArray.zip(array: Array): List> { +public infix fun ShortArray.zip(array: Array): List> { return zip(array) { t1, t2 -> t1 to t2 } } @@ -9768,56 +9768,56 @@ public inline fun ShortArray.zip(array: Array, transform: (Short, /** * Returns a list of pairs built from elements of both collections with same indexes. List has length of shortest collection. */ -public fun BooleanArray.zip(array: BooleanArray): List> { +public infix fun BooleanArray.zip(array: BooleanArray): List> { return zip(array) { t1, t2 -> t1 to t2 } } /** * Returns a list of pairs built from elements of both collections with same indexes. List has length of shortest collection. */ -public fun ByteArray.zip(array: ByteArray): List> { +public infix fun ByteArray.zip(array: ByteArray): List> { return zip(array) { t1, t2 -> t1 to t2 } } /** * Returns a list of pairs built from elements of both collections with same indexes. List has length of shortest collection. */ -public fun CharArray.zip(array: CharArray): List> { +public infix fun CharArray.zip(array: CharArray): List> { return zip(array) { t1, t2 -> t1 to t2 } } /** * Returns a list of pairs built from elements of both collections with same indexes. List has length of shortest collection. */ -public fun DoubleArray.zip(array: DoubleArray): List> { +public infix fun DoubleArray.zip(array: DoubleArray): List> { return zip(array) { t1, t2 -> t1 to t2 } } /** * Returns a list of pairs built from elements of both collections with same indexes. List has length of shortest collection. */ -public fun FloatArray.zip(array: FloatArray): List> { +public infix fun FloatArray.zip(array: FloatArray): List> { return zip(array) { t1, t2 -> t1 to t2 } } /** * Returns a list of pairs built from elements of both collections with same indexes. List has length of shortest collection. */ -public fun IntArray.zip(array: IntArray): List> { +public infix fun IntArray.zip(array: IntArray): List> { return zip(array) { t1, t2 -> t1 to t2 } } /** * Returns a list of pairs built from elements of both collections with same indexes. List has length of shortest collection. */ -public fun LongArray.zip(array: LongArray): List> { +public infix fun LongArray.zip(array: LongArray): List> { return zip(array) { t1, t2 -> t1 to t2 } } /** * Returns a list of pairs built from elements of both collections with same indexes. List has length of shortest collection. */ -public fun ShortArray.zip(array: ShortArray): List> { +public infix fun ShortArray.zip(array: ShortArray): List> { return zip(array) { t1, t2 -> t1 to t2 } } @@ -9920,63 +9920,63 @@ public inline fun ShortArray.zip(array: ShortArray, transform: (Short, Short /** * Returns a list of pairs built from elements of both collections with same indexes. List has length of shortest collection. */ -public fun Array.zip(other: Iterable): List> { +public infix fun Array.zip(other: Iterable): List> { return zip(other) { t1, t2 -> t1 to t2 } } /** * Returns a list of pairs built from elements of both collections with same indexes. List has length of shortest collection. */ -public fun BooleanArray.zip(other: Iterable): List> { +public infix fun BooleanArray.zip(other: Iterable): List> { return zip(other) { t1, t2 -> t1 to t2 } } /** * Returns a list of pairs built from elements of both collections with same indexes. List has length of shortest collection. */ -public fun ByteArray.zip(other: Iterable): List> { +public infix fun ByteArray.zip(other: Iterable): List> { return zip(other) { t1, t2 -> t1 to t2 } } /** * Returns a list of pairs built from elements of both collections with same indexes. List has length of shortest collection. */ -public fun CharArray.zip(other: Iterable): List> { +public infix fun CharArray.zip(other: Iterable): List> { return zip(other) { t1, t2 -> t1 to t2 } } /** * Returns a list of pairs built from elements of both collections with same indexes. List has length of shortest collection. */ -public fun DoubleArray.zip(other: Iterable): List> { +public infix fun DoubleArray.zip(other: Iterable): List> { return zip(other) { t1, t2 -> t1 to t2 } } /** * Returns a list of pairs built from elements of both collections with same indexes. List has length of shortest collection. */ -public fun FloatArray.zip(other: Iterable): List> { +public infix fun FloatArray.zip(other: Iterable): List> { return zip(other) { t1, t2 -> t1 to t2 } } /** * Returns a list of pairs built from elements of both collections with same indexes. List has length of shortest collection. */ -public fun IntArray.zip(other: Iterable): List> { +public infix fun IntArray.zip(other: Iterable): List> { return zip(other) { t1, t2 -> t1 to t2 } } /** * Returns a list of pairs built from elements of both collections with same indexes. List has length of shortest collection. */ -public fun LongArray.zip(other: Iterable): List> { +public infix fun LongArray.zip(other: Iterable): List> { return zip(other) { t1, t2 -> t1 to t2 } } /** * Returns a list of pairs built from elements of both collections with same indexes. List has length of shortest collection. */ -public fun ShortArray.zip(other: Iterable): List> { +public infix fun ShortArray.zip(other: Iterable): List> { return zip(other) { t1, t2 -> t1 to t2 } } diff --git a/libraries/stdlib/src/generated/_Collections.kt b/libraries/stdlib/src/generated/_Collections.kt index 5affd445a41..6b6a6d19d6c 100644 --- a/libraries/stdlib/src/generated/_Collections.kt +++ b/libraries/stdlib/src/generated/_Collections.kt @@ -1210,7 +1210,7 @@ public inline fun Iterable.distinctBy(keySelector: (T) -> K): List /** * Returns a set containing all elements that are contained by both this set and the specified collection. */ -public fun Iterable.intersect(other: Iterable): Set { +public infix fun Iterable.intersect(other: Iterable): Set { val set = this.toMutableSet() set.retainAll(other) return set @@ -1219,7 +1219,7 @@ public fun Iterable.intersect(other: Iterable): Set { /** * Returns a set containing all elements that are contained by this set and not contained by the specified collection. */ -public fun Iterable.subtract(other: Iterable): Set { +public infix fun Iterable.subtract(other: Iterable): Set { val set = this.toMutableSet() set.removeAll(other) return set @@ -1238,7 +1238,7 @@ public fun Iterable.toMutableSet(): MutableSet { /** * Returns a set containing all distinct elements from both collections. */ -public fun Iterable.union(other: Iterable): Set { +public infix fun Iterable.union(other: Iterable): Set { val set = this.toMutableSet() set.addAll(other) return set @@ -1631,7 +1631,7 @@ public operator fun Iterable.plus(sequence: Sequence): List { /** * Returns a list of pairs built from elements of both collections with same indexes. List has length of shortest collection. */ -public fun Iterable.zip(array: Array): List> { +public infix fun Iterable.zip(array: Array): List> { return zip(array) { t1, t2 -> t1 to t2 } } @@ -1652,7 +1652,7 @@ public inline fun Iterable.zip(array: Array, transform: (T, /** * Returns a list of pairs built from elements of both collections with same indexes. List has length of shortest collection. */ -public fun Iterable.zip(other: Iterable): List> { +public infix fun Iterable.zip(other: Iterable): List> { return zip(other) { t1, t2 -> t1 to t2 } } diff --git a/libraries/stdlib/src/generated/_Sequences.kt b/libraries/stdlib/src/generated/_Sequences.kt index 074a408acbd..0e1b8530d21 100644 --- a/libraries/stdlib/src/generated/_Sequences.kt +++ b/libraries/stdlib/src/generated/_Sequences.kt @@ -1010,7 +1010,7 @@ public operator fun Sequence.plus(sequence: Sequence): Sequence { * Returns a sequence of pairs built from elements of both collections with same indexes. * Resulting sequence has length of shortest input sequence. */ -public fun Sequence.zip(sequence: Sequence): Sequence> { +public infix fun Sequence.zip(sequence: Sequence): Sequence> { return MergingSequence(this, sequence) { t1, t2 -> t1 to t2 } } diff --git a/libraries/stdlib/src/generated/_Strings.kt b/libraries/stdlib/src/generated/_Strings.kt index 97f59a8e0cc..46a6b395e0c 100644 --- a/libraries/stdlib/src/generated/_Strings.kt +++ b/libraries/stdlib/src/generated/_Strings.kt @@ -1568,7 +1568,7 @@ public inline fun String.partition(predicate: (Char) -> Boolean): Pair> { +public infix fun CharSequence.zip(other: String): List> { return zip(other) { c1, c2 -> c1 to c2 } } @@ -1576,7 +1576,7 @@ public fun CharSequence.zip(other: String): List> { * Returns a list of pairs built from characters of both char sequences with same indexes. List has length of shortest char sequence. */ @Deprecated("Provided for binary compatibility", level = DeprecationLevel.HIDDEN) -public fun String.zip(other: String): List> { +public infix fun String.zip(other: String): List> { return zip(other) { c1, c2 -> c1 to c2 } } diff --git a/libraries/stdlib/src/kotlin/util/Ordering.kt b/libraries/stdlib/src/kotlin/util/Ordering.kt index 272cd7344fa..ba0688d5f3b 100644 --- a/libraries/stdlib/src/kotlin/util/Ordering.kt +++ b/libraries/stdlib/src/kotlin/util/Ordering.kt @@ -207,7 +207,7 @@ inline public fun Comparator.thenComparator(crossinline comparison: (T, T * Combines this comparator and the given [comparator] such that the latter is applied only * when the former considered values equal. */ -public fun Comparator.then(comparator: Comparator): Comparator { +public infix fun Comparator.then(comparator: Comparator): Comparator { return object : Comparator { public override fun compare(a: T, b: T): Int { val previousCompare = this@then.compare(a, b) @@ -220,7 +220,7 @@ public fun Comparator.then(comparator: Comparator): Comparator { * Combines this comparator and the given [comparator] such that the latter is applied only * when the former considered values equal. */ -public fun Comparator.thenDescending(comparator: Comparator): Comparator { +public infix fun Comparator.thenDescending(comparator: Comparator): Comparator { return object : Comparator { public override fun compare(a: T, b: T): Int { val previousCompare = this@thenDescending.compare(a, b) diff --git a/libraries/tools/idl2k/src/main/kotlin/idl.kt b/libraries/tools/idl2k/src/main/kotlin/idl.kt index 88400aa4295..5a85d8e4196 100644 --- a/libraries/tools/idl2k/src/main/kotlin/idl.kt +++ b/libraries/tools/idl2k/src/main/kotlin/idl.kt @@ -528,4 +528,4 @@ fun merge(i1: InterfaceDefinition, i2: InterfaceDefinition): InterfaceDefinition ) } -fun List.merge(other: List) = (this + other).distinct().toList() +infix fun List.merge(other: List) = (this + other).distinct() diff --git a/libraries/tools/idl2k/src/main/kotlin/render.kt b/libraries/tools/idl2k/src/main/kotlin/render.kt index 6d4e233a3ff..dd11c7c3aa0 100644 --- a/libraries/tools/idl2k/src/main/kotlin/render.kt +++ b/libraries/tools/idl2k/src/main/kotlin/render.kt @@ -59,11 +59,9 @@ private fun String.replaceWrongConstants(type: Type) = when { private fun String.replaceKeywords() = if (this in keywords) this + "_" else this private fun Appendable.renderArgumentsDeclaration(args: List, omitDefaults: Boolean = false) = - args.map { - StringBuilder { - renderAttributeDeclaration(it, it.override, false, omitDefaults) - } - }.joinTo(this, ", ", "(", ")") + args.joinTo(this, ", ", "(", ")") { + StringBuilder().apply { renderAttributeDeclaration(it, it.override, false, omitDefaults) } + } private fun renderCall(call: GenerateFunctionCall) = "${call.name.replaceKeywords()}(${call.arguments.joinToString(", ") { it.replaceKeywords() }})" diff --git a/libraries/tools/kotlin-stdlib-gen/src/templates/Generators.kt b/libraries/tools/kotlin-stdlib-gen/src/templates/Generators.kt index bb44404e06f..ef2ced38363 100644 --- a/libraries/tools/kotlin-stdlib-gen/src/templates/Generators.kt +++ b/libraries/tools/kotlin-stdlib-gen/src/templates/Generators.kt @@ -582,6 +582,7 @@ fun generators(): List { templates add f("zip(other: Iterable)") { + infix(true) exclude(Sequences) doc { """ @@ -598,6 +599,7 @@ fun generators(): List { } templates add f("zip(other: String)") { + infix(true) deprecate(Strings) { forBinaryCompatibility } only(CharSequences, Strings) doc { @@ -614,6 +616,7 @@ fun generators(): List { } templates add f("zip(array: Array)") { + infix(true) exclude(Sequences) doc { """ @@ -630,6 +633,7 @@ fun generators(): List { } templates add f("zip(array: SELF)") { + infix(true) only(ArraysOfPrimitives) doc { """ @@ -645,6 +649,7 @@ fun generators(): List { } templates add f("zip(sequence: Sequence)") { + infix(true) only(Sequences) doc { """ diff --git a/libraries/tools/kotlin-stdlib-gen/src/templates/Sets.kt b/libraries/tools/kotlin-stdlib-gen/src/templates/Sets.kt index 4cc8ce763d4..5105e9a06de 100644 --- a/libraries/tools/kotlin-stdlib-gen/src/templates/Sets.kt +++ b/libraries/tools/kotlin-stdlib-gen/src/templates/Sets.kt @@ -90,6 +90,7 @@ fun sets(): List { } templates add f("union(other: Iterable)") { + infix(true) exclude(Strings, Sequences) doc { "Returns a set containing all distinct elements from both collections." } returns("Set") @@ -103,6 +104,7 @@ fun sets(): List { } templates add f("intersect(other: Iterable)") { + infix(true) exclude(Strings, Sequences) doc { "Returns a set containing all elements that are contained by both this set and the specified collection." } returns("Set") @@ -116,6 +118,7 @@ fun sets(): List { } templates add f("subtract(other: Iterable)") { + infix(true) exclude(Strings, Sequences) doc { "Returns a set containing all elements that are contained by this set and not contained by the specified collection." } returns("Set")