Specify names for parameters of functional types with two or more parameters to ease lambda completion.

#KT-13826
This commit is contained in:
Ilya Gorbunov
2017-01-18 19:46:50 +03:00
parent 96d0f91afc
commit 661ff81e67
21 changed files with 611 additions and 611 deletions
@@ -351,7 +351,7 @@ fun aggregates(): List<GenericFunction> {
body(Maps) { "return entries.maxWith(comparator)" }
}
templates add f("foldIndexed(initial: R, operation: (Int, R, T) -> R)") {
templates add f("foldIndexed(initial: R, operation: (index: Int, acc: R, T) -> R)") {
inline(true)
include(CharSequences)
@@ -375,7 +375,7 @@ fun aggregates(): List<GenericFunction> {
}
}
templates add f("foldRightIndexed(initial: R, operation: (Int, T, R) -> R)") {
templates add f("foldRightIndexed(initial: R, operation: (index: Int, T, acc: R) -> R)") {
inline(true)
only(CharSequences, Lists, ArraysOfObjects, ArraysOfPrimitives)
@@ -415,7 +415,7 @@ fun aggregates(): List<GenericFunction> {
}
}
templates add f("fold(initial: R, operation: (R, T) -> R)") {
templates add f("fold(initial: R, operation: (acc: R, T) -> R)") {
inline(true)
include(CharSequences)
@@ -431,7 +431,7 @@ fun aggregates(): List<GenericFunction> {
}
}
templates add f("foldRight(initial: R, operation: (T, R) -> R)") {
templates add f("foldRight(initial: R, operation: (T, acc: R) -> R)") {
inline(true)
only(CharSequences, Lists, ArraysOfObjects, ArraysOfPrimitives)
@@ -462,7 +462,7 @@ fun aggregates(): List<GenericFunction> {
}
}
templates add f("reduceIndexed(operation: (Int, T, T) -> T)") {
templates add f("reduceIndexed(operation: (index: Int, acc: T, T) -> T)") {
inline(true)
only(ArraysOfPrimitives, CharSequences)
@@ -489,7 +489,7 @@ fun aggregates(): List<GenericFunction> {
}
}
templates add f("reduceIndexed(operation: (Int, S, T) -> S)") {
templates add f("reduceIndexed(operation: (index: Int, acc: S, T) -> S)") {
inline(true)
only(ArraysOfObjects, Iterables, Sequences)
@@ -531,7 +531,7 @@ fun aggregates(): List<GenericFunction> {
}
}
templates add f("reduceRightIndexed(operation: (Int, T, T) -> T)") {
templates add f("reduceRightIndexed(operation: (index: Int, T, acc: T) -> T)") {
inline(true)
only(CharSequences, ArraysOfPrimitives)
@@ -560,7 +560,7 @@ fun aggregates(): List<GenericFunction> {
}
}
templates add f("reduceRightIndexed(operation: (Int, T, S) -> S)") {
templates add f("reduceRightIndexed(operation: (index: Int, T, acc: S) -> S)") {
inline(true)
only(Lists, ArraysOfObjects)
@@ -606,7 +606,7 @@ fun aggregates(): List<GenericFunction> {
}
}
templates add f("reduce(operation: (T, T) -> T)") {
templates add f("reduce(operation: (acc: T, T) -> T)") {
inline(true)
only(ArraysOfPrimitives, CharSequences)
@@ -626,7 +626,7 @@ fun aggregates(): List<GenericFunction> {
}
}
templates add f("reduce(operation: (S, T) -> S)") {
templates add f("reduce(operation: (acc: S, T) -> S)") {
inline(true)
only(ArraysOfObjects, Iterables, Sequences)
@@ -660,7 +660,7 @@ fun aggregates(): List<GenericFunction> {
}
}
templates add f("reduceRight(operation: (T, T) -> T)") {
templates add f("reduceRight(operation: (T, acc: T) -> T)") {
inline(true)
only(CharSequences, ArraysOfPrimitives)
@@ -681,7 +681,7 @@ fun aggregates(): List<GenericFunction> {
}
}
templates add f("reduceRight(operation: (T, S) -> S)") {
templates add f("reduceRight(operation: (T, acc: S) -> S)") {
inline(true)
only(Lists, ArraysOfObjects)
@@ -773,7 +773,7 @@ fun aggregates(): List<GenericFunction> {
include(Maps, CharSequences)
}
templates add f("forEachIndexed(action: (Int, T) -> Unit)") {
templates add f("forEachIndexed(action: (index: Int, T) -> Unit)") {
inline(true)
include(CharSequences)
doc { f ->
@@ -468,7 +468,7 @@ fun filtering(): List<GenericFunction> {
}
}
templates add f("filterIndexed(predicate: (Int, T) -> Boolean)") {
templates add f("filterIndexed(predicate: (index: Int, T) -> Boolean)") {
inline(true)
doc { f ->
@@ -506,7 +506,7 @@ fun filtering(): List<GenericFunction> {
}
templates add f("filterIndexedTo(destination: C, predicate: (Int, T) -> Boolean)") {
templates add f("filterIndexedTo(destination: C, predicate: (index: Int, T) -> Boolean)") {
inline(true)
include(CharSequences)
@@ -530,7 +530,7 @@ fun generators(): List<GenericFunction> {
}
}
templates add f("zip(other: Iterable<R>, transform: (T, R) -> V)") {
templates add f("zip(other: Iterable<R>, transform: (a: T, b: R) -> V)") {
exclude(Sequences)
doc {
"""
@@ -566,7 +566,7 @@ fun generators(): List<GenericFunction> {
}
}
templates add f("zip(other: Array<out R>, transform: (T, R) -> V)") {
templates add f("zip(other: Array<out R>, transform: (a: T, b: R) -> V)") {
exclude(Sequences)
doc {
"""
@@ -602,7 +602,7 @@ fun generators(): List<GenericFunction> {
}
templates add f("zip(other: SELF, transform: (T, T) -> V)") {
templates add f("zip(other: SELF, transform: (a: T, b: T) -> V)") {
only(ArraysOfPrimitives)
doc {
"""
@@ -624,7 +624,7 @@ fun generators(): List<GenericFunction> {
}
}
templates add f("zip(other: Sequence<R>, transform: (T, R) -> V)") {
templates add f("zip(other: Sequence<R>, transform: (a: T, b: R) -> V)") {
only(Sequences)
doc {
"""
@@ -641,7 +641,7 @@ fun generators(): List<GenericFunction> {
}
}
templates add f("zip(other: CharSequence, transform: (Char, Char) -> V)") {
templates add f("zip(other: CharSequence, transform: (a: Char, b: Char) -> V)") {
only(CharSequences)
doc {
"""
@@ -23,7 +23,7 @@ fun mapping(): List<GenericFunction> {
}
}
templates add f("mapIndexed(transform: (Int, T) -> R)") {
templates add f("mapIndexed(transform: (index: Int, T) -> R)") {
inline(true)
doc { f ->
@@ -107,7 +107,7 @@ fun mapping(): List<GenericFunction> {
}
templates add f("mapIndexedNotNull(transform: (Int, T) -> R?)") {
templates add f("mapIndexedNotNull(transform: (index: Int, T) -> R?)") {
inline(true)
include(CharSequences)
exclude(ArraysOfPrimitives)
@@ -155,7 +155,7 @@ fun mapping(): List<GenericFunction> {
include(Maps, CharSequences)
}
templates add f("mapIndexedTo(destination: C, transform: (Int, T) -> R)") {
templates add f("mapIndexedTo(destination: C, transform: (index: Int, T) -> R)") {
inline(true)
doc { f ->
@@ -202,7 +202,7 @@ fun mapping(): List<GenericFunction> {
}
}
templates add f("mapIndexedNotNullTo(destination: C, transform: (Int, T) -> R?)") {
templates add f("mapIndexedNotNullTo(destination: C, transform: (index: Int, T) -> R?)") {
inline(true)
include(CharSequences)
exclude(ArraysOfPrimitives)
@@ -21,7 +21,7 @@ import templates.Family.*
fun specialJS(): List<GenericFunction> {
val templates = arrayListOf<GenericFunction>()
templates add f("sort(noinline comparison: (T, T) -> Int)") {
templates add f("sort(noinline comparison: (a: T, b: T) -> Int)") {
only(ArraysOfObjects, ArraysOfPrimitives)
exclude(PrimitiveType.Boolean)
inline(true)