From 04da2f453af3697dd3040ee01eea4b418760da18 Mon Sep 17 00:00:00 2001 From: "Pavel V. Talanov" Date: Fri, 31 Aug 2012 14:35:09 +0400 Subject: [PATCH] Test for KT-2281. #KT-2281 fixed --- .../k2js/test/semantics/MiscTest.java | 6 ++++ .../stringInterpolationEvaluationOrder.kt | 33 +++++++++++++++++++ 2 files changed, 39 insertions(+) create mode 100644 js/js.translator/testFiles/expression/misc/cases/stringInterpolationEvaluationOrder.kt diff --git a/js/js.tests/test/org/jetbrains/k2js/test/semantics/MiscTest.java b/js/js.tests/test/org/jetbrains/k2js/test/semantics/MiscTest.java index 02974babc5a..b87c4113e20 100644 --- a/js/js.tests/test/org/jetbrains/k2js/test/semantics/MiscTest.java +++ b/js/js.tests/test/org/jetbrains/k2js/test/semantics/MiscTest.java @@ -195,4 +195,10 @@ public final class MiscTest extends AbstractExpressionTest { public void testIterationOverIterator() throws Exception { fooBoxTest(); } + + public void testStringInterpolationEvaluationOrder() throws Exception { + fooBoxTest(); + } + + } diff --git a/js/js.translator/testFiles/expression/misc/cases/stringInterpolationEvaluationOrder.kt b/js/js.translator/testFiles/expression/misc/cases/stringInterpolationEvaluationOrder.kt new file mode 100644 index 00000000000..cbb30252f7e --- /dev/null +++ b/js/js.translator/testFiles/expression/misc/cases/stringInterpolationEvaluationOrder.kt @@ -0,0 +1,33 @@ +package foo + +var s = "" + +class A() { + fun test(v: String) { + s += "4" + } +} + +fun f(): String { + s += "3" + return "" +} + +class B() { + val a: A + get() { + s += "2" + return A() + } + + fun test() { + s += "1" + a.test("${if (true) f() else 4}") + s += "5" + } +} + +fun box(): Any? { + B().test() + return if (s != "12345") s else true +} \ No newline at end of file