Stdlib: fix name shadowing and names of overridden method parameters

This commit is contained in:
Ilya Gorbunov
2018-09-08 06:35:41 +03:00
parent bf4be12239
commit b1c2daf1fe
3 changed files with 8 additions and 8 deletions
@@ -8,8 +8,8 @@ package org.w3c.dom.events
public fun EventListener(handler: (Event) -> Unit): EventListener = EventListenerHandler(handler)
private class EventListenerHandler(private val handler: (Event) -> Unit) : EventListener {
public override fun handleEvent(e: Event) {
handler(e)
public override fun handleEvent(event: Event) {
handler(event)
}
public override fun toString(): String = "EventListenerHandler($handler)"
+4 -4
View File
@@ -1065,7 +1065,7 @@ private class DelimitedRangesSequence(
private val input: CharSequence,
private val startIndex: Int,
private val limit: Int,
private val getNextMatch: CharSequence.(Int) -> Pair<Int, Int>?
private val getNextMatch: CharSequence.(currentIndex: Int) -> Pair<Int, Int>?
) : Sequence<IntRange> {
override fun iterator(): Iterator<IntRange> = object : Iterator<IntRange> {
@@ -1132,8 +1132,8 @@ private class DelimitedRangesSequence(
private fun CharSequence.rangesDelimitedBy(delimiters: CharArray, startIndex: Int = 0, ignoreCase: Boolean = false, limit: Int = 0): Sequence<IntRange> {
require(limit >= 0, { "Limit must be non-negative, but was $limit." })
return DelimitedRangesSequence(this, startIndex, limit, { startIndex ->
indexOfAny(delimiters, startIndex, ignoreCase = ignoreCase).let { if (it < 0) null else it to 1 }
return DelimitedRangesSequence(this, startIndex, limit, { currentIndex ->
indexOfAny(delimiters, currentIndex, ignoreCase = ignoreCase).let { if (it < 0) null else it to 1 }
})
}
@@ -1156,7 +1156,7 @@ private fun CharSequence.rangesDelimitedBy(delimiters: Array<out String>, startI
require(limit >= 0, { "Limit must be non-negative, but was $limit." } )
val delimitersList = delimiters.asList()
return DelimitedRangesSequence(this, startIndex, limit, { startIndex -> findAnyOf(delimitersList, startIndex, ignoreCase = ignoreCase, last = false)?.let { it.first to it.second.length } })
return DelimitedRangesSequence(this, startIndex, limit, { currentIndex -> findAnyOf(delimitersList, currentIndex, ignoreCase = ignoreCase, last = false)?.let { it.first to it.second.length } })
}
+2 -2
View File
@@ -136,8 +136,8 @@ class OrderingTest {
@Test
fun sortUsingCustomComparator() {
val comparator = object : Comparator<Item> {
override fun compare(o1: Item, o2: Item): Int {
return compareValuesBy(o1, o2, { it.name }, { it.rating })
override fun compare(a: Item, b: Item): Int {
return compareValuesBy(a, b, { it.name }, { it.rating })
}
override fun equals(other: Any?): Boolean {