Add toString() to Any, fix all tests

#KT-4517 Fixed
This commit is contained in:
Alexander Udalov
2014-02-06 23:43:12 +04:00
parent 6127d53eac
commit 3dcd85bdb4
55 changed files with 110 additions and 72 deletions
+1 -1
View File
@@ -51,5 +51,5 @@ public class StringBuilder() : Appendable {
//TODO
//override fun append(csq: CharSequence?, start: Int, end: Int): StringBuilder = js.noImpl
public fun append(obj: Any?): StringBuilder = js.noImpl
public fun toString(): String = js.noImpl
override fun toString(): String = js.noImpl
}
+1 -1
View File
@@ -49,7 +49,7 @@ public abstract class AbstractList<E>() : AbstractCollection<E>(), MutableList<E
override fun equals(other: Any?): Boolean = js.noImpl
fun toString(): String = js.noImpl
override fun toString(): String = js.noImpl
}
library
+2 -3
View File
@@ -8,8 +8,7 @@ public class Pair<A, B> (
public fun component1(): A = first
public fun component2(): B = second
public fun toString(): String = "($first, $second)"
override fun toString(): String = "($first, $second)"
}
public class Triple<A, B, C> (
@@ -21,5 +20,5 @@ public class Triple<A, B, C> (
public fun component2(): B = second
public fun component3(): C = third
public fun toString(): String = "($first, $second, $third)"
override fun toString(): String = "($first, $second, $third)"
}
@@ -49,7 +49,7 @@ trait CallInfo {
fun constructSafeCallIsNeeded(result: JsExpression): JsExpression
fun toString(): String {
override fun toString(): String {
val location = DiagnosticUtils.atLocation(context.bindingContext(), callableDescriptor)
val name = callableDescriptor.getName().asString()
return "callableDescriptor: $name at $location; thisObject: $thisObject; receiverObject: $receiverObject"
@@ -7,13 +7,13 @@ public fun toString(): String = ""
public class PublicClass {
override fun equals(a: Any?): Boolean = this.identityEquals(a)
override fun hashCode(): Int = 0
public fun toString(): String = "PublicClass"
override fun toString(): String = "PublicClass"
}
internal class InternalClass {
override fun equals(a: Any?): Boolean = this.identityEquals(a)
override fun hashCode(): Int = 1
public fun toString(): String = "InternalClass"
override fun toString(): String = "InternalClass"
// overloads
public fun equals(a: Any?, b: Any?): Boolean = a == b
@@ -24,7 +24,7 @@ internal class InternalClass {
private class PrivateClass {
override fun equals(a: Any?): Boolean = this.identityEquals(a)
override fun hashCode(): Int = 2
public fun toString(): String = "InternalClass"
override fun toString(): String = "InternalClass"
// overloads
public fun equals(a: Any?, b: Any?): Boolean = a == b
@@ -3,7 +3,7 @@ package foo
var i = 0
class A() {
fun toString(): String {
override fun toString(): String {
i++
return "bar"
}
@@ -1,7 +1,7 @@
package foo
class A(var i : Int) {
fun toString() = "a$i"
override fun toString() = "a$i"
}
fun box() : Boolean {
@@ -1,7 +1,7 @@
package foo
class Foo(val name: String) {
public fun toString(): String {
override fun toString(): String {
return name + "S"
}
}
@@ -48,7 +48,7 @@ fun main(args: Array<String>) {
trait Element {
fun render(builder: StringBuilder, indent: String)
fun toString(): String? {
override fun toString(): String {
val builder = StringBuilder()
render(builder, "")
return builder.toString()