Incorrect representation of unsigned number types
The REPL has a weird issue to show unsigned values, although this only happens when they are "by themselves:"
[0] listOf(ULong.MAX_VALUE) // okay
res0: List<ULong> = [18446744073709551615]
[1] ULong.MAX_VALUE // nope
res1: ULong = -1
[2] 0UL - 1UL // nope
res2: ULong = -1
[3] (0UL - 1UL).toString() // okay
res3: String = 18446744073709551615
[4]
I don't know how Kotlin internals work with numbers nor how they're used in Ki, but it seems when the representation for unsigned types is triggered their .toString() isn't getting called. Could it be related to the fact that these types were built around JVM native types with some hacks? (a long doesn't have methods after all.)
I'm working with the 0.5.1 version of Ki and Kotlin 1.7.0.
Ok I was not too far off with my assumption (about the issue being related to the implementation of unsigned types.) I modified the output here to include value's class. It should say ULong, but it's Long instead.
https://github.com/Kotlin/kotlin-interactive-shell/blob/03ddf993ade5154fc923bc29c84e1170d512b486/ki-shell/src/main/kotlin/org/jetbrains/kotlinx/ki/shell/Shell.kt#L305C1-L306
is ResultValue.Value ->
println("${evalResultValue.name}${renderResultType(evalResultValue)} = ${evalResultValue.value} | ${evalResultValue.value!!::class}".bound(settings.maxResultLength))
[0] 0UL
res0: ULong = 0 | kotlin.Long