@@ -516,6 +516,11 @@ task hello4(type: RunKonanTest) {
|
||||
source = "runtime/basic/hello4.kt"
|
||||
}
|
||||
|
||||
task enumEquals(type: RunKonanTest) {
|
||||
goldValue = "true\nfalse\nfalse\n"
|
||||
source = "runtime/basic/enum_equals.kt"
|
||||
}
|
||||
|
||||
task entry0(type: RunStandaloneKonanTest) {
|
||||
goldValue = "Hello.\n"
|
||||
source = "runtime/basic/entry0.kt"
|
||||
@@ -658,6 +663,12 @@ task freeze_stress(type: RunKonanTest) {
|
||||
source = "runtime/workers/freeze_stress.kt"
|
||||
}
|
||||
|
||||
task enumIdentity(type: RunKonanTest) {
|
||||
disabled = (project.testTarget == 'wasm32') // Workers need pthreads.
|
||||
goldValue = "true\n"
|
||||
source = "runtime/workers/enum_identity.kt"
|
||||
}
|
||||
|
||||
task superFunCall(type: RunKonanTest) {
|
||||
goldValue = "<fun:C><fun:C1>\n<fun:C><fun:C3>\n"
|
||||
source = "codegen/basics/superFunCall.kt"
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
package runtime.basic.enum_equals
|
||||
|
||||
import kotlin.test.*
|
||||
|
||||
enum class EnumA {
|
||||
A, B
|
||||
}
|
||||
|
||||
enum class EnumB {
|
||||
B
|
||||
}
|
||||
|
||||
@Test fun run() {
|
||||
println(EnumA.A == EnumA.A)
|
||||
println(EnumA.A == EnumA.B)
|
||||
println(EnumA.A == EnumB.B)
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
package runtime.workers.enum_identity
|
||||
|
||||
import kotlin.test.*
|
||||
import konan.worker.*
|
||||
|
||||
enum class A {
|
||||
A, B
|
||||
}
|
||||
|
||||
data class Foo(val kind: A)
|
||||
|
||||
// Enums are shared between threads so identity should be kept.
|
||||
@Test
|
||||
fun runTest() {
|
||||
val result = startWorker().schedule(TransferMode.CHECKED, { Foo(A.B) }, { input ->
|
||||
input.kind == A.B
|
||||
}).result()
|
||||
println(result)
|
||||
}
|
||||
@@ -36,7 +36,7 @@ public abstract class Enum<E: Enum<E>>(public val name: String, public val ordin
|
||||
}
|
||||
|
||||
public override final fun equals(other: Any?): Boolean {
|
||||
return other is Enum<*> && ordinal == other.ordinal
|
||||
return this === other
|
||||
}
|
||||
|
||||
public override final fun hashCode(): Int {
|
||||
|
||||
Reference in New Issue
Block a user