Files
kotlin-fork/compiler/testData/codegen/box/traits/kt2399.kt
T
Svyatoslav Kuzmich a3e2d2804c [Wasm] Update testData after adding K2 and new test infra support.
- Actualize muted K2 tests
- Actualize muted K1 tests with module systems because legacy Wasm test
  infra had no respect for "// MODULE: ..." test directives
2023-06-25 10:20:40 +02:00

48 lines
1.2 KiB
Kotlin
Vendored

// IGNORE_BACKEND_K1: WASM
// IGNORE_BACKEND: JS_IR
// IGNORE_BACKEND: JS_IR_ES6
// TODO: muted automatically, investigate should it be ran for JS or not
// IGNORE_BACKEND: JS
// on JS Parser.parse and MultiParser.parse clash in ProjectInfoJsonParser
class JsonObject {
}
class JsonArray {
}
class ProjectInfo {
override fun toString(): String = "OK"
}
public interface Parser<in IN: Any, out OUT: Any> {
public fun parse(source: IN): OUT
}
public interface MultiParser<in IN: Any, out OUT: Any> {
public fun parse(source: IN): Collection<OUT>
}
public interface JsonParser<T: Any>: Parser<JsonObject, T>, MultiParser<JsonArray, T> {
public override fun parse(source: JsonArray): Collection<T> {
return ArrayList<T>()
}
}
public abstract class ProjectInfoJsonParser(): JsonParser<ProjectInfo> {
public override fun parse(source: JsonObject): ProjectInfo {
return ProjectInfo()
}
}
class ProjectApiContext {
public val projectInfoJsonParser: ProjectInfoJsonParser = object : ProjectInfoJsonParser(){
}
}
fun box(): String {
val context = ProjectApiContext()
val array = context.projectInfoJsonParser.parse(JsonArray())
return if (array != null) "OK" else "fail"
}