[JS IR] Explicitly cast to a string all types except specific ones
^KT-62763 Fixed
This commit is contained in:
committed by
Space Team
parent
70d99e1964
commit
41ebe498f2
@@ -60,28 +60,26 @@ fun testInt() {
|
||||
|
||||
fun testLong() {
|
||||
val expectedMax = " 9223372036854775807 "
|
||||
val expectedMaxBUG = " 9223372036854776000 "
|
||||
val v1 = Long.MAX_VALUE
|
||||
|
||||
assertEquals(expectedMax, " $v1 ", "testLong - template v1")
|
||||
assertEquals(expectedMax, toStringTemplateAny(v1), "testLong - toStringTemplateAny(v1)")
|
||||
assertEquals(expectedMaxBUG, toStringTemplateGeneric(v1), "testLong - toStringTemplateGeneric(v1)")
|
||||
assertEquals(expectedMax, toStringTemplateGeneric(v1), "testLong - toStringTemplateGeneric(v1)")
|
||||
assertEquals(expectedMax, toStringTemplateInlineGeneric(v1), "testLong - toStringTemplateInlineGeneric(v1)")
|
||||
assertEquals(expectedMax, toStringTemplateInlineReifiedGeneric(v1), "testLong - toStringTemplateInlineReifiedGeneric(v1)")
|
||||
assertEquals(expectedMaxBUG, TestClass(v1).asString(), "testLong - TestClass(v1).asString()")
|
||||
assertEquals(expectedMaxBUG, TestClass(v1).asStringInline(), "testLong - TestClass(v1).asStringInline()")
|
||||
assertEquals(expectedMax, TestClass(v1).asString(), "testLong - TestClass(v1).asString()")
|
||||
assertEquals(expectedMax, TestClass(v1).asStringInline(), "testLong - TestClass(v1).asStringInline()")
|
||||
|
||||
val expectedMin = " -9223372036854775808 "
|
||||
val expectedMinBUG = " -9223372036854776000 "
|
||||
val v2 = Long.MIN_VALUE
|
||||
|
||||
assertEquals(expectedMin, " $v2 ", "testLong - template v2")
|
||||
assertEquals(expectedMin, toStringTemplateAny(v2), "testLong - toStringTemplateAny(v2)")
|
||||
assertEquals(expectedMinBUG, toStringTemplateGeneric(v2), "testLong - toStringTemplateGeneric(v2)")
|
||||
assertEquals(expectedMin, toStringTemplateGeneric(v2), "testLong - toStringTemplateGeneric(v2)")
|
||||
assertEquals(expectedMin, toStringTemplateInlineGeneric(v2), "testLong - toStringTemplateInlineGeneric(v2)")
|
||||
assertEquals(expectedMin, toStringTemplateInlineReifiedGeneric(v2), "testLong - toStringTemplateInlineReifiedGeneric(v2)")
|
||||
assertEquals(expectedMinBUG, TestClass(v2).asString(), "testLong - TestClass(v2).asString()")
|
||||
assertEquals(expectedMinBUG, TestClass(v2).asStringInline(), "testLong - TestClass(v2).asStringInline()")
|
||||
assertEquals(expectedMin, TestClass(v2).asString(), "testLong - TestClass(v2).asString()")
|
||||
assertEquals(expectedMin, TestClass(v2).asStringInline(), "testLong - TestClass(v2).asStringInline()")
|
||||
}
|
||||
|
||||
fun testULong() {
|
||||
@@ -117,11 +115,11 @@ fun testArrayInt() {
|
||||
|
||||
assertEquals(expected, " $v ", "testArrayInt - template")
|
||||
assertEquals(expectedShort, toStringTemplateAny(v), "testArrayInt - toStringTemplateAny")
|
||||
assertEquals(expected, toStringTemplateGeneric(v), "testArrayInt - toStringTemplateGeneric")
|
||||
assertEquals(expectedShort, toStringTemplateGeneric(v), "testArrayInt - toStringTemplateGeneric")
|
||||
assertEquals(expectedShort, toStringTemplateInlineGeneric(v), "testArrayInt - toStringTemplateInlineGeneric")
|
||||
assertEquals(expectedShort, toStringTemplateInlineReifiedGeneric(v), "testArrayInt - toStringTemplateInlineReifiedGeneric")
|
||||
assertEquals(expected, TestClass(v).asString(), "testArrayInt - TestClass::asString")
|
||||
assertEquals(expected, TestClass(v).asStringInline(), "testArrayInt - TestClass::asStringInline")
|
||||
assertEquals(expectedShort, TestClass(v).asString(), "testArrayInt - TestClass::asString")
|
||||
assertEquals(expectedShort, TestClass(v).asStringInline(), "testArrayInt - TestClass::asStringInline")
|
||||
}
|
||||
|
||||
fun testArrayLong() {
|
||||
@@ -131,11 +129,11 @@ fun testArrayLong() {
|
||||
|
||||
assertEquals(expected, " $v ", "testArrayLong - template")
|
||||
assertEquals(expectedShort, toStringTemplateAny(v), "testArrayLong - toStringTemplateAny")
|
||||
assertEquals(expected, toStringTemplateGeneric(v), "testArrayLong - toStringTemplateGeneric")
|
||||
assertEquals(expectedShort, toStringTemplateGeneric(v), "testArrayLong - toStringTemplateGeneric")
|
||||
assertEquals(expectedShort, toStringTemplateInlineGeneric(v), "testArrayLong - toStringTemplateInlineGeneric")
|
||||
assertEquals(expectedShort, toStringTemplateInlineReifiedGeneric(v), "testArrayLong - toStringTemplateInlineReifiedGeneric")
|
||||
assertEquals(expected, TestClass(v).asString(), "testArrayLong - TestClass::asString")
|
||||
assertEquals(expected, TestClass(v).asStringInline(), "testArrayLong - TestClass::asStringInline")
|
||||
assertEquals(expectedShort, TestClass(v).asString(), "testArrayLong - TestClass::asString")
|
||||
assertEquals(expectedShort, TestClass(v).asStringInline(), "testArrayLong - TestClass::asStringInline")
|
||||
}
|
||||
|
||||
class UserClass {
|
||||
@@ -147,16 +145,15 @@ class UserClass {
|
||||
|
||||
fun testUserClass() {
|
||||
val expected = " Hello World! "
|
||||
val expectedBUG = " NOT OK!!! "
|
||||
val v = UserClass()
|
||||
|
||||
assertEquals(expectedBUG, " $v ", "testUserClass - template")
|
||||
assertEquals(expected, " $v ", "testUserClass - template")
|
||||
assertEquals(expected, toStringTemplateAny(v), "testUserClass - toStringTemplateAny(v)")
|
||||
assertEquals(expectedBUG, toStringTemplateGeneric(v), "testUserClass - toStringTemplateGeneric(v)")
|
||||
assertEquals(expected, toStringTemplateGeneric(v), "testUserClass - toStringTemplateGeneric(v)")
|
||||
assertEquals(expected, toStringTemplateInlineGeneric(v), "testUserClass - toStringTemplateInlineGeneric(v)")
|
||||
assertEquals(expected, toStringTemplateInlineReifiedGeneric(v), "testUserClass - toStringTemplateInlineReifiedGeneric(v)")
|
||||
assertEquals(expectedBUG, TestClass(v).asString(), "testUserClass - TestClass(v).asString()")
|
||||
assertEquals(expectedBUG, TestClass(v).asStringInline(), "testUserClass - TestClass(v).asStringInline()")
|
||||
assertEquals(expected, TestClass(v).asString(), "testUserClass - TestClass(v).asString()")
|
||||
assertEquals(expected, TestClass(v).asStringInline(), "testUserClass - TestClass(v).asStringInline()")
|
||||
}
|
||||
|
||||
value class UserValueClass(val x: Int) {
|
||||
|
||||
Reference in New Issue
Block a user