{} replaced by () in data classes toString
This commit is contained in:
@@ -497,7 +497,7 @@ public class ImplementationBodyCodegen extends ClassBodyCodegen {
|
|||||||
boolean first = true;
|
boolean first = true;
|
||||||
for (PropertyDescriptor propertyDescriptor : properties) {
|
for (PropertyDescriptor propertyDescriptor : properties) {
|
||||||
if (first) {
|
if (first) {
|
||||||
iv.aconst(descriptor.getName() + "{" + propertyDescriptor.getName().getName()+"=");
|
iv.aconst(descriptor.getName() + "(" + propertyDescriptor.getName().getName()+"=");
|
||||||
first = false;
|
first = false;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@@ -523,7 +523,7 @@ public class ImplementationBodyCodegen extends ClassBodyCodegen {
|
|||||||
invokeAppendMethod(iv, type);
|
invokeAppendMethod(iv, type);
|
||||||
}
|
}
|
||||||
|
|
||||||
iv.aconst("}");
|
iv.aconst(")");
|
||||||
invokeAppendMethod(iv, JAVA_STRING_TYPE);
|
invokeAppendMethod(iv, JAVA_STRING_TYPE);
|
||||||
|
|
||||||
iv.invokevirtual("java/lang/StringBuilder", "toString", "()Ljava/lang/String;");
|
iv.invokevirtual("java/lang/StringBuilder", "toString", "()Ljava/lang/String;");
|
||||||
|
|||||||
@@ -2,13 +2,13 @@ data class A(val x: Array<Int>?, val y: IntArray?)
|
|||||||
|
|
||||||
fun box(): String {
|
fun box(): String {
|
||||||
var ts = A(Array<Int>(2, {it}), IntArray(3)).toString()
|
var ts = A(Array<Int>(2, {it}), IntArray(3)).toString()
|
||||||
if(ts != "A{x=[0, 1], y=[0, 0, 0]}") return ts
|
if(ts != "A(x=[0, 1], y=[0, 0, 0])") return ts
|
||||||
|
|
||||||
ts = A(null, IntArray(3)).toString()
|
ts = A(null, IntArray(3)).toString()
|
||||||
if(ts != "A{x=null, y=[0, 0, 0]}") return ts
|
if(ts != "A(x=null, y=[0, 0, 0])") return ts
|
||||||
|
|
||||||
ts = A(null, null).toString()
|
ts = A(null, null).toString()
|
||||||
if(ts != "A{x=null, y=null}") return ts
|
if(ts != "A(x=null, y=null)") return ts
|
||||||
|
|
||||||
return "OK"
|
return "OK"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,10 +2,10 @@ data class A(var string: String)
|
|||||||
|
|
||||||
fun box(): String {
|
fun box(): String {
|
||||||
val a = A("Fail")
|
val a = A("Fail")
|
||||||
if(a.toString() != "A{string=Fail}") return "fail"
|
if(a.toString() != "A(string=Fail)") return "fail"
|
||||||
|
|
||||||
a.string = "OK"
|
a.string = "OK"
|
||||||
if("$a" != "A{string=OK}") return a.toString()
|
if("$a" != "A(string=OK)") return a.toString()
|
||||||
|
|
||||||
return "OK"
|
return "OK"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,10 +2,10 @@ data class A<T>(val x: T)
|
|||||||
|
|
||||||
fun box(): String {
|
fun box(): String {
|
||||||
val a = A(42)
|
val a = A(42)
|
||||||
if ("$a" != "A{x=42}") return "$a"
|
if ("$a" != "A(x=42)") return "$a"
|
||||||
|
|
||||||
val b = A(239.toLong())
|
val b = A(239.toLong())
|
||||||
if ("$b" != "A{x=239}") return "$b"
|
if ("$b" != "A(x=239)") return "$b"
|
||||||
|
|
||||||
return "OK"
|
return "OK"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,6 +2,6 @@ data class A(var x: Int, y: Int, val z: Int?)
|
|||||||
|
|
||||||
fun box(): String {
|
fun box(): String {
|
||||||
val a = A(1, 2, null)
|
val a = A(1, 2, null)
|
||||||
if("$a" != "A{x=1, z=null}") return "$a"
|
if("$a" != "A(x=1, z=null)") return "$a"
|
||||||
return "OK"
|
return "OK"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,5 +7,5 @@ class B : A("Fail") {
|
|||||||
fun foo(a: A) = a
|
fun foo(a: A) = a
|
||||||
|
|
||||||
fun box(): String {
|
fun box(): String {
|
||||||
return if ("${foo(B())}" == "A{x=OK}") "OK" else "fail"
|
return if ("${foo(B())}" == "A(x=OK)") "OK" else "fail"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,5 +2,5 @@ data class A(val x: Unit)
|
|||||||
|
|
||||||
fun box(): String {
|
fun box(): String {
|
||||||
val a = A(Unit.VALUE)
|
val a = A(Unit.VALUE)
|
||||||
return if ("$a" == "A{x=Unit.VALUE}") "OK" else "$a"
|
return if ("$a" == "A(x=Unit.VALUE)") "OK" else "$a"
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user