PHondogo
12/01/2024, 8:35 PMfun testFun(value: Any) {
println("Value $value is of type ${value::class.simpleName}")
}
val v: Double = 1.0
testFun(v) // will print: Value 1 is of type Int // why?
Robert Jaros
12/01/2024, 9:21 PMprintln('Value ' + toString(value) + ' is of type ' + getKClassFromExpression(value).get_simpleName_r6f8py_k$());
Robert Jaros
12/01/2024, 9:22 PMPHondogo
12/01/2024, 9:26 PMRobert Jaros
12/01/2024, 9:29 PMfun testFun(value: Double)
will work as expected but I understand it's not a solution for your case?Robert Jaros
12/01/2024, 9:33 PMRobert Jaros
12/01/2024, 9:36 PMinline fun<reified T : Any> testFun(value: T) {
println("Value $value is of type ${value::class.simpleName}")
}
Robert Jaros
12/01/2024, 9:36 PMPHondogo
12/01/2024, 9:40 PM