JS backend: fix StringBuilder append #KT-4064 Fixed
This commit is contained in:
@@ -62,4 +62,8 @@ public final class StandardClassesTest extends SingleFileTranslationTest {
|
|||||||
public void testArrayFactoryMethods() throws Exception {
|
public void testArrayFactoryMethods() throws Exception {
|
||||||
checkFooBoxIsOk();
|
checkFooBoxIsOk();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void testStringBuilder() throws Exception {
|
||||||
|
checkFooBoxIsOk();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -510,6 +510,7 @@ String.prototype.contains = function (s) {
|
|||||||
}, {
|
}, {
|
||||||
append:function (obj) {
|
append:function (obj) {
|
||||||
this.string = this.string + obj.toString();
|
this.string = this.string + obj.toString();
|
||||||
|
return this;
|
||||||
},
|
},
|
||||||
toString:function () {
|
toString:function () {
|
||||||
return this.string;
|
return this.string;
|
||||||
|
|||||||
@@ -0,0 +1,13 @@
|
|||||||
|
package foo
|
||||||
|
|
||||||
|
import java.util.StringBuilder
|
||||||
|
|
||||||
|
fun box(): String {
|
||||||
|
val s = StringBuilder()
|
||||||
|
s.append("a")
|
||||||
|
s.append("b")?.append("c")
|
||||||
|
s.append("d")!!.append("e")
|
||||||
|
|
||||||
|
if (s.toString() != "abcde") return s.toString()
|
||||||
|
return "OK"
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user