Add toString() to Any, fix all tests
#KT-4517 Fixed
This commit is contained in:
@@ -100,6 +100,7 @@ public class IntrinsicMethods {
|
|||||||
declareIntrinsicFunction(typeName, Name.identifier("dec"), 0, DEC);
|
declareIntrinsicFunction(typeName, Name.identifier("dec"), 0, DEC);
|
||||||
declareIntrinsicFunction(typeName, Name.identifier("hashCode"), 0, HASH_CODE);
|
declareIntrinsicFunction(typeName, Name.identifier("hashCode"), 0, HASH_CODE);
|
||||||
declareIntrinsicFunction(typeName, Name.identifier("equals"), 1, EQUALS);
|
declareIntrinsicFunction(typeName, Name.identifier("equals"), 1, EQUALS);
|
||||||
|
declareIntrinsicFunction(typeName, Name.identifier("toString"), 0, TO_STRING);
|
||||||
}
|
}
|
||||||
|
|
||||||
declareBinaryOp(Name.identifier("plus"), IADD);
|
declareBinaryOp(Name.identifier("plus"), IADD);
|
||||||
@@ -116,6 +117,7 @@ public class IntrinsicMethods {
|
|||||||
|
|
||||||
declareIntrinsicFunction(Name.identifier("Boolean"), Name.identifier("not"), 0, new Not());
|
declareIntrinsicFunction(Name.identifier("Boolean"), Name.identifier("not"), 0, new Not());
|
||||||
declareIntrinsicFunction(Name.identifier("Boolean"), Name.identifier("equals"), 1, EQUALS);
|
declareIntrinsicFunction(Name.identifier("Boolean"), Name.identifier("equals"), 1, EQUALS);
|
||||||
|
declareIntrinsicFunction(Name.identifier("Boolean"), Name.identifier("toString"), 0, TO_STRING);
|
||||||
|
|
||||||
declareIntrinsicFunction(Name.identifier("String"), Name.identifier("plus"), 1, new Concat());
|
declareIntrinsicFunction(Name.identifier("String"), Name.identifier("plus"), 1, new Concat());
|
||||||
declareIntrinsicFunction(Name.identifier("CharSequence"), Name.identifier("get"), 1, new StringGetChar());
|
declareIntrinsicFunction(Name.identifier("CharSequence"), Name.identifier("get"), 1, new StringGetChar());
|
||||||
|
|||||||
+8
-4
@@ -30,7 +30,8 @@ class JavaToKotlinMethodMapGenerated {
|
|||||||
|
|
||||||
put(b, "java.lang.Object", "Any",
|
put(b, "java.lang.Object", "Any",
|
||||||
pair("equals(java.lang.Object)", "fun equals(other: jet.Any?): jet.Boolean"),
|
pair("equals(java.lang.Object)", "fun equals(other: jet.Any?): jet.Boolean"),
|
||||||
pair("hashCode()", "fun hashCode(): jet.Int")
|
pair("hashCode()", "fun hashCode(): jet.Int"),
|
||||||
|
pair("toString()", "fun toString(): jet.String")
|
||||||
);
|
);
|
||||||
|
|
||||||
put(b, "java.lang.String", "String",
|
put(b, "java.lang.String", "String",
|
||||||
@@ -47,7 +48,8 @@ class JavaToKotlinMethodMapGenerated {
|
|||||||
put(b, "java.lang.Throwable", "Throwable",
|
put(b, "java.lang.Throwable", "Throwable",
|
||||||
pair("getCause()", "fun getCause(): jet.Throwable?"),
|
pair("getCause()", "fun getCause(): jet.Throwable?"),
|
||||||
pair("getMessage()", "fun getMessage(): jet.String?"),
|
pair("getMessage()", "fun getMessage(): jet.String?"),
|
||||||
pair("printStackTrace()", "fun printStackTrace(): jet.Unit")
|
pair("printStackTrace()", "fun printStackTrace(): jet.Unit"),
|
||||||
|
pair("toString()", "fun toString(): jet.String")
|
||||||
);
|
);
|
||||||
|
|
||||||
put(b, "java.lang.Comparable", "Comparable",
|
put(b, "java.lang.Comparable", "Comparable",
|
||||||
@@ -58,12 +60,14 @@ class JavaToKotlinMethodMapGenerated {
|
|||||||
pair("equals(java.lang.Object)", "fun equals(other: jet.Any?): jet.Boolean"),
|
pair("equals(java.lang.Object)", "fun equals(other: jet.Any?): jet.Boolean"),
|
||||||
pair("hashCode()", "fun hashCode(): jet.Int"),
|
pair("hashCode()", "fun hashCode(): jet.Int"),
|
||||||
pair("name()", "fun name(): jet.String"),
|
pair("name()", "fun name(): jet.String"),
|
||||||
pair("ordinal()", "fun ordinal(): jet.Int")
|
pair("ordinal()", "fun ordinal(): jet.Int"),
|
||||||
|
pair("toString()", "fun toString(): jet.String")
|
||||||
);
|
);
|
||||||
|
|
||||||
put(b, "java.lang.annotation.Annotation", "Annotation",
|
put(b, "java.lang.annotation.Annotation", "Annotation",
|
||||||
pair("equals(java.lang.Object)", "fun equals(other: jet.Any?): jet.Boolean"),
|
pair("equals(java.lang.Object)", "fun equals(other: jet.Any?): jet.Boolean"),
|
||||||
pair("hashCode()", "fun hashCode(): jet.Int")
|
pair("hashCode()", "fun hashCode(): jet.Int"),
|
||||||
|
pair("toString()", "fun toString(): jet.String")
|
||||||
);
|
);
|
||||||
|
|
||||||
put(b, "java.lang.Iterable", "Iterable",
|
put(b, "java.lang.Iterable", "Iterable",
|
||||||
|
|||||||
@@ -27,6 +27,7 @@ private val emptyUnaryFun: Function1<Long, Long> = { a -> 1.toLong() }
|
|||||||
private val unaryOperations: HashMap<UnaryOperationKey<*>, Pair<Function1<Any?, Any>, Function1<Long, Long>>>
|
private val unaryOperations: HashMap<UnaryOperationKey<*>, Pair<Function1<Any?, Any>, Function1<Long, Long>>>
|
||||||
= hashMapOf<UnaryOperationKey<*>, Pair<Function1<Any?, Any>, Function1<Long, Long>>>(
|
= hashMapOf<UnaryOperationKey<*>, Pair<Function1<Any?, Any>, Function1<Long, Long>>>(
|
||||||
unaryOperation(BOOLEAN, "not", { a -> a.not() }, emptyUnaryFun),
|
unaryOperation(BOOLEAN, "not", { a -> a.not() }, emptyUnaryFun),
|
||||||
|
unaryOperation(BOOLEAN, "toString", { a -> a.toString() }, emptyUnaryFun),
|
||||||
unaryOperation(BYTE, "toInt", { a -> a.toInt() }, emptyUnaryFun),
|
unaryOperation(BYTE, "toInt", { a -> a.toInt() }, emptyUnaryFun),
|
||||||
unaryOperation(BYTE, "minus", { a -> a.minus() }, { a -> a.minus() }),
|
unaryOperation(BYTE, "minus", { a -> a.minus() }, { a -> a.minus() }),
|
||||||
unaryOperation(BYTE, "toChar", { a -> a.toChar() }, emptyUnaryFun),
|
unaryOperation(BYTE, "toChar", { a -> a.toChar() }, emptyUnaryFun),
|
||||||
@@ -36,6 +37,7 @@ private val unaryOperations: HashMap<UnaryOperationKey<*>, Pair<Function1<Any?,
|
|||||||
unaryOperation(BYTE, "toFloat", { a -> a.toFloat() }, emptyUnaryFun),
|
unaryOperation(BYTE, "toFloat", { a -> a.toFloat() }, emptyUnaryFun),
|
||||||
unaryOperation(BYTE, "toShort", { a -> a.toShort() }, emptyUnaryFun),
|
unaryOperation(BYTE, "toShort", { a -> a.toShort() }, emptyUnaryFun),
|
||||||
unaryOperation(BYTE, "toByte", { a -> a.toByte() }, emptyUnaryFun),
|
unaryOperation(BYTE, "toByte", { a -> a.toByte() }, emptyUnaryFun),
|
||||||
|
unaryOperation(BYTE, "toString", { a -> a.toString() }, emptyUnaryFun),
|
||||||
unaryOperation(CHAR, "toInt", { a -> a.toInt() }, emptyUnaryFun),
|
unaryOperation(CHAR, "toInt", { a -> a.toInt() }, emptyUnaryFun),
|
||||||
unaryOperation(CHAR, "minus", { a -> a.minus() }, emptyUnaryFun),
|
unaryOperation(CHAR, "minus", { a -> a.minus() }, emptyUnaryFun),
|
||||||
unaryOperation(CHAR, "toChar", { a -> a.toChar() }, emptyUnaryFun),
|
unaryOperation(CHAR, "toChar", { a -> a.toChar() }, emptyUnaryFun),
|
||||||
@@ -45,6 +47,7 @@ private val unaryOperations: HashMap<UnaryOperationKey<*>, Pair<Function1<Any?,
|
|||||||
unaryOperation(CHAR, "toFloat", { a -> a.toFloat() }, emptyUnaryFun),
|
unaryOperation(CHAR, "toFloat", { a -> a.toFloat() }, emptyUnaryFun),
|
||||||
unaryOperation(CHAR, "toShort", { a -> a.toShort() }, emptyUnaryFun),
|
unaryOperation(CHAR, "toShort", { a -> a.toShort() }, emptyUnaryFun),
|
||||||
unaryOperation(CHAR, "toByte", { a -> a.toByte() }, emptyUnaryFun),
|
unaryOperation(CHAR, "toByte", { a -> a.toByte() }, emptyUnaryFun),
|
||||||
|
unaryOperation(CHAR, "toString", { a -> a.toString() }, emptyUnaryFun),
|
||||||
unaryOperation(DOUBLE, "toInt", { a -> a.toInt() }, emptyUnaryFun),
|
unaryOperation(DOUBLE, "toInt", { a -> a.toInt() }, emptyUnaryFun),
|
||||||
unaryOperation(DOUBLE, "minus", { a -> a.minus() }, emptyUnaryFun),
|
unaryOperation(DOUBLE, "minus", { a -> a.minus() }, emptyUnaryFun),
|
||||||
unaryOperation(DOUBLE, "toChar", { a -> a.toChar() }, emptyUnaryFun),
|
unaryOperation(DOUBLE, "toChar", { a -> a.toChar() }, emptyUnaryFun),
|
||||||
@@ -54,6 +57,7 @@ private val unaryOperations: HashMap<UnaryOperationKey<*>, Pair<Function1<Any?,
|
|||||||
unaryOperation(DOUBLE, "toFloat", { a -> a.toFloat() }, emptyUnaryFun),
|
unaryOperation(DOUBLE, "toFloat", { a -> a.toFloat() }, emptyUnaryFun),
|
||||||
unaryOperation(DOUBLE, "toShort", { a -> a.toShort() }, emptyUnaryFun),
|
unaryOperation(DOUBLE, "toShort", { a -> a.toShort() }, emptyUnaryFun),
|
||||||
unaryOperation(DOUBLE, "toByte", { a -> a.toByte() }, emptyUnaryFun),
|
unaryOperation(DOUBLE, "toByte", { a -> a.toByte() }, emptyUnaryFun),
|
||||||
|
unaryOperation(DOUBLE, "toString", { a -> a.toString() }, emptyUnaryFun),
|
||||||
unaryOperation(FLOAT, "toInt", { a -> a.toInt() }, emptyUnaryFun),
|
unaryOperation(FLOAT, "toInt", { a -> a.toInt() }, emptyUnaryFun),
|
||||||
unaryOperation(FLOAT, "minus", { a -> a.minus() }, emptyUnaryFun),
|
unaryOperation(FLOAT, "minus", { a -> a.minus() }, emptyUnaryFun),
|
||||||
unaryOperation(FLOAT, "toChar", { a -> a.toChar() }, emptyUnaryFun),
|
unaryOperation(FLOAT, "toChar", { a -> a.toChar() }, emptyUnaryFun),
|
||||||
@@ -63,6 +67,7 @@ private val unaryOperations: HashMap<UnaryOperationKey<*>, Pair<Function1<Any?,
|
|||||||
unaryOperation(FLOAT, "toFloat", { a -> a.toFloat() }, emptyUnaryFun),
|
unaryOperation(FLOAT, "toFloat", { a -> a.toFloat() }, emptyUnaryFun),
|
||||||
unaryOperation(FLOAT, "toShort", { a -> a.toShort() }, emptyUnaryFun),
|
unaryOperation(FLOAT, "toShort", { a -> a.toShort() }, emptyUnaryFun),
|
||||||
unaryOperation(FLOAT, "toByte", { a -> a.toByte() }, emptyUnaryFun),
|
unaryOperation(FLOAT, "toByte", { a -> a.toByte() }, emptyUnaryFun),
|
||||||
|
unaryOperation(FLOAT, "toString", { a -> a.toString() }, emptyUnaryFun),
|
||||||
unaryOperation(INT, "inv", { a -> a.inv() }, emptyUnaryFun),
|
unaryOperation(INT, "inv", { a -> a.inv() }, emptyUnaryFun),
|
||||||
unaryOperation(INT, "toInt", { a -> a.toInt() }, emptyUnaryFun),
|
unaryOperation(INT, "toInt", { a -> a.toInt() }, emptyUnaryFun),
|
||||||
unaryOperation(INT, "minus", { a -> a.minus() }, { a -> a.minus() }),
|
unaryOperation(INT, "minus", { a -> a.minus() }, { a -> a.minus() }),
|
||||||
@@ -73,6 +78,7 @@ private val unaryOperations: HashMap<UnaryOperationKey<*>, Pair<Function1<Any?,
|
|||||||
unaryOperation(INT, "toDouble", { a -> a.toDouble() }, emptyUnaryFun),
|
unaryOperation(INT, "toDouble", { a -> a.toDouble() }, emptyUnaryFun),
|
||||||
unaryOperation(INT, "toShort", { a -> a.toShort() }, emptyUnaryFun),
|
unaryOperation(INT, "toShort", { a -> a.toShort() }, emptyUnaryFun),
|
||||||
unaryOperation(INT, "toByte", { a -> a.toByte() }, emptyUnaryFun),
|
unaryOperation(INT, "toByte", { a -> a.toByte() }, emptyUnaryFun),
|
||||||
|
unaryOperation(INT, "toString", { a -> a.toString() }, emptyUnaryFun),
|
||||||
unaryOperation(LONG, "inv", { a -> a.inv() }, emptyUnaryFun),
|
unaryOperation(LONG, "inv", { a -> a.inv() }, emptyUnaryFun),
|
||||||
unaryOperation(LONG, "toInt", { a -> a.toInt() }, emptyUnaryFun),
|
unaryOperation(LONG, "toInt", { a -> a.toInt() }, emptyUnaryFun),
|
||||||
unaryOperation(LONG, "minus", { a -> a.minus() }, { a -> a.minus() }),
|
unaryOperation(LONG, "minus", { a -> a.minus() }, { a -> a.minus() }),
|
||||||
@@ -83,6 +89,7 @@ private val unaryOperations: HashMap<UnaryOperationKey<*>, Pair<Function1<Any?,
|
|||||||
unaryOperation(LONG, "toDouble", { a -> a.toDouble() }, emptyUnaryFun),
|
unaryOperation(LONG, "toDouble", { a -> a.toDouble() }, emptyUnaryFun),
|
||||||
unaryOperation(LONG, "toShort", { a -> a.toShort() }, emptyUnaryFun),
|
unaryOperation(LONG, "toShort", { a -> a.toShort() }, emptyUnaryFun),
|
||||||
unaryOperation(LONG, "toByte", { a -> a.toByte() }, emptyUnaryFun),
|
unaryOperation(LONG, "toByte", { a -> a.toByte() }, emptyUnaryFun),
|
||||||
|
unaryOperation(LONG, "toString", { a -> a.toString() }, emptyUnaryFun),
|
||||||
unaryOperation(SHORT, "toInt", { a -> a.toInt() }, emptyUnaryFun),
|
unaryOperation(SHORT, "toInt", { a -> a.toInt() }, emptyUnaryFun),
|
||||||
unaryOperation(SHORT, "minus", { a -> a.minus() }, { a -> a.minus() }),
|
unaryOperation(SHORT, "minus", { a -> a.minus() }, { a -> a.minus() }),
|
||||||
unaryOperation(SHORT, "toChar", { a -> a.toChar() }, emptyUnaryFun),
|
unaryOperation(SHORT, "toChar", { a -> a.toChar() }, emptyUnaryFun),
|
||||||
@@ -92,6 +99,7 @@ private val unaryOperations: HashMap<UnaryOperationKey<*>, Pair<Function1<Any?,
|
|||||||
unaryOperation(SHORT, "toFloat", { a -> a.toFloat() }, emptyUnaryFun),
|
unaryOperation(SHORT, "toFloat", { a -> a.toFloat() }, emptyUnaryFun),
|
||||||
unaryOperation(SHORT, "toShort", { a -> a.toShort() }, emptyUnaryFun),
|
unaryOperation(SHORT, "toShort", { a -> a.toShort() }, emptyUnaryFun),
|
||||||
unaryOperation(SHORT, "toByte", { a -> a.toByte() }, emptyUnaryFun),
|
unaryOperation(SHORT, "toByte", { a -> a.toByte() }, emptyUnaryFun),
|
||||||
|
unaryOperation(SHORT, "toString", { a -> a.toString() }, emptyUnaryFun),
|
||||||
unaryOperation(STRING, "toString", { a -> a.toString() }, emptyUnaryFun)
|
unaryOperation(STRING, "toString", { a -> a.toString() }, emptyUnaryFun)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
trait Trait {
|
trait Trait {
|
||||||
fun foo() = "O"
|
fun foo() = "O"
|
||||||
fun toString() = "K"
|
override fun toString() = "K"
|
||||||
}
|
}
|
||||||
|
|
||||||
class SimpleClass : Trait
|
class SimpleClass : Trait
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
class mInt(val i : Int) {
|
class mInt(val i : Int) {
|
||||||
fun toString() : String = "mint: $i"
|
override fun toString() : String = "mint: $i"
|
||||||
fun plus(i : Int) = mInt(this.i + i)
|
fun plus(i : Int) = mInt(this.i + i)
|
||||||
fun inc() = mInt(i + 1)
|
fun inc() = mInt(i + 1)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ class MyString {
|
|||||||
return this
|
return this
|
||||||
}
|
}
|
||||||
|
|
||||||
fun toString(): String {
|
override fun toString(): String {
|
||||||
return s
|
return s
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ class MyString {
|
|||||||
return this
|
return this
|
||||||
}
|
}
|
||||||
|
|
||||||
fun toString(): String {
|
override fun toString(): String {
|
||||||
return s
|
return s
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ class MyString {
|
|||||||
return this
|
return this
|
||||||
}
|
}
|
||||||
|
|
||||||
fun toString(): String {
|
override fun toString(): String {
|
||||||
return s
|
return s
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ class MyString {
|
|||||||
return this
|
return this
|
||||||
}
|
}
|
||||||
|
|
||||||
fun toString(): String {
|
override fun toString(): String {
|
||||||
return s
|
return s
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ class A {
|
|||||||
|
|
||||||
{
|
{
|
||||||
a = object {
|
a = object {
|
||||||
fun toString(): String = "OK"
|
override fun toString(): String = "OK"
|
||||||
}.toString()
|
}.toString()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
class A(
|
class A(
|
||||||
val a: String = object {
|
val a: String = object {
|
||||||
fun toString(): String = "OK"
|
override fun toString(): String = "OK"
|
||||||
}.toString()
|
}.toString()
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ package pack
|
|||||||
open class A(val value: String )
|
open class A(val value: String )
|
||||||
|
|
||||||
class B(value: String) : A(value) {
|
class B(value: String) : A(value) {
|
||||||
fun toString() = "B($value)";
|
override fun toString() = "B($value)";
|
||||||
}
|
}
|
||||||
|
|
||||||
fun box() = if (B("4").toString() == "B(4)") "OK" else "fail"
|
fun box() = if (B("4").toString() == "B(4)") "OK" else "fail"
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ class JsonArray {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class ProjectInfo {
|
class ProjectInfo {
|
||||||
public fun toString(): String = "OK"
|
override fun toString(): String = "OK"
|
||||||
}
|
}
|
||||||
|
|
||||||
public trait Parser<in IN: Any, out OUT: Any> {
|
public trait Parser<in IN: Any, out OUT: Any> {
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ trait Trait : Base {
|
|||||||
private val value : String
|
private val value : String
|
||||||
get() = "OK"
|
get() = "OK"
|
||||||
|
|
||||||
fun toString() = object {
|
override fun toString() = object {
|
||||||
fun foo() = value
|
fun foo() = value
|
||||||
}.foo()
|
}.foo()
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
data class A(val x: Int) {
|
data class A(val x: Int) {
|
||||||
fun toString(): String = "!"
|
override fun toString(): String = "!"
|
||||||
}
|
}
|
||||||
|
|
||||||
fun box(): String {
|
fun box(): String {
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
trait SuperTrait {
|
trait SuperTrait {
|
||||||
public fun toString(): String = "!"
|
override fun toString(): String = "!"
|
||||||
}
|
}
|
||||||
|
|
||||||
data class A(val x: Int): SuperTrait {
|
data class A(val x: Int): SuperTrait {
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ import java.util.ArrayList
|
|||||||
public class User(val firstName: String,
|
public class User(val firstName: String,
|
||||||
val lastName: String,
|
val lastName: String,
|
||||||
val age: Int) {
|
val age: Int) {
|
||||||
fun toString() = "$firstName $lastName, age $age"
|
override fun toString() = "$firstName $lastName, age $age"
|
||||||
}
|
}
|
||||||
|
|
||||||
public fun <T: Comparable<T>> Collection<T>.testMin(): T? {
|
public fun <T: Comparable<T>> Collection<T>.testMin(): T? {
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
class A(private var v1: String) {
|
class A(private var v1: String) {
|
||||||
private var v2 = v1
|
private var v2 = v1
|
||||||
fun toString(): String { return "A[v1=$v1,v2=$v2]" }
|
override fun toString(): String { return "A[v1=$v1,v2=$v2]" }
|
||||||
}
|
}
|
||||||
@@ -52,7 +52,7 @@ fun main(args : Array<String>) {
|
|||||||
trait Element {
|
trait Element {
|
||||||
fun render(builder : StringBuilder, indent : String)
|
fun render(builder : StringBuilder, indent : String)
|
||||||
|
|
||||||
fun toString() : String? {
|
override fun toString() : String {
|
||||||
val builder = StringBuilder()
|
val builder = StringBuilder()
|
||||||
render(builder, "")
|
render(builder, "")
|
||||||
return builder.toString()
|
return builder.toString()
|
||||||
|
|||||||
@@ -183,7 +183,7 @@ fun returnFunctionLiteral(a: Any?): Function0<Int> =
|
|||||||
fun mergeAutocasts(a: Any?) {
|
fun mergeAutocasts(a: Any?) {
|
||||||
if (a is String || a is Int) {
|
if (a is String || a is Int) {
|
||||||
a.<!UNRESOLVED_REFERENCE!>compareTo<!>("")
|
a.<!UNRESOLVED_REFERENCE!>compareTo<!>("")
|
||||||
a.toString()
|
<!DEBUG_INFO_AUTOCAST!>a<!>.toString()
|
||||||
}
|
}
|
||||||
if (a is Int || a is String) {
|
if (a is Int || a is String) {
|
||||||
a.<!UNRESOLVED_REFERENCE!>compareTo<!>("")
|
a.<!UNRESOLVED_REFERENCE!>compareTo<!>("")
|
||||||
|
|||||||
@@ -1,3 +1,3 @@
|
|||||||
class Test(private val a: Int b: Int private val c: Int) {
|
class Test(private val a: Int b: Int private val c: Int) {
|
||||||
fun toString() = "$a $c"
|
override fun toString() = "$a $c"
|
||||||
}
|
}
|
||||||
@@ -53,6 +53,9 @@ JetFile: MissingCommaInConstructorValueParameterList.kt
|
|||||||
PsiElement(LBRACE)('{')
|
PsiElement(LBRACE)('{')
|
||||||
PsiWhiteSpace('\n ')
|
PsiWhiteSpace('\n ')
|
||||||
FUN
|
FUN
|
||||||
|
MODIFIER_LIST
|
||||||
|
PsiElement(override)('override')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
PsiElement(fun)('fun')
|
PsiElement(fun)('fun')
|
||||||
PsiWhiteSpace(' ')
|
PsiWhiteSpace(' ')
|
||||||
PsiElement(IDENTIFIER)('toString')
|
PsiElement(IDENTIFIER)('toString')
|
||||||
|
|||||||
@@ -52,33 +52,44 @@ Trait:ClassDescriptorWithResolutionScopes
|
|||||||
a:ValueParameterDescriptor
|
a:ValueParameterDescriptor
|
||||||
fake <class-object-for-Class>.equals:SimpleFunctionDescriptor
|
fake <class-object-for-Class>.equals:SimpleFunctionDescriptor
|
||||||
fake <class-object-for-Class>.hashCode:SimpleFunctionDescriptor
|
fake <class-object-for-Class>.hashCode:SimpleFunctionDescriptor
|
||||||
|
fake <class-object-for-Class>.toString:SimpleFunctionDescriptor
|
||||||
fake <class-object-for-NestedClass>.equals:SimpleFunctionDescriptor
|
fake <class-object-for-NestedClass>.equals:SimpleFunctionDescriptor
|
||||||
fake <class-object-for-NestedClass>.hashCode:SimpleFunctionDescriptor
|
fake <class-object-for-NestedClass>.hashCode:SimpleFunctionDescriptor
|
||||||
|
fake <class-object-for-NestedClass>.toString:SimpleFunctionDescriptor
|
||||||
fake <class-object-for-NestedObject>.equals:SimpleFunctionDescriptor
|
fake <class-object-for-NestedObject>.equals:SimpleFunctionDescriptor
|
||||||
fake <class-object-for-NestedObject>.hashCode:SimpleFunctionDescriptor
|
fake <class-object-for-NestedObject>.hashCode:SimpleFunctionDescriptor
|
||||||
fake <class-object-for-NestedObject>.nestedFunc:SimpleFunctionDescriptor
|
fake <class-object-for-NestedObject>.nestedFunc:SimpleFunctionDescriptor
|
||||||
|
fake <class-object-for-NestedObject>.toString:SimpleFunctionDescriptor
|
||||||
fake <class-object-for-Object>.<get-objProp>:PropertyGetterDescriptor
|
fake <class-object-for-Object>.<get-objProp>:PropertyGetterDescriptor
|
||||||
fake <class-object-for-Object>.equals:SimpleFunctionDescriptor
|
fake <class-object-for-Object>.equals:SimpleFunctionDescriptor
|
||||||
fake <class-object-for-Object>.hashCode:SimpleFunctionDescriptor
|
fake <class-object-for-Object>.hashCode:SimpleFunctionDescriptor
|
||||||
fake <class-object-for-Object>.objFunc:SimpleFunctionDescriptor
|
fake <class-object-for-Object>.objFunc:SimpleFunctionDescriptor
|
||||||
fake <class-object-for-Object>.objProp:PropertyDescriptor
|
fake <class-object-for-Object>.objProp:PropertyDescriptor
|
||||||
|
fake <class-object-for-Object>.toString:SimpleFunctionDescriptor
|
||||||
fake Class.<get-traitProp>:PropertyGetterDescriptor
|
fake Class.<get-traitProp>:PropertyGetterDescriptor
|
||||||
fake Class.equals:SimpleFunctionDescriptor
|
fake Class.equals:SimpleFunctionDescriptor
|
||||||
fake Class.hashCode:SimpleFunctionDescriptor
|
fake Class.hashCode:SimpleFunctionDescriptor
|
||||||
|
fake Class.toString:SimpleFunctionDescriptor
|
||||||
fake Class.traitFunc:SimpleFunctionDescriptor
|
fake Class.traitFunc:SimpleFunctionDescriptor
|
||||||
fake Class.traitProp:PropertyDescriptor
|
fake Class.traitProp:PropertyDescriptor
|
||||||
fake NestedClass.equals:SimpleFunctionDescriptor
|
fake NestedClass.equals:SimpleFunctionDescriptor
|
||||||
fake NestedClass.hashCode:SimpleFunctionDescriptor
|
fake NestedClass.hashCode:SimpleFunctionDescriptor
|
||||||
|
fake NestedClass.toString:SimpleFunctionDescriptor
|
||||||
fake NestedObject.equals:SimpleFunctionDescriptor
|
fake NestedObject.equals:SimpleFunctionDescriptor
|
||||||
fake NestedObject.hashCode:SimpleFunctionDescriptor
|
fake NestedObject.hashCode:SimpleFunctionDescriptor
|
||||||
|
fake NestedObject.toString:SimpleFunctionDescriptor
|
||||||
fake NestedTrait.equals:SimpleFunctionDescriptor
|
fake NestedTrait.equals:SimpleFunctionDescriptor
|
||||||
fake NestedTrait.hashCode:SimpleFunctionDescriptor
|
fake NestedTrait.hashCode:SimpleFunctionDescriptor
|
||||||
|
fake NestedTrait.toString:SimpleFunctionDescriptor
|
||||||
fake Object.equals:SimpleFunctionDescriptor
|
fake Object.equals:SimpleFunctionDescriptor
|
||||||
fake Object.hashCode:SimpleFunctionDescriptor
|
fake Object.hashCode:SimpleFunctionDescriptor
|
||||||
|
fake Object.toString:SimpleFunctionDescriptor
|
||||||
fake Outer.equals:SimpleFunctionDescriptor
|
fake Outer.equals:SimpleFunctionDescriptor
|
||||||
fake Outer.hashCode:SimpleFunctionDescriptor
|
fake Outer.hashCode:SimpleFunctionDescriptor
|
||||||
|
fake Outer.toString:SimpleFunctionDescriptor
|
||||||
fake Trait.equals:SimpleFunctionDescriptor
|
fake Trait.equals:SimpleFunctionDescriptor
|
||||||
fake Trait.hashCode:SimpleFunctionDescriptor
|
fake Trait.hashCode:SimpleFunctionDescriptor
|
||||||
|
fake Trait.toString:SimpleFunctionDescriptor
|
||||||
func.this:ReceiverParameterDescriptor
|
func.this:ReceiverParameterDescriptor
|
||||||
innerTest.<get-prop>:PropertyGetterDescriptor
|
innerTest.<get-prop>:PropertyGetterDescriptor
|
||||||
innerTest.<get-propVar>:PropertyGetterDescriptor
|
innerTest.<get-propVar>:PropertyGetterDescriptor
|
||||||
|
|||||||
@@ -4,4 +4,6 @@ public open class Any {
|
|||||||
public open fun equals(other: Any?): Boolean
|
public open fun equals(other: Any?): Boolean
|
||||||
|
|
||||||
public open fun hashCode(): Int
|
public open fun hashCode(): Int
|
||||||
|
|
||||||
|
public open fun toString(): String
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -35,8 +35,6 @@ public trait CharSequence {
|
|||||||
public fun get(index : Int) : Char
|
public fun get(index : Int) : Char
|
||||||
|
|
||||||
public val length : Int
|
public val length : Int
|
||||||
|
|
||||||
public fun toString() : String
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public class String() : Comparable<String>, CharSequence {
|
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 compareTo(that : String) : Int
|
||||||
public override fun get(index : Int) : Char
|
public override fun get(index : Int) : Char
|
||||||
public override fun toString() : String
|
|
||||||
public override val length: Int
|
public override val length: Int
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ public class ByteProgression(
|
|||||||
|
|
||||||
override fun hashCode(): Int = 31 * (31 * start.toInt() + end) + increment
|
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(
|
public class CharProgression(
|
||||||
@@ -53,7 +53,7 @@ public class CharProgression(
|
|||||||
|
|
||||||
override fun hashCode(): Int = 31 * (31 * start.toInt() + end) + increment
|
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(
|
public class ShortProgression(
|
||||||
@@ -72,7 +72,7 @@ public class ShortProgression(
|
|||||||
|
|
||||||
override fun hashCode(): Int = 31 * (31 * start.toInt() + end) + increment
|
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(
|
public class IntProgression(
|
||||||
@@ -91,7 +91,7 @@ public class IntProgression(
|
|||||||
|
|
||||||
override fun hashCode(): Int = 31 * (31 * start + end) + increment
|
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(
|
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()
|
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(
|
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)
|
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(
|
public class DoubleProgression(
|
||||||
@@ -157,6 +157,6 @@ public class DoubleProgression(
|
|||||||
return (31 * result + (temp xor (temp ushr 32))).toInt()
|
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 contains(item: T): Boolean
|
||||||
|
|
||||||
public fun toString(): String = "$start..$end"
|
override fun toString(): String = "$start..$end"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,7 +17,7 @@
|
|||||||
package jet
|
package jet
|
||||||
|
|
||||||
public class Unit private() {
|
public class Unit private() {
|
||||||
fun toString() = "Unit.VALUE"
|
override fun toString() = "Unit.VALUE"
|
||||||
|
|
||||||
class object {
|
class object {
|
||||||
public val VALUE: Unit = Unit()
|
public val VALUE: Unit = Unit()
|
||||||
|
|||||||
+2
-2
@@ -49,13 +49,13 @@ abstract class LazyJavaType(storageManager: StorageManager) : AbstractJetType(),
|
|||||||
|
|
||||||
override fun getAnnotations() = Annotations.EMPTY
|
override fun getAnnotations() = Annotations.EMPTY
|
||||||
|
|
||||||
override fun toString(): String? {
|
override fun toString(): String {
|
||||||
if (!_typeConstructor.isComputed()) {
|
if (!_typeConstructor.isComputed()) {
|
||||||
return "Type constructor is not computed"
|
return "Type constructor is not computed"
|
||||||
}
|
}
|
||||||
if (!_arguments.isComputed()) {
|
if (!_arguments.isComputed()) {
|
||||||
return "" + getConstructor() + "<arguments are not computed>"
|
return "" + getConstructor() + "<arguments are not computed>"
|
||||||
}
|
}
|
||||||
return super<AbstractJetType>.toString()
|
return super<AbstractJetType>.toString()!!
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -76,7 +76,7 @@ class GenerateProgressions(out: PrintWriter) : BuiltInsSourceGenerator(out) {
|
|||||||
|
|
||||||
override fun hashCode(): Int $hashCode
|
override fun hashCode(): Int $hashCode
|
||||||
|
|
||||||
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}\""}
|
||||||
}""")
|
}""")
|
||||||
out.println()
|
out.println()
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -179,7 +179,7 @@ fun returnFunctionLiteral(<info>a</info>: Any?): Function0<Int> =
|
|||||||
fun merge<TYPO descr="Typo: In word 'Autocasts'">Autocasts</TYPO>(a: Any?) {
|
fun merge<TYPO descr="Typo: In word 'Autocasts'">Autocasts</TYPO>(a: Any?) {
|
||||||
if (a is String || a is Int) {
|
if (a is String || a is Int) {
|
||||||
a.<error descr="[UNRESOLVED_REFERENCE] Unresolved reference: compareTo">compareTo</error>("")
|
a.<error descr="[UNRESOLVED_REFERENCE] Unresolved reference: compareTo">compareTo</error>("")
|
||||||
a.toString()
|
<info descr="Automatically cast to jet.Any"><info>a</info></info>.toString()
|
||||||
}
|
}
|
||||||
if (a is Int || a is String) {
|
if (a is Int || a is String) {
|
||||||
a.<error descr="[UNRESOLVED_REFERENCE] Unresolved reference: compareTo">compareTo</error>("")
|
a.<error descr="[UNRESOLVED_REFERENCE] Unresolved reference: compareTo">compareTo</error>("")
|
||||||
|
|||||||
@@ -19,4 +19,7 @@ class C : Base<String, C, Unit>() {
|
|||||||
return super<Base>.hashCode()
|
return super<Base>.hashCode()
|
||||||
}
|
}
|
||||||
override val method: (String?) -> String = ?
|
override val method: (String?) -> String = ?
|
||||||
|
override fun toString(): String {
|
||||||
|
return super<Base>.toString()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -30,4 +30,7 @@ class C : A(), B {
|
|||||||
super<A>.publicFun()
|
super<A>.publicFun()
|
||||||
}
|
}
|
||||||
override val publicProperty: Int = 0
|
override val publicProperty: Int = 0
|
||||||
|
override fun toString(): String {
|
||||||
|
return super<A>.toString()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,4 +17,7 @@ class C : A {
|
|||||||
override fun hashCode(): Int {
|
override fun hashCode(): Int {
|
||||||
return super<A>.hashCode()
|
return super<A>.hashCode()
|
||||||
}
|
}
|
||||||
|
override fun toString(): String {
|
||||||
|
return super<A>.toString()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,6 +16,9 @@ class C : A() {
|
|||||||
override fun hashCode(): Int {
|
override fun hashCode(): Int {
|
||||||
return super<A>.hashCode()
|
return super<A>.hashCode()
|
||||||
}
|
}
|
||||||
|
override fun toString(): String {
|
||||||
|
return super<A>.toString()
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Some another comment
|
Some another comment
|
||||||
|
|||||||
@@ -1,2 +1,2 @@
|
|||||||
val x = 5.<ref>toString()
|
val x = 5.<ref>toString()
|
||||||
//jet/Library.kt:toString
|
//jet/Any.kt:toString
|
||||||
|
|||||||
@@ -51,5 +51,5 @@ public class StringBuilder() : Appendable {
|
|||||||
//TODO
|
//TODO
|
||||||
//override fun append(csq: CharSequence?, start: Int, end: Int): StringBuilder = js.noImpl
|
//override fun append(csq: CharSequence?, start: Int, end: Int): StringBuilder = js.noImpl
|
||||||
public fun append(obj: Any?): StringBuilder = js.noImpl
|
public fun append(obj: Any?): StringBuilder = js.noImpl
|
||||||
public fun toString(): String = js.noImpl
|
override fun toString(): String = js.noImpl
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -49,7 +49,7 @@ public abstract class AbstractList<E>() : AbstractCollection<E>(), MutableList<E
|
|||||||
|
|
||||||
override fun equals(other: Any?): Boolean = js.noImpl
|
override fun equals(other: Any?): Boolean = js.noImpl
|
||||||
|
|
||||||
fun toString(): String = js.noImpl
|
override fun toString(): String = js.noImpl
|
||||||
}
|
}
|
||||||
|
|
||||||
library
|
library
|
||||||
|
|||||||
@@ -8,8 +8,7 @@ public class Pair<A, B> (
|
|||||||
public fun component1(): A = first
|
public fun component1(): A = first
|
||||||
public fun component2(): B = second
|
public fun component2(): B = second
|
||||||
|
|
||||||
public fun toString(): String = "($first, $second)"
|
override fun toString(): String = "($first, $second)"
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public class Triple<A, B, C> (
|
public class Triple<A, B, C> (
|
||||||
@@ -21,5 +20,5 @@ public class Triple<A, B, C> (
|
|||||||
public fun component2(): B = second
|
public fun component2(): B = second
|
||||||
public fun component3(): C = third
|
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 constructSafeCallIsNeeded(result: JsExpression): JsExpression
|
||||||
|
|
||||||
fun toString(): String {
|
override fun toString(): String {
|
||||||
val location = DiagnosticUtils.atLocation(context.bindingContext(), callableDescriptor)
|
val location = DiagnosticUtils.atLocation(context.bindingContext(), callableDescriptor)
|
||||||
val name = callableDescriptor.getName().asString()
|
val name = callableDescriptor.getName().asString()
|
||||||
return "callableDescriptor: $name at $location; thisObject: $thisObject; receiverObject: $receiverObject"
|
return "callableDescriptor: $name at $location; thisObject: $thisObject; receiverObject: $receiverObject"
|
||||||
|
|||||||
@@ -7,13 +7,13 @@ public fun toString(): String = ""
|
|||||||
public class PublicClass {
|
public class PublicClass {
|
||||||
override fun equals(a: Any?): Boolean = this.identityEquals(a)
|
override fun equals(a: Any?): Boolean = this.identityEquals(a)
|
||||||
override fun hashCode(): Int = 0
|
override fun hashCode(): Int = 0
|
||||||
public fun toString(): String = "PublicClass"
|
override fun toString(): String = "PublicClass"
|
||||||
}
|
}
|
||||||
|
|
||||||
internal class InternalClass {
|
internal class InternalClass {
|
||||||
override fun equals(a: Any?): Boolean = this.identityEquals(a)
|
override fun equals(a: Any?): Boolean = this.identityEquals(a)
|
||||||
override fun hashCode(): Int = 1
|
override fun hashCode(): Int = 1
|
||||||
public fun toString(): String = "InternalClass"
|
override fun toString(): String = "InternalClass"
|
||||||
|
|
||||||
// overloads
|
// overloads
|
||||||
public fun equals(a: Any?, b: Any?): Boolean = a == b
|
public fun equals(a: Any?, b: Any?): Boolean = a == b
|
||||||
@@ -24,7 +24,7 @@ internal class InternalClass {
|
|||||||
private class PrivateClass {
|
private class PrivateClass {
|
||||||
override fun equals(a: Any?): Boolean = this.identityEquals(a)
|
override fun equals(a: Any?): Boolean = this.identityEquals(a)
|
||||||
override fun hashCode(): Int = 2
|
override fun hashCode(): Int = 2
|
||||||
public fun toString(): String = "InternalClass"
|
override fun toString(): String = "InternalClass"
|
||||||
|
|
||||||
// overloads
|
// overloads
|
||||||
public fun equals(a: Any?, b: Any?): Boolean = a == b
|
public fun equals(a: Any?, b: Any?): Boolean = a == b
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ package foo
|
|||||||
var i = 0
|
var i = 0
|
||||||
|
|
||||||
class A() {
|
class A() {
|
||||||
fun toString(): String {
|
override fun toString(): String {
|
||||||
i++
|
i++
|
||||||
return "bar"
|
return "bar"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
package foo
|
package foo
|
||||||
|
|
||||||
class A(var i : Int) {
|
class A(var i : Int) {
|
||||||
fun toString() = "a$i"
|
override fun toString() = "a$i"
|
||||||
}
|
}
|
||||||
|
|
||||||
fun box() : Boolean {
|
fun box() : Boolean {
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
package foo
|
package foo
|
||||||
|
|
||||||
class Foo(val name: String) {
|
class Foo(val name: String) {
|
||||||
public fun toString(): String {
|
override fun toString(): String {
|
||||||
return name + "S"
|
return name + "S"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -48,7 +48,7 @@ fun main(args: Array<String>) {
|
|||||||
trait Element {
|
trait Element {
|
||||||
fun render(builder: StringBuilder, indent: String)
|
fun render(builder: StringBuilder, indent: String)
|
||||||
|
|
||||||
fun toString(): String? {
|
override fun toString(): String {
|
||||||
val builder = StringBuilder()
|
val builder = StringBuilder()
|
||||||
render(builder, "")
|
render(builder, "")
|
||||||
return builder.toString()
|
return builder.toString()
|
||||||
|
|||||||
@@ -62,7 +62,7 @@ abstract class Tag(val name : String) : Element() {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fun toString(): String {
|
override fun toString(): String {
|
||||||
val builder = StringBuilder()
|
val builder = StringBuilder()
|
||||||
appendTo(builder)
|
appendTo(builder)
|
||||||
return builder.toString()!!
|
return builder.toString()!!
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ import java.util.ArrayList
|
|||||||
public class ChangeEvent(val source: Any, val name: String, val oldValue: Any?, val newValue: Any?) {
|
public class ChangeEvent(val source: Any, val name: String, val oldValue: Any?, val newValue: Any?) {
|
||||||
var propogationId: Any? = null
|
var propogationId: Any? = null
|
||||||
|
|
||||||
public fun toString() : String = "ChangeEvent($name, $oldValue, $newValue)"
|
override fun toString(): String = "ChangeEvent($name, $oldValue, $newValue)"
|
||||||
}
|
}
|
||||||
|
|
||||||
public trait ChangeListener {
|
public trait ChangeListener {
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ class StringTemplate(val values : Array<Any?>) {
|
|||||||
/**
|
/**
|
||||||
* Converts the template into a String
|
* Converts the template into a String
|
||||||
*/
|
*/
|
||||||
public fun toString() : String {
|
override fun toString() : String {
|
||||||
val out = StringBuilder()
|
val out = StringBuilder()
|
||||||
forEach{ out.append(it) }
|
forEach{ out.append(it) }
|
||||||
return out.toString()
|
return out.toString()
|
||||||
@@ -93,7 +93,7 @@ public open class ToStringFormatter : Formatter {
|
|||||||
|
|
||||||
var nullString : String = "null"
|
var nullString : String = "null"
|
||||||
|
|
||||||
public open fun toString() : String = "ToStringFormatter"
|
override fun toString() : String = "ToStringFormatter"
|
||||||
|
|
||||||
public override fun format(out : Appendable, value : Any?) {
|
public override fun format(out : Appendable, value : Any?) {
|
||||||
if (value == null) {
|
if (value == null) {
|
||||||
@@ -121,7 +121,7 @@ public val defaultLocale : Locale = Locale.getDefault()
|
|||||||
*/
|
*/
|
||||||
public open class LocaleFormatter(val locale : Locale = defaultLocale) : ToStringFormatter() {
|
public open class LocaleFormatter(val locale : Locale = defaultLocale) : ToStringFormatter() {
|
||||||
|
|
||||||
public override fun toString() : String = "LocaleFormatter{$locale}"
|
override fun toString() : String = "LocaleFormatter{$locale}"
|
||||||
|
|
||||||
public var numberFormat : NumberFormat = NumberFormat.getInstance(locale)!!
|
public var numberFormat : NumberFormat = NumberFormat.getInstance(locale)!!
|
||||||
|
|
||||||
@@ -151,7 +151,7 @@ public open class LocaleFormatter(val locale : Locale = defaultLocale) : ToStrin
|
|||||||
*/
|
*/
|
||||||
public class HtmlFormatter(locale : Locale = defaultLocale) : LocaleFormatter(locale) {
|
public class HtmlFormatter(locale : Locale = defaultLocale) : LocaleFormatter(locale) {
|
||||||
|
|
||||||
public override fun toString() : String = "HtmlFormatter{$locale}"
|
override fun toString() : String = "HtmlFormatter{$locale}"
|
||||||
|
|
||||||
public override fun format(out : Appendable, value : Any?) {
|
public override fun format(out : Appendable, value : Any?) {
|
||||||
if (value is Node) {
|
if (value is Node) {
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import kotlin.test.*
|
|||||||
import org.junit.Test
|
import org.junit.Test
|
||||||
|
|
||||||
class Item(val name: String, val rating: Int): Comparable<Item> {
|
class Item(val name: String, val rating: Int): Comparable<Item> {
|
||||||
fun toString() = "Item($name, $rating)"
|
override fun toString() = "Item($name, $rating)"
|
||||||
|
|
||||||
public override fun compareTo(other: Item): Int {
|
public override fun compareTo(other: Item): Int {
|
||||||
return compareBy(this, other, { rating }, { name })
|
return compareBy(this, other, { rating }, { name })
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ import org.junit.Test as test
|
|||||||
|
|
||||||
class ListTest {
|
class ListTest {
|
||||||
|
|
||||||
test fun toString() {
|
test fun _toString() {
|
||||||
val data = arrayList("foo", "bar")
|
val data = arrayList("foo", "bar")
|
||||||
assertEquals("[foo, bar]", data.toString())
|
assertEquals("[foo, bar]", data.toString())
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ class Customer() : ChangeSupport() {
|
|||||||
$city = value
|
$city = value
|
||||||
}
|
}
|
||||||
|
|
||||||
fun toString() = "Customer($name, $city)"
|
override fun toString() = "Customer($name, $city)"
|
||||||
}
|
}
|
||||||
|
|
||||||
class MyChangeListener() : ChangeListener {
|
class MyChangeListener() : ChangeListener {
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ class Failure(val message : String) : ParseResult<Nothing> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
open class Token(val text : String) {
|
open class Token(val text : String) {
|
||||||
fun toString() = text
|
override fun toString() = text
|
||||||
}
|
}
|
||||||
object LPAR : Token("(")
|
object LPAR : Token("(")
|
||||||
object RPAR : Token(")")
|
object RPAR : Token(")")
|
||||||
|
|||||||
@@ -934,7 +934,7 @@ abstract class KNamed(val name: String, model: KModel, declarationDescriptor: De
|
|||||||
|
|
||||||
open fun equals(other: KPackage) = name == other.name
|
open fun equals(other: KPackage) = name == other.name
|
||||||
|
|
||||||
open fun toString() = name
|
override fun toString() = name
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -957,7 +957,7 @@ class KPackage(model: KModel, val descriptor: PackageFragmentDescriptor,
|
|||||||
|
|
||||||
fun equals(other: KPackage) = name == other.name
|
fun equals(other: KPackage) = name == other.name
|
||||||
|
|
||||||
fun toString() = "KPackage($name)"
|
override fun toString() = "KPackage($name)"
|
||||||
|
|
||||||
fun getClass(descriptor: ClassDescriptor): KClass {
|
fun getClass(descriptor: ClassDescriptor): KClass {
|
||||||
val name = descriptor.getName().asString()
|
val name = descriptor.getName().asString()
|
||||||
@@ -1089,7 +1089,7 @@ class KClass(
|
|||||||
|
|
||||||
fun equals(other: KClass) = name == other.name
|
fun equals(other: KClass) = name == other.name
|
||||||
|
|
||||||
fun toString() = "$kind($name)"
|
override fun toString() = "$kind($name)"
|
||||||
|
|
||||||
fun isApi(): Boolean {
|
fun isApi(): Boolean {
|
||||||
val visibility = descriptor.getVisibility()
|
val visibility = descriptor.getVisibility()
|
||||||
@@ -1185,7 +1185,7 @@ class KFunction(val descriptor: CallableDescriptor, val owner: KClassOrPackage,
|
|||||||
fun equals(other: KFunction) = name == other.name && this.parameterTypeText == other.parameterTypeText &&
|
fun equals(other: KFunction) = name == other.name && this.parameterTypeText == other.parameterTypeText &&
|
||||||
this.extensionClass == other.extensionClass && this.owner == other.owner
|
this.extensionClass == other.extensionClass && this.owner == other.owner
|
||||||
|
|
||||||
fun toString() = "fun $name($parameterTypeText): $returnType"
|
override fun toString() = "fun $name($parameterTypeText): $returnType"
|
||||||
|
|
||||||
public val link: String = "$name($parameterTypeText)"
|
public val link: String = "$name($parameterTypeText)"
|
||||||
|
|
||||||
@@ -1212,13 +1212,13 @@ class KProperty(val owner: KClassOrPackage, val descriptor: PropertyDescriptor,
|
|||||||
return visibility.isPublicAPI()
|
return visibility.isPublicAPI()
|
||||||
}
|
}
|
||||||
|
|
||||||
fun toString() = "property $name"
|
override fun toString() = "property $name"
|
||||||
}
|
}
|
||||||
|
|
||||||
class KParameter(val descriptor: ValueParameterDescriptor, val name: String,
|
class KParameter(val descriptor: ValueParameterDescriptor, val name: String,
|
||||||
var aType: KType): KAnnotated(aType.model, aType.declarationDescriptor) {
|
var aType: KType): KAnnotated(aType.model, aType.declarationDescriptor) {
|
||||||
|
|
||||||
fun toString() = "$name: ${aType.name}"
|
override fun toString() = "$name: ${aType.name}"
|
||||||
|
|
||||||
fun isVarArg(): Boolean = descriptor.getVarargElementType() != null
|
fun isVarArg(): Boolean = descriptor.getVarargElementType() != null
|
||||||
|
|
||||||
@@ -1237,12 +1237,12 @@ class KTypeParameter(val name: String,
|
|||||||
model: KModel,
|
model: KModel,
|
||||||
var extends: List<KClass> = arrayList<KClass>()): KAnnotated(model, descriptor) {
|
var extends: List<KClass> = arrayList<KClass>()): KAnnotated(model, descriptor) {
|
||||||
|
|
||||||
fun toString() = "$name"
|
override fun toString() = "$name"
|
||||||
}
|
}
|
||||||
|
|
||||||
class KAnnotation(var klass: KClass): KAnnotated(klass.model, klass.descriptor) {
|
class KAnnotation(var klass: KClass): KAnnotated(klass.model, klass.descriptor) {
|
||||||
|
|
||||||
// TODO add some parameter values?
|
// TODO add some parameter values?
|
||||||
|
|
||||||
fun toString() = "@$klass.simpleName"
|
override fun toString() = "@$klass.simpleName"
|
||||||
}
|
}
|
||||||
|
|||||||
Vendored
+1
-1
@@ -6,7 +6,7 @@ import org.jetbrains.kotlin.doc.model.*
|
|||||||
class SearchXmlTemplate(val model: KModel): KDocTemplate() {
|
class SearchXmlTemplate(val model: KModel): KDocTemplate() {
|
||||||
|
|
||||||
class Search(val name: String, val href: String, val kind: String) {
|
class Search(val name: String, val href: String, val kind: String) {
|
||||||
fun toString() = "Search($name, $href, $kind)"
|
override fun toString() = "Search($name, $href, $kind)"
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun render() {
|
override fun render() {
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ package sample
|
|||||||
|
|
||||||
/** A Comment */
|
/** A Comment */
|
||||||
public class Person(val name: String, val city: String) {
|
public class Person(val name: String, val city: String) {
|
||||||
fun toString(): String = "Person($name, $city)"
|
override fun toString(): String = "Person($name, $city)"
|
||||||
|
|
||||||
public fun hello(): String = "Hello $name"
|
public fun hello(): String = "Hello $name"
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user