[stdlib] Explicit visibility and return types: JS

Stepping test line number changes are due to changes in coroutineInternalJS.kt
This commit is contained in:
Ilya Gorbunov
2023-09-19 14:54:59 +02:00
committed by Space Team
parent 0c61ce61c3
commit 381a8fd55f
14 changed files with 33 additions and 32 deletions
@@ -101,8 +101,8 @@ suspend fun box() {
// test.kt:34 doResume: b=2:number
// test.kt:35 doResume: b=2:number, e=5:number
// test.kt:7 id: obj=5:number
// test.kt:44 doResume: b=2:number, e=5:number
// test.kt:44 doResume: b=2:number, e=5:number
// test.kt:45 doResume: b=2:number, e=5:number
// test.kt:45 doResume: b=2:number, e=5:number
// test.kt:45 doResume: b=2:number, e=5:number
// test.kt:33 doResume: b=2:number, e=5:number
// test.kt:37 doResume: b=2:number, e=5:number, result=Unit
+5 -5
View File
@@ -7,15 +7,15 @@ package kotlin
import kotlin.js.*
abstract class Enum<E : Enum<E>>(@kotlin.internal.IntrinsicConstEvaluation val name: String, val ordinal: Int) : Comparable<E> {
public abstract class Enum<E : Enum<E>>(@kotlin.internal.IntrinsicConstEvaluation public val name: String, public val ordinal: Int) : Comparable<E> {
final override fun compareTo(other: E) = ordinal.compareTo(other.ordinal)
final override fun compareTo(other: E): Int = ordinal.compareTo(other.ordinal)
final override fun equals(other: Any?) = this === other
final override fun equals(other: Any?): Boolean = this === other
final override fun hashCode(): Int = identityHashCode(this)
override fun toString() = name
override fun toString(): String = name
companion object
public companion object
}
+1 -1
View File
@@ -12,7 +12,7 @@ package kotlin
* implemented as instances of this class.
*/
public class String : Comparable<String>, CharSequence {
companion object {}
public companion object {}
/**
* Returns a string obtained by concatenating this string with the string representation of the given [other] object.
@@ -23,7 +23,7 @@ internal suspend fun <T> returnIfSuspended(argument: Any?): T {
internal fun <T> interceptContinuationIfNeeded(
context: CoroutineContext,
continuation: Continuation<T>
) = context[ContinuationInterceptor]?.interceptContinuation(continuation) ?: continuation
): Continuation<T> = context[ContinuationInterceptor]?.interceptContinuation(continuation) ?: continuation
@SinceKotlin("1.2")
@@ -35,7 +35,7 @@ public actual inline fun <T : AutoCloseable?, R> T.use(block: (T) -> R): R {
@ExperimentalStdlibApi
@SinceKotlin("1.8")
@PublishedApi
internal fun AutoCloseable?.closeFinally(cause: Throwable?) = when {
internal fun AutoCloseable?.closeFinally(cause: Throwable?): Unit = when {
this == null -> {}
cause == null -> close()
else ->
@@ -6,8 +6,8 @@
package org.w3c.dom
public external interface ItemArrayLike<out T> {
val length: Int
fun item(index: Int): T?
public val length: Int
public fun item(index: Int): T?
}
/**
@@ -7,8 +7,8 @@ package kotlin.coroutines.cancellation
@SinceKotlin("1.4")
public actual open class CancellationException : IllegalStateException {
actual constructor() : super()
actual constructor(message: String?) : super(message)
constructor(message: String?, cause: Throwable?) : super(message, cause)
constructor(cause: Throwable?) : super(cause)
public actual constructor() : super()
public actual constructor(message: String?) : super(message)
public constructor(message: String?, cause: Throwable?) : super(message, cause)
public constructor(cause: Throwable?) : super(cause)
}
@@ -10,6 +10,6 @@ import kotlin.coroutines.EmptyCoroutineContext
@PublishedApi
@SinceKotlin("1.3")
internal val EmptyContinuation = Continuation<Any?>(EmptyCoroutineContext) { result ->
internal val EmptyContinuation: Continuation<Any?> = Continuation(EmptyCoroutineContext) { result ->
result.getOrThrow()
}
+2 -2
View File
@@ -24,7 +24,7 @@ public external interface Json {
* }
* ```
*/
operator fun get(propertyName: String): Any?
public operator fun get(propertyName: String): Any?
/**
* Calls of the function will be translated to an assignment of [value] to the receiver indexed (with square brackets/index operation) with [propertyName].
@@ -46,7 +46,7 @@ public external interface Json {
* }
* ```
*/
operator fun set(propertyName: String, value: Any?): Unit
public operator fun set(propertyName: String, value: Any?): Unit
}
/**
+3 -3
View File
@@ -22,7 +22,7 @@ public open external class Promise<out T>(executor: (resolve: (T) -> Unit, rejec
public open fun finally(onFinally: () -> Unit): Promise<T>
companion object {
public companion object {
public fun <S> all(promise: Array<out Promise<S>>): Promise<Array<out S>>
public fun <S> race(promise: Array<out Promise<S>>): Promise<S>
@@ -35,13 +35,13 @@ public open external class Promise<out T>(executor: (resolve: (T) -> Unit, rejec
}
// It's workaround for KT-19672 since we can fix it properly until KT-11265 isn't fixed.
inline fun <T, S> Promise<Promise<T>>.then(
public inline fun <T, S> Promise<Promise<T>>.then(
noinline onFulfilled: ((T) -> S)?
): Promise<S> {
return this.unsafeCast<Promise<T>>().then(onFulfilled)
}
inline fun <T, S> Promise<Promise<T>>.then(
public inline fun <T, S> Promise<Promise<T>>.then(
noinline onFulfilled: ((T) -> S)?,
noinline onRejected: ((Throwable) -> S)?
): Promise<S> {
@@ -12,21 +12,21 @@ import kotlin.reflect.js.internal.KClassImpl
/**
* Represents the constructor of a class. Instances of `JsClass` can be passed to JavaScript APIs that expect a constructor reference.
*/
external interface JsClass<T : Any> {
public external interface JsClass<T : Any> {
/**
* Returns the unqualified name of the class represented by this instance.
*/
val name: String
public val name: String
}
/**
* Obtains a constructor reference for the given `KClass`.
*/
val <T : Any> KClass<T>.js: JsClass<T>
public val <T : Any> KClass<T>.js: JsClass<T>
get() = (this as KClassImpl<T>).jClass
/**
* Obtains a `KClass` instance for the given constructor reference.
*/
val <T : Any> JsClass<T>.kotlin: KClass<T>
public val <T : Any> JsClass<T>.kotlin: KClass<T>
get() = getKClass(this)
@@ -162,7 +162,7 @@ public actual enum class CharCategory(internal val value: Int, public actual val
*/
public actual operator fun contains(char: Char): Boolean = char.getCategoryValue() == this.value
companion object {
public companion object {
internal fun valueOf(category: Int): CharCategory =
when (category) {
in 0..16 -> entries[category]
@@ -10,5 +10,5 @@ package kotlin.text
*/
@SinceKotlin("1.4")
public actual open class CharacterCodingException(message: String?) : Exception(message) {
actual constructor() : this(null)
public actual constructor() : this(null)
}
+5 -4
View File
@@ -10,9 +10,10 @@ import kotlin.js.RegExp
/**
* Provides enumeration values to use to set regular expression options.
*/
public actual enum class RegexOption(val value: String) {
public actual enum class RegexOption(public val value: String) {
/** Enables case-insensitive matching. */
IGNORE_CASE("i"),
/** Enables multiline mode.
*
* In multiline mode the expressions `^` and `$` match just after or just before,
@@ -28,7 +29,7 @@ private fun Iterable<RegexOption>.toFlags(prepend: String): String = joinToStrin
*
* @param value The value of captured group.
*/
public actual data class MatchGroup(actual val value: String)
public actual data class MatchGroup(public actual val value: String)
/**
@@ -62,7 +63,7 @@ public actual operator fun MatchGroupCollection.get(name: String): MatchGroup? {
* @constructor Creates a regular expression from the specified [pattern] string and the specified set of [options].
*/
@Suppress("NO_ACTUAL_CLASS_MEMBER_FOR_EXPECTED_CLASS") // Counterpart for @Suppress("ACTUAL_FUNCTION_WITH_DEFAULT_ARGUMENTS")
public actual class Regex actual constructor(pattern: String, options: Set<RegexOption>) {
public actual class Regex public actual constructor(pattern: String, options: Set<RegexOption>) {
/** Creates a regular expression from the specified [pattern] string and the specified single [option]. */
public actual constructor(pattern: String, option: RegexOption) : this(pattern, setOf(option))
@@ -314,7 +315,7 @@ public actual class Regex actual constructor(pattern: String, options: Set<Regex
*/
public override fun toString(): String = nativePattern.toString()
actual companion object {
public actual companion object {
/**
* Returns a regular expression that matches the specified [literal] string literally.
* No characters of that string will have special meaning when searching for an occurrence of the regular expression.