[Wasm] stdlib API: make kotlin.assert internal

Being disabled by default
 and not well-documented, these functions cause confusion among early
 adopters as to why their code don't work properly.

Assert APIs need a proper design across Kotlin platforms.
 Since APIs are not available in common code and K/JS, it is premature
  to have such a general feature in a new experimental platform.

Compiler tests:
* Mute tests that rely on assert.
* Replace JVM-specific assert calls with require calls and unmute passed K/JS tests.

Merge-request: KT-MR-8636
Merged-by: Svyatoslav Kuzmich <svyatoslav.kuzmich@jetbrains.com>
This commit is contained in:
Svyatoslav Kuzmich
2023-02-02 07:06:12 +00:00
committed by Space Team
parent a8f547d080
commit abf70a586c
15 changed files with 36 additions and 61 deletions
@@ -10,14 +10,14 @@ package kotlin
/**
* Throws an [AssertionError] if the [value] is false.
*/
public fun assert(value: Boolean) {
internal fun assert(value: Boolean) {
assert(value) { "Assertion failed" }
}
/**
* Throws an [AssertionError] calculated by [lazyMessage] if the [value] is false.
*/
public fun assert(value: Boolean, lazyMessage: () -> Any) {
internal fun assert(value: Boolean, lazyMessage: () -> Any) {
if (!value) {
val message = lazyMessage()
throw AssertionError(message)