Files
kotlin-fork/compiler/testData/diagnostics/testsWithJsStdLib/name/companionInheritsOwnerClass.kt
T
Alexander Korepanov 4609b11102 [JS FIR] Add JsName clash test
^KT-64364
2024-01-02 10:15:02 +00:00

16 lines
454 B
Kotlin
Vendored

// !OPT_IN: kotlin.js.ExperimentalJsExport
// FIR_IDENTICAL
@file:JsExport
interface Optional<out T> {
@JsName("valueOrThrowException")
fun valueOrThrow(exp: Throwable): T
fun valueOrThrow(): T = valueOrThrow(NoSuchElementException("Optional has no value"))
}
abstract class None<out T : Any> private constructor() : Optional<T> {
companion object : None<Nothing>()
override fun valueOrThrow(exp: Throwable): Nothing = throw exp
}