KT-8005 Add test to prove the issue is no more reproducible
This commit is contained in:
+6
@@ -268,4 +268,10 @@ public class InlineEvaluationOrderTestGenerated extends AbstractInlineEvaluation
|
|||||||
String fileName = KotlinTestUtils.navigationMetadata("js/js.translator/testData/inlineEvaluationOrder/cases/whileComplex.kt");
|
String fileName = KotlinTestUtils.navigationMetadata("js/js.translator/testData/inlineEvaluationOrder/cases/whileComplex.kt");
|
||||||
doTest(fileName);
|
doTest(fileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("whileConditionExtracted.kt")
|
||||||
|
public void testWhileConditionExtracted() throws Exception {
|
||||||
|
String fileName = KotlinTestUtils.navigationMetadata("js/js.translator/testData/inlineEvaluationOrder/cases/whileConditionExtracted.kt");
|
||||||
|
doTest(fileName);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+24
@@ -0,0 +1,24 @@
|
|||||||
|
// See KT-8005
|
||||||
|
package foo
|
||||||
|
|
||||||
|
private inline fun bar(predicate: (Char) -> Boolean): Int {
|
||||||
|
var i = 0
|
||||||
|
val str = "abc "
|
||||||
|
while (predicate(str[i]) && i < 3) {
|
||||||
|
i++
|
||||||
|
}
|
||||||
|
return i
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun test(c: Char): Int {
|
||||||
|
return bar { it != c }
|
||||||
|
}
|
||||||
|
|
||||||
|
fun box(): String {
|
||||||
|
assertEquals(0, test('a'))
|
||||||
|
assertEquals(1, test('b'))
|
||||||
|
assertEquals(2, test('c'))
|
||||||
|
assertEquals(3, test('*'))
|
||||||
|
|
||||||
|
return "OK"
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user