Remove default values in actual functions that have default values in expect

Remove suppressions about default values in expect declarations
This commit is contained in:
Ilya Gorbunov
2018-02-06 08:21:36 +03:00
parent f7b2eba680
commit 9dd87d89ba
5 changed files with 61 additions and 29 deletions
+43 -11
View File
@@ -53,12 +53,25 @@ expect class Regex {
fun replace(input: CharSequence, transform: (MatchResult) -> CharSequence): String
fun replaceFirst(input: CharSequence, replacement: String): String
// TODO: requires optional parameters
@Suppress("EXPECTED_DECLARATION_WITH_DEFAULT_PARAMETER")
/**
* Returns the first match of a regular expression in the [input], beginning at the specified [startIndex].
*
* @param startIndex An index to start search with, by default 0. Must be not less than zero and not greater than `input.length()`
* @return An instance of [MatchResult] if match was found or `null` otherwise.
*/
fun find(input: CharSequence, startIndex: Int = 0): MatchResult?
@Suppress("EXPECTED_DECLARATION_WITH_DEFAULT_PARAMETER")
/**
* Returns a sequence of all occurrences of a regular expression within the [input] string, beginning at the specified [startIndex].
*/
fun findAll(input: CharSequence, startIndex: Int = 0): Sequence<MatchResult>
@Suppress("EXPECTED_DECLARATION_WITH_DEFAULT_PARAMETER")
/**
* Splits the [input] CharSequence around matches of this regular expression.
*
* @param limit Non-negative value specifying the maximum number of substrings the string can be split to.
* Zero by default means no limit is set.
*/
fun split(input: CharSequence, limit: Int = 0): List<String>
companion object {
@@ -103,16 +116,29 @@ public expect fun String.decapitalize(): String
public expect fun CharSequence.repeat(n: Int): String
// TODO: requires optional parameters (and named!)
@Suppress("EXPECTED_DECLARATION_WITH_DEFAULT_PARAMETER")
/**
* Returns a new string with all occurrences of [oldChar] replaced with [newChar].
*/
expect fun String.replace(oldChar: Char, newChar: Char, ignoreCase: Boolean = false): String
@Suppress("EXPECTED_DECLARATION_WITH_DEFAULT_PARAMETER")
/**
* Returns a new string obtained by replacing all occurrences of the [oldValue] substring in this string
* with the specified [newValue] string.
*/
expect fun String.replace(oldValue: String, newValue: String, ignoreCase: Boolean = false): String
@Suppress("EXPECTED_DECLARATION_WITH_DEFAULT_PARAMETER")
/**
* Returns a new string with the first occurrence of [oldChar] replaced with [newChar].
*/
expect fun String.replaceFirst(oldChar: Char, newChar: Char, ignoreCase: Boolean = false): String
@Suppress("EXPECTED_DECLARATION_WITH_DEFAULT_PARAMETER")
/**
* Returns a new string obtained by replacing the first occurrence of the [oldValue] substring in this string
* with the specified [newValue] string.
*/
expect fun String.replaceFirst(oldValue: String, newValue: String, ignoreCase: Boolean = false): String
@Suppress("EXPECTED_DECLARATION_WITH_DEFAULT_PARAMETER")
/**
* Returns `true` if this string is equal to [other], optionally ignoring character case.
*
* @param ignoreCase `true` to ignore character case when comparing strings. By default `false`.
*/
expect fun String?.equals(other: String?, ignoreCase: Boolean = false): Boolean
// From stringsCode.kt
@@ -121,7 +147,13 @@ internal inline expect fun String.nativeIndexOf(ch: Char, fromIndex: Int): Int
internal inline expect fun String.nativeLastIndexOf(ch: Char, fromIndex: Int): Int
expect fun CharSequence.isBlank(): Boolean
@Suppress("EXPECTED_DECLARATION_WITH_DEFAULT_PARAMETER")
/**
* Returns `true` if the specified range in this char sequence is equal to the specified range in another char sequence.
* @param thisOffset the start offset in this char sequence of the substring to compare.
* @param other the string against a substring of which the comparison is performed.
* @param otherOffset the start offset in the other char sequence of the substring to compare.
* @param length the length of the substring to compare.
*/
expect fun CharSequence.regionMatches(thisOffset: Int, other: CharSequence, otherOffset: Int, length: Int, ignoreCase: Boolean = false): Boolean