Add toString() to Any, fix all tests
#KT-4517 Fixed
This commit is contained in:
@@ -4,4 +4,6 @@ public open class Any {
|
||||
public open fun equals(other: Any?): Boolean
|
||||
|
||||
public open fun hashCode(): Int
|
||||
|
||||
public open fun toString(): String
|
||||
}
|
||||
|
||||
@@ -35,8 +35,6 @@ public trait CharSequence {
|
||||
public fun get(index : Int) : Char
|
||||
|
||||
public val length : Int
|
||||
|
||||
public fun toString() : String
|
||||
}
|
||||
|
||||
public class String() : Comparable<String>, CharSequence {
|
||||
@@ -44,7 +42,6 @@ public class String() : Comparable<String>, CharSequence {
|
||||
|
||||
public override fun compareTo(that : String) : Int
|
||||
public override fun get(index : Int) : Char
|
||||
public override fun toString() : String
|
||||
public override val length: Int
|
||||
}
|
||||
|
||||
|
||||
@@ -34,7 +34,7 @@ public class ByteProgression(
|
||||
|
||||
override fun hashCode(): Int = 31 * (31 * start.toInt() + end) + increment
|
||||
|
||||
fun toString(): String = if (increment > 0) "$start..$end step $increment" else "$start downTo $end step ${-increment}"
|
||||
override fun toString(): String = if (increment > 0) "$start..$end step $increment" else "$start downTo $end step ${-increment}"
|
||||
}
|
||||
|
||||
public class CharProgression(
|
||||
@@ -53,7 +53,7 @@ public class CharProgression(
|
||||
|
||||
override fun hashCode(): Int = 31 * (31 * start.toInt() + end) + increment
|
||||
|
||||
fun toString(): String = if (increment > 0) "$start..$end step $increment" else "$start downTo $end step ${-increment}"
|
||||
override fun toString(): String = if (increment > 0) "$start..$end step $increment" else "$start downTo $end step ${-increment}"
|
||||
}
|
||||
|
||||
public class ShortProgression(
|
||||
@@ -72,7 +72,7 @@ public class ShortProgression(
|
||||
|
||||
override fun hashCode(): Int = 31 * (31 * start.toInt() + end) + increment
|
||||
|
||||
fun toString(): String = if (increment > 0) "$start..$end step $increment" else "$start downTo $end step ${-increment}"
|
||||
override fun toString(): String = if (increment > 0) "$start..$end step $increment" else "$start downTo $end step ${-increment}"
|
||||
}
|
||||
|
||||
public class IntProgression(
|
||||
@@ -91,7 +91,7 @@ public class IntProgression(
|
||||
|
||||
override fun hashCode(): Int = 31 * (31 * start + end) + increment
|
||||
|
||||
fun toString(): String = if (increment > 0) "$start..$end step $increment" else "$start downTo $end step ${-increment}"
|
||||
override fun toString(): String = if (increment > 0) "$start..$end step $increment" else "$start downTo $end step ${-increment}"
|
||||
}
|
||||
|
||||
public class LongProgression(
|
||||
@@ -110,7 +110,7 @@ public class LongProgression(
|
||||
|
||||
override fun hashCode(): Int = (31 * (31 * (start xor (start ushr 32)) + (end xor (end ushr 32))) + (increment xor (increment ushr 32))).toInt()
|
||||
|
||||
fun toString(): String = if (increment > 0) "$start..$end step $increment" else "$start downTo $end step ${-increment}"
|
||||
override fun toString(): String = if (increment > 0) "$start..$end step $increment" else "$start downTo $end step ${-increment}"
|
||||
}
|
||||
|
||||
public class FloatProgression(
|
||||
@@ -130,7 +130,7 @@ public class FloatProgression(
|
||||
|
||||
override fun hashCode(): Int = 31 * (31 * java.lang.Float.floatToIntBits(start) + java.lang.Float.floatToIntBits(end)) + java.lang.Float.floatToIntBits(increment)
|
||||
|
||||
fun toString(): String = if (increment > 0) "$start..$end step $increment" else "$start downTo $end step ${-increment}"
|
||||
override fun toString(): String = if (increment > 0) "$start..$end step $increment" else "$start downTo $end step ${-increment}"
|
||||
}
|
||||
|
||||
public class DoubleProgression(
|
||||
@@ -157,6 +157,6 @@ public class DoubleProgression(
|
||||
return (31 * result + (temp xor (temp ushr 32))).toInt()
|
||||
}
|
||||
|
||||
fun toString(): String = if (increment > 0) "$start..$end step $increment" else "$start downTo $end step ${-increment}"
|
||||
override fun toString(): String = if (increment > 0) "$start..$end step $increment" else "$start downTo $end step ${-increment}"
|
||||
}
|
||||
|
||||
|
||||
@@ -23,5 +23,5 @@ public trait Range<T : Comparable<T>> {
|
||||
|
||||
public fun contains(item: T): Boolean
|
||||
|
||||
public fun toString(): String = "$start..$end"
|
||||
override fun toString(): String = "$start..$end"
|
||||
}
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
package jet
|
||||
|
||||
public class Unit private() {
|
||||
fun toString() = "Unit.VALUE"
|
||||
override fun toString() = "Unit.VALUE"
|
||||
|
||||
class object {
|
||||
public val VALUE: Unit = Unit()
|
||||
|
||||
+2
-2
@@ -49,13 +49,13 @@ abstract class LazyJavaType(storageManager: StorageManager) : AbstractJetType(),
|
||||
|
||||
override fun getAnnotations() = Annotations.EMPTY
|
||||
|
||||
override fun toString(): String? {
|
||||
override fun toString(): String {
|
||||
if (!_typeConstructor.isComputed()) {
|
||||
return "Type constructor is not computed"
|
||||
}
|
||||
if (!_arguments.isComputed()) {
|
||||
return "" + getConstructor() + "<arguments are not computed>"
|
||||
}
|
||||
return super<AbstractJetType>.toString()
|
||||
return super<AbstractJetType>.toString()!!
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user