Aregev2
09/11/2018, 10:58 AMfun main(args: Array<String>) {
val wi = WrapInt(1)
val ws = WrapString("1")
println(wi)
println(ws)
}
inline class WrapInt(private val x: Int)
inline class WrapString(private val x: String)
In 1.3-M2 the the toString method was changed to a structure of a data class
but when calling it on a class that wraps a string it just prints out the contained string... (In JVM)
WrapInt(x=1)
1
In Kotlin Native though it works as expected...
giving this output:
WrapInt(x=1)
WrapString(x=1)
@NotNull
public static String toString(String var0) {
return "WrapString(x=" + var0 + ")";
}
This is from the generated bytecode (decompiled)toString
explicitly