toString() method for data classes and fake implementation for hashCode/equals

This commit is contained in:
Alex Tkachman
2012-09-16 15:56:48 +03:00
parent e317764a88
commit 58af365eb2
13 changed files with 236 additions and 40 deletions
@@ -0,0 +1,14 @@
data class A(val x: Array<Int>?, val y: IntArray?)
fun box(): String {
var ts = A(Array<Int>(2, {it}), IntArray(3)).toString()
if(ts != "A{x=[0, 1], y=[0, 0, 0]}") return ts
ts = A(null, IntArray(3)).toString()
if(ts != "A{x=null, y=[0, 0, 0]}") return ts
ts = A(null, null).toString()
if(ts != "A{x=null, y=null}") return ts
return "OK"
}