Skip to content

Commit a3f150e

Browse files
committed
Use identity hash code on K/N for debug strings
Fixes #1237
1 parent b7e1499 commit a3f150e

File tree

1 file changed

+6
-5
lines changed
  • kotlinx-coroutines-core/native/src

1 file changed

+6
-5
lines changed

kotlinx-coroutines-core/native/src/Debug.kt

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,12 @@
44

55
package kotlinx.coroutines
66

7-
private var counter = 0
7+
import kotlin.math.*
88

9-
internal actual val Any.hexAddress: String
10-
get() {
11-
return "<not_implemented>" // :todo:
12-
}
9+
internal actual val Any.hexAddress: String get() = abs(id().let { if (it == Int.MIN_VALUE) 0 else it }).toString(16)
1310

1411
internal actual val Any.classSimpleName: String get() = this::class.simpleName ?: "Unknown"
12+
13+
14+
@SymbolName("Kotlin_Any_hashCode")
15+
external fun Any.id(): Int // Note: can return negative value on K/N

0 commit comments

Comments
 (0)