diff --git a/libraries/stdlib/native-wasm/src/kotlin/AutoCloseable.kt b/libraries/stdlib/native-wasm/src/kotlin/AutoCloseable.kt index 86eb881d0c7..0152cfacfcd 100644 --- a/libraries/stdlib/native-wasm/src/kotlin/AutoCloseable.kt +++ b/libraries/stdlib/native-wasm/src/kotlin/AutoCloseable.kt @@ -35,7 +35,7 @@ public actual inline fun T.use(block: (T) -> R): R { @SinceKotlin("1.8") @ExperimentalStdlibApi @PublishedApi -internal fun AutoCloseable?.closeFinally(cause: Throwable?) = when { +internal fun AutoCloseable?.closeFinally(cause: Throwable?): Unit = when { this == null -> {} cause == null -> close() else -> diff --git a/libraries/stdlib/native-wasm/src/kotlin/native/FreezingIsDeprecated.kt b/libraries/stdlib/native-wasm/src/kotlin/native/FreezingIsDeprecated.kt index 1d9ff0e52d5..913f03ac027 100644 --- a/libraries/stdlib/native-wasm/src/kotlin/native/FreezingIsDeprecated.kt +++ b/libraries/stdlib/native-wasm/src/kotlin/native/FreezingIsDeprecated.kt @@ -33,4 +33,4 @@ package kotlin.native AnnotationTarget.TYPEALIAS, ) @Retention(AnnotationRetention.BINARY) -actual annotation class FreezingIsDeprecated +public actual annotation class FreezingIsDeprecated diff --git a/libraries/stdlib/native-wasm/src/kotlin/text/Appendable.kt b/libraries/stdlib/native-wasm/src/kotlin/text/Appendable.kt index 74f572e022b..5c221ddfa62 100644 --- a/libraries/stdlib/native-wasm/src/kotlin/text/Appendable.kt +++ b/libraries/stdlib/native-wasm/src/kotlin/text/Appendable.kt @@ -14,14 +14,14 @@ public actual interface Appendable { * * @param value the character to append. */ - actual fun append(value: Char): Appendable + public actual fun append(value: Char): Appendable /** * Appends the specified character sequence [value] to this Appendable and returns this instance. * * @param value the character sequence to append. If [value] is `null`, then the four characters `"null"` are appended to this Appendable. */ - actual fun append(value: CharSequence?): Appendable + public actual fun append(value: CharSequence?): Appendable /** * Appends a subsequence of the specified character sequence [value] to this Appendable and returns this instance. @@ -33,5 +33,5 @@ public actual interface Appendable { * * @throws IndexOutOfBoundsException or [IllegalArgumentException] when [startIndex] or [endIndex] is out of range of the [value] character sequence indices or when `startIndex > endIndex`. */ - actual fun append(value: CharSequence?, startIndex: Int, endIndex: Int): Appendable + public actual fun append(value: CharSequence?, startIndex: Int, endIndex: Int): Appendable } diff --git a/libraries/stdlib/native-wasm/src/kotlin/text/Regex.kt b/libraries/stdlib/native-wasm/src/kotlin/text/Regex.kt index bc651ae57b5..4cc0484f16c 100644 --- a/libraries/stdlib/native-wasm/src/kotlin/text/Regex.kt +++ b/libraries/stdlib/native-wasm/src/kotlin/text/Regex.kt @@ -56,7 +56,7 @@ public actual enum class RegexOption(internal val value: Int, internal val mask: * @param value The value of captured group. * @param range The range of indices in the input string where group was captured. */ -public actual data class MatchGroup(actual val value: String, val range: IntRange) +public actual data class MatchGroup(public actual val value: String, val range: IntRange) /** @@ -90,42 +90,42 @@ public actual class Regex internal constructor(internal val nativePattern: Patte } /** Creates a regular expression from the specified [pattern] string and the default options. */ - actual constructor(pattern: String): this(Pattern(pattern)) + public actual constructor(pattern: String): this(Pattern(pattern)) /** Creates a regular expression from the specified [pattern] string and the specified single [option]. */ - actual constructor(pattern: String, option: RegexOption): this(Pattern(pattern, option.value)) + public actual constructor(pattern: String, option: RegexOption): this(Pattern(pattern, option.value)) /** Creates a regular expression from the specified [pattern] string and the specified set of [options]. */ - actual constructor(pattern: String, options: Set): this(Pattern(pattern, options.toInt())) + public actual constructor(pattern: String, options: Set): this(Pattern(pattern, options.toInt())) /** The pattern string of this regular expression. */ - actual val pattern: String + public actual val pattern: String get() = nativePattern.pattern private val startNode = nativePattern.startNode /** The set of options that were used to create this regular expression. */ - actual val options: Set = fromInt(nativePattern.flags) + public actual val options: Set = fromInt(nativePattern.flags) - 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. */ - actual fun fromLiteral(literal: String): Regex = Regex(literal, RegexOption.LITERAL) + public actual fun fromLiteral(literal: String): Regex = Regex(literal, RegexOption.LITERAL) /** * Returns a regular expression pattern string 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. */ - actual fun escape(literal: String): String = Pattern.quote(literal) + public actual fun escape(literal: String): String = Pattern.quote(literal) /** * Returns a literal replacement expression for the specified [literal] string. * No characters of that string will have special meaning when it is used as a replacement string in [Regex.replace] function. */ - actual fun escapeReplacement(literal: String): String { + public actual fun escapeReplacement(literal: String): String { if (!literal.contains('\\') && !literal.contains('$')) return literal @@ -155,10 +155,10 @@ public actual class Regex internal constructor(internal val nativePattern: Patte } /** Indicates whether the regular expression matches the entire [input]. */ - actual infix fun matches(input: CharSequence): Boolean = doMatch(input, Mode.MATCH) != null + public actual infix fun matches(input: CharSequence): Boolean = doMatch(input, Mode.MATCH) != null /** Indicates whether the regular expression can find at least one match in the specified [input]. */ - actual fun containsMatchIn(input: CharSequence): Boolean = find(input) != null + public actual fun containsMatchIn(input: CharSequence): Boolean = find(input) != null @SinceKotlin("1.7") @WasExperimental(ExperimentalStdlibApi::class) @@ -175,7 +175,7 @@ public actual class Regex internal constructor(internal val nativePattern: Patte * @sample samples.text.Regexps.find */ @Suppress("ACTUAL_FUNCTION_WITH_DEFAULT_ARGUMENTS") - actual fun find(input: CharSequence, startIndex: Int = 0): MatchResult? { + public actual fun find(input: CharSequence, startIndex: Int = 0): MatchResult? { if (startIndex < 0 || startIndex > input.length) { throw IndexOutOfBoundsException("Start index is out of bounds: $startIndex, input length: ${input.length}") } @@ -199,7 +199,7 @@ public actual class Regex internal constructor(internal val nativePattern: Patte * @sample samples.text.Regexps.findAll */ @Suppress("ACTUAL_FUNCTION_WITH_DEFAULT_ARGUMENTS") - actual fun findAll(input: CharSequence, startIndex: Int = 0): Sequence { + public actual fun findAll(input: CharSequence, startIndex: Int = 0): Sequence { if (startIndex < 0 || startIndex > input.length) { throw IndexOutOfBoundsException("Start index is out of bounds: $startIndex, input length: ${input.length}") } @@ -211,7 +211,7 @@ public actual class Regex internal constructor(internal val nativePattern: Patte * * @return An instance of [MatchResult] if the entire input matches or `null` otherwise. */ - actual fun matchEntire(input: CharSequence): MatchResult?= doMatch(input, Mode.MATCH) + public actual fun matchEntire(input: CharSequence): MatchResult?= doMatch(input, Mode.MATCH) @SinceKotlin("1.7") @WasExperimental(ExperimentalStdlibApi::class) @@ -249,7 +249,7 @@ public actual class Regex internal constructor(internal val nativePattern: Patte * @return the result of replacing each occurrence of this regular expression in [input] with the result of evaluating the [replacement] expression * @throws RuntimeException if [replacement] expression is malformed, or capturing group with specified `name` or `index` does not exist */ - actual fun replace(input: CharSequence, replacement: String): String + public actual fun replace(input: CharSequence, replacement: String): String = replace(input) { match -> substituteGroupRefs(match, replacement) } /** @@ -257,7 +257,7 @@ public actual class Regex internal constructor(internal val nativePattern: Patte * the given function [transform] that takes [MatchResult] and returns a string to be used as a * replacement for that match. */ - actual fun replace(input: CharSequence, transform: (MatchResult) -> CharSequence): String { + public actual fun replace(input: CharSequence, transform: (MatchResult) -> CharSequence): String { var match: MatchResult? = find(input) ?: return input.toString() var lastStart = 0 @@ -297,7 +297,7 @@ public actual class Regex internal constructor(internal val nativePattern: Patte * @return the result of replacing the first occurrence of this regular expression in [input] with the result of evaluating the [replacement] expression * @throws RuntimeException if [replacement] expression is malformed, or capturing group with specified `name` or `index` does not exist */ - actual fun replaceFirst(input: CharSequence, replacement: String): String { + public actual fun replaceFirst(input: CharSequence, replacement: String): String { val match = find(input) ?: return input.toString() val length = input.length val result = StringBuilder(length) @@ -316,7 +316,7 @@ public actual class Regex internal constructor(internal val nativePattern: Patte * Zero by default means no limit is set. */ @Suppress("ACTUAL_FUNCTION_WITH_DEFAULT_ARGUMENTS") - actual fun split(input: CharSequence, limit: Int = 0): List { + public actual fun split(input: CharSequence, limit: Int = 0): List { requireNonNegativeLimit(limit) var match: MatchResult? = find(input) diff --git a/libraries/stdlib/wasm/internal/kotlin/wasm/internal/Coroutines.kt b/libraries/stdlib/wasm/internal/kotlin/wasm/internal/Coroutines.kt index e770393ae3f..58fe363654f 100644 --- a/libraries/stdlib/wasm/internal/kotlin/wasm/internal/Coroutines.kt +++ b/libraries/stdlib/wasm/internal/kotlin/wasm/internal/Coroutines.kt @@ -23,7 +23,7 @@ internal suspend fun returnIfSuspended(argument: Any?): T = internal fun interceptContinuationIfNeeded( context: CoroutineContext, continuation: Continuation -) = context[ContinuationInterceptor]?.interceptContinuation(continuation) ?: continuation +): Continuation = context[ContinuationInterceptor]?.interceptContinuation(continuation) ?: continuation @PublishedApi @@ -68,6 +68,6 @@ internal fun startCoroutineUninterceptedOrReturnIntrinsic2( @PublishedApi @SinceKotlin("1.3") -internal val EmptyContinuation = Continuation(EmptyCoroutineContext) { result -> +internal val EmptyContinuation: Continuation = Continuation(EmptyCoroutineContext) { result -> result.getOrThrow() } \ No newline at end of file diff --git a/libraries/stdlib/wasm/js/builtins/kotlin/Throwable.kt b/libraries/stdlib/wasm/js/builtins/kotlin/Throwable.kt index ca47635834f..31a859758ab 100644 --- a/libraries/stdlib/wasm/js/builtins/kotlin/Throwable.kt +++ b/libraries/stdlib/wasm/js/builtins/kotlin/Throwable.kt @@ -15,12 +15,12 @@ import kotlin.wasm.internal.jsToKotlinStringAdapter * @param message the detail message string. * @param cause the cause of this throwable. */ -public open class Throwable(open val message: String?, open val cause: kotlin.Throwable?) { - constructor(message: String?) : this(message, null) +public open class Throwable(public open val message: String?, public open val cause: kotlin.Throwable?) { + public constructor(message: String?) : this(message, null) - constructor(cause: Throwable?) : this(cause?.toString(), cause) + public constructor(cause: Throwable?) : this(cause?.toString(), cause) - constructor() : this(null, null) + public constructor() : this(null, null) internal val jsStack: ExternalInterfaceType = captureStackTrace() diff --git a/libraries/stdlib/wasm/js/src/kotlin/Dynamic.kt b/libraries/stdlib/wasm/js/src/kotlin/Dynamic.kt index 75585778df7..1f949f38970 100644 --- a/libraries/stdlib/wasm/js/src/kotlin/Dynamic.kt +++ b/libraries/stdlib/wasm/js/src/kotlin/Dynamic.kt @@ -17,14 +17,14 @@ public external interface Dynamic : JsAny * Reinterprets this value as a value of the Dynamic type. */ @Deprecated("If value is a subtype of JsAny, use JsAny instead. Otherwise, use toJsReference", level = DeprecationLevel.ERROR) -fun Any.asDynamic(): JsAny = this.toJsReference() +public fun Any.asDynamic(): JsAny = this.toJsReference() /** * Reinterprets this value as a value of the Dynamic type. */ @Deprecated("Use toJsString instead", level = DeprecationLevel.ERROR, replaceWith = ReplaceWith("this.toJsString()")) @kotlin.internal.InlineOnly -fun String.asDynamic(): JsString = this.toJsString() +public fun String.asDynamic(): JsString = this.toJsString() private fun jsThrow(e: JsAny) { js("throw e;") diff --git a/libraries/stdlib/wasm/js/src/kotlin/js/JsArray.kt b/libraries/stdlib/wasm/js/src/kotlin/js/JsArray.kt index f1cfb0f9f0d..35aee825df0 100644 --- a/libraries/stdlib/wasm/js/src/kotlin/js/JsArray.kt +++ b/libraries/stdlib/wasm/js/src/kotlin/js/JsArray.kt @@ -8,7 +8,7 @@ package kotlin.js /** JavaScript Array */ @JsName("Array") public external class JsArray : JsAny { - val length: Int + public val length: Int } public operator fun JsArray.get(index: Int): T? = diff --git a/libraries/stdlib/wasm/js/src/kotlin/js/Promise.kt b/libraries/stdlib/wasm/js/src/kotlin/js/Promise.kt index eb74790a5a1..94cc13b7338 100644 --- a/libraries/stdlib/wasm/js/src/kotlin/js/Promise.kt +++ b/libraries/stdlib/wasm/js/src/kotlin/js/Promise.kt @@ -20,7 +20,7 @@ public external class Promise(executor: (resolve: (T) -> Unit, r public fun catch(onRejected: (JsAny) -> S): Promise public fun finally(onFinally: () -> Unit): Promise - companion object { + public companion object { public fun all(promise: JsArray>): Promise> public fun race(promise: JsArray>): Promise public fun reject(e: JsAny): Promise diff --git a/libraries/stdlib/wasm/src/kotlin/Numbers.kt b/libraries/stdlib/wasm/src/kotlin/Numbers.kt index f27197a1132..fc3daadf32f 100644 --- a/libraries/stdlib/wasm/src/kotlin/Numbers.kt +++ b/libraries/stdlib/wasm/src/kotlin/Numbers.kt @@ -140,33 +140,33 @@ public actual inline fun Long.rotateRight(bitCount: Int): Long = * Returns `true` if the specified number is a * Not-a-Number (NaN) value, `false` otherwise. */ -actual fun Double.isNaN(): Boolean = this != this +public actual fun Double.isNaN(): Boolean = this != this /** * Returns `true` if the specified number is a * Not-a-Number (NaN) value, `false` otherwise. */ -actual fun Float.isNaN(): Boolean = this != this +public actual fun Float.isNaN(): Boolean = this != this /** * Returns `true` if this value is infinitely large in magnitude. */ -actual fun Double.isInfinite(): Boolean = (this == Double.POSITIVE_INFINITY) || (this == Double.NEGATIVE_INFINITY) +public actual fun Double.isInfinite(): Boolean = (this == Double.POSITIVE_INFINITY) || (this == Double.NEGATIVE_INFINITY) /** * Returns `true` if this value is infinitely large in magnitude. */ -actual fun Float.isInfinite(): Boolean = (this == Float.POSITIVE_INFINITY) || (this == Float.NEGATIVE_INFINITY) +public actual fun Float.isInfinite(): Boolean = (this == Float.POSITIVE_INFINITY) || (this == Float.NEGATIVE_INFINITY) /** * Returns `true` if the argument is a finite floating-point value; returns `false` otherwise (for `NaN` and infinity arguments). */ -actual fun Double.isFinite(): Boolean = !isInfinite() && !isNaN() +public actual fun Double.isFinite(): Boolean = !isInfinite() && !isNaN() /** * Returns `true` if the argument is a finite floating-point value; returns `false` otherwise (for `NaN` and infinity arguments). */ -actual fun Float.isFinite(): Boolean = !isInfinite() && !isNaN() +public actual fun Float.isFinite(): Boolean = !isInfinite() && !isNaN() /** * Returns a bit representation of the specified floating-point value as [Long] diff --git a/libraries/stdlib/wasm/src/kotlin/coroutines/cancellation/CancellationException.kt b/libraries/stdlib/wasm/src/kotlin/coroutines/cancellation/CancellationException.kt index 4f4de5417ca..85bc2a5797b 100644 --- a/libraries/stdlib/wasm/src/kotlin/coroutines/cancellation/CancellationException.kt +++ b/libraries/stdlib/wasm/src/kotlin/coroutines/cancellation/CancellationException.kt @@ -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) } \ No newline at end of file diff --git a/libraries/stdlib/wasm/src/kotlin/text/CharacterCodingExceptionWasm.kt b/libraries/stdlib/wasm/src/kotlin/text/CharacterCodingExceptionWasm.kt index 6087af83aa6..be67a22de06 100644 --- a/libraries/stdlib/wasm/src/kotlin/text/CharacterCodingExceptionWasm.kt +++ b/libraries/stdlib/wasm/src/kotlin/text/CharacterCodingExceptionWasm.kt @@ -11,5 +11,5 @@ package kotlin.text @SinceKotlin("1.4") @WasExperimental(ExperimentalStdlibApi::class) public actual open class CharacterCodingException(message: String?) : Exception(message) { - actual constructor() : this(null) + public actual constructor() : this(null) } \ No newline at end of file diff --git a/libraries/stdlib/wasm/src/kotlin/text/StringNumberConversionsWasm.kt b/libraries/stdlib/wasm/src/kotlin/text/StringNumberConversionsWasm.kt index d4b7c3f036f..fefbd73b274 100644 --- a/libraries/stdlib/wasm/src/kotlin/text/StringNumberConversionsWasm.kt +++ b/libraries/stdlib/wasm/src/kotlin/text/StringNumberConversionsWasm.kt @@ -13,13 +13,13 @@ import kotlin.wasm.internal.wasm_f32_demote_f64 * * There are also strict versions of the function available on non-nullable String, [toBooleanStrict] and [toBooleanStrictOrNull]. */ -actual fun String?.toBoolean(): Boolean = this != null && this.lowercase() == "true" +public actual fun String?.toBoolean(): Boolean = this != null && this.lowercase() == "true" /** * Parses the string as a signed [Byte] number and returns the result. * @throws NumberFormatException if the string is not a valid representation of a number. */ -actual fun String.toByte(): Byte = toByteOrNull() ?: numberFormatError(this) +public actual fun String.toByte(): Byte = toByteOrNull() ?: numberFormatError(this) /** * Parses the string as a signed [Byte] number and returns the result. @@ -119,7 +119,7 @@ public actual fun Short.toString(radix: Int): String = this.toLong().toString(ra * @throws IllegalArgumentException when [radix] is not a valid radix for number to string conversion. */ @SinceKotlin("1.2") -actual fun Int.toString(radix: Int): String = toLong().toString(radix) +public actual fun Int.toString(radix: Int): String = toLong().toString(radix) /** * Returns a string representation of this [Long] value in the specified [radix]. @@ -127,7 +127,7 @@ actual fun Int.toString(radix: Int): String = toLong().toString(radix) * @throws IllegalArgumentException when [radix] is not a valid radix for number to string conversion. */ @SinceKotlin("1.2") -actual fun Long.toString(radix: Int): String { +public actual fun Long.toString(radix: Int): String { checkRadix(radix) fun Long.getChar() = toInt().let { if (it < 10) '0' + it else 'a' + (it - 10) } diff --git a/libraries/stdlib/wasm/src/kotlin/text/StringsWasm.kt b/libraries/stdlib/wasm/src/kotlin/text/StringsWasm.kt index 123f28a96a3..fe1faf5e252 100644 --- a/libraries/stdlib/wasm/src/kotlin/text/StringsWasm.kt +++ b/libraries/stdlib/wasm/src/kotlin/text/StringsWasm.kt @@ -513,7 +513,7 @@ public actual fun CharSequence.isBlank(): Boolean = length == 0 || indices.all { * @param otherOffset the start offset in the other char sequence of the substring to compare. * @param length the length of the substring to compare. */ -actual fun CharSequence.regionMatches( +public actual fun CharSequence.regionMatches( thisOffset: Int, other: CharSequence, otherOffset: Int, diff --git a/libraries/stdlib/wasm/wasi/builtins/kotlin/Throwable.kt b/libraries/stdlib/wasm/wasi/builtins/kotlin/Throwable.kt index 12156b91a45..baddf1a5ac4 100644 --- a/libraries/stdlib/wasm/wasi/builtins/kotlin/Throwable.kt +++ b/libraries/stdlib/wasm/wasi/builtins/kotlin/Throwable.kt @@ -13,12 +13,12 @@ import kotlin.wasm.internal.getSimpleName * @param message the detail message string. * @param cause the cause of this throwable. */ -public open class Throwable(open val message: String?, open val cause: kotlin.Throwable?) { - constructor(message: String?) : this(message, null) +public open class Throwable(public open val message: String?, public open val cause: kotlin.Throwable?) { + public constructor(message: String?) : this(message, null) - constructor(cause: Throwable?) : this(cause?.toString(), cause) + public constructor(cause: Throwable?) : this(cause?.toString(), cause) - constructor() : this(null, null) + public constructor() : this(null, null) //TODO: Investigate possibility to make WASI stack discoverable (KT-60965) internal val stack: String get() = ""