diff --git a/compiler/testData/builtin-classes-kotlin.txt b/compiler/testData/builtin-classes-kotlin.txt index 025e8d5f37d..5aae1957b2b 100644 --- a/compiler/testData/builtin-classes-kotlin.txt +++ b/compiler/testData/builtin-classes-kotlin.txt @@ -654,7 +654,7 @@ public final class String : kotlin.Comparable, kotlin.CharSequenc public open override /*1*/ fun compareTo(/*0*/ other: kotlin.String): kotlin.Int public open override /*1*/ fun get(/*0*/ index: kotlin.Int): kotlin.Char public final operator fun plus(/*0*/ other: kotlin.Any?): kotlin.String - public open override /*1*/ fun subSequence(/*0*/ start: kotlin.Int, /*1*/ end: kotlin.Int): kotlin.CharSequence + public open override /*1*/ fun subSequence(/*0*/ startIndex: kotlin.Int, /*1*/ endIndex: kotlin.Int): kotlin.CharSequence public companion object Companion { /*primary*/ private constructor Companion() diff --git a/core/builtins/native/kotlin/String.kt b/core/builtins/native/kotlin/String.kt index e5370dba54c..6b3f7f6e52c 100644 --- a/core/builtins/native/kotlin/String.kt +++ b/core/builtins/native/kotlin/String.kt @@ -1,5 +1,5 @@ /* - * Copyright 2010-2015 JetBrains s.r.o. + * Copyright 2010-2016 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -32,7 +32,7 @@ public class String : Comparable, CharSequence { public override fun get(index: Int): Char - public override fun subSequence(start: Int, end: Int): CharSequence + public override fun subSequence(startIndex: Int, endIndex: Int): CharSequence public override fun compareTo(other: String): Int } diff --git a/libraries/stdlib/src/kotlin/text/Strings.kt b/libraries/stdlib/src/kotlin/text/Strings.kt index 9db6d4577c6..b4de54e6039 100644 --- a/libraries/stdlib/src/kotlin/text/Strings.kt +++ b/libraries/stdlib/src/kotlin/text/Strings.kt @@ -1,3 +1,19 @@ +/* + * Copyright 2010-2016 JetBrains s.r.o. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + @file:kotlin.jvm.JvmMultifileClass @file:kotlin.jvm.JvmName("StringsKt") @@ -286,6 +302,16 @@ public fun String.substring(range: IntRange): String = substring(range.start, ra */ public fun CharSequence.subSequence(range: IntRange): CharSequence = subSequence(range.start, range.endInclusive + 1) +/** + * Returns a subsequence of this char sequence. + * + * This extension is chosen only for invocation with old-named parameters. + * Replace parameter names with the same as those of [CharSequence.subSequence]. + */ +@kotlin.internal.InlineOnly +@Deprecated("Use parameters named startIndex and endIndex.", ReplaceWith("subSequence(startIndex = start, endIndex = end)")) +public inline fun String.subSequence(start: Int, end: Int): CharSequence = subSequence(start, end) + /** * Returns a substring of chars from a range of this char sequence starting at the [startIndex] and ending right before the [endIndex]. *