Optimize range operations for 'until' extension from stdlib (KT-9900)
NB: for-in-until loop is generated as precondition loop, because the corresponding range is right-exclusive (and thus we have no problems with integer overflows).
This commit is contained in:
@@ -134,6 +134,17 @@ public class RangeCodegenUtil {
|
||||
return true;
|
||||
}
|
||||
|
||||
public static boolean isPrimitiveNumberUntil(@NotNull CallableDescriptor descriptor) {
|
||||
if (!isTopLevelInPackage(descriptor, "until", "kotlin.ranges")) return false;
|
||||
|
||||
ReceiverParameterDescriptor extensionReceiver = descriptor.getExtensionReceiverParameter();
|
||||
if (extensionReceiver == null) return false;
|
||||
ClassifierDescriptor extensionReceiverClassifier = extensionReceiver.getType().getConstructor().getDeclarationDescriptor();
|
||||
if (!isPrimitiveNumberClassDescriptor(extensionReceiverClassifier)) return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public static boolean isArrayOrPrimitiveArrayIndices(@NotNull CallableDescriptor descriptor) {
|
||||
if (!isTopLevelInPackage(descriptor, "indices", "kotlin.collections")) return false;
|
||||
|
||||
|
||||
+5
-1
@@ -66,9 +66,13 @@ abstract class AbstractForInRangeLoopGenerator : AbstractForInProgressionOrRange
|
||||
|
||||
override fun assignToLoopParameter() {}
|
||||
|
||||
override fun increment(loopExit: Label) {
|
||||
override fun checkPostConditionAndIncrement(loopExit: Label) {
|
||||
checkPostCondition(loopExit)
|
||||
|
||||
incrementLoopVariable()
|
||||
}
|
||||
|
||||
protected fun incrementLoopVariable() {
|
||||
if (loopParameterType === Type.INT_TYPE) {
|
||||
v.iinc(loopParameterVar, step)
|
||||
}
|
||||
|
||||
+2
-2
@@ -116,7 +116,7 @@ abstract class AbstractForLoopGenerator(
|
||||
|
||||
protected abstract fun assignToLoopParameter()
|
||||
|
||||
protected abstract fun increment(loopExit: Label)
|
||||
protected abstract fun checkPostConditionAndIncrement(loopExit: Label)
|
||||
|
||||
fun body() {
|
||||
codegen.generateLoopBody(forExpression.body)
|
||||
@@ -135,7 +135,7 @@ abstract class AbstractForLoopGenerator(
|
||||
fun afterBody(loopExit: Label) {
|
||||
codegen.markStartLineNumber(forExpression)
|
||||
|
||||
increment(loopExit)
|
||||
checkPostConditionAndIncrement(loopExit)
|
||||
|
||||
v.mark(bodyEnd)
|
||||
}
|
||||
|
||||
+1
-1
@@ -74,7 +74,7 @@ class ForInArrayLoopGenerator(codegen: ExpressionCodegen, forExpression: KtForEx
|
||||
v.store(loopParameterVar, asmElementType)
|
||||
}
|
||||
|
||||
override fun increment(loopExit: Label) {
|
||||
override fun checkPostConditionAndIncrement(loopExit: Label) {
|
||||
v.iinc(indexVar, 1)
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -67,7 +67,7 @@ class ForInCharSequenceLoopGenerator(codegen: ExpressionCodegen, forExpression:
|
||||
v.store(loopParameterVar, asmElementType)
|
||||
}
|
||||
|
||||
override fun increment(loopExit: Label) {
|
||||
override fun checkPostConditionAndIncrement(loopExit: Label) {
|
||||
v.iinc(indexVar, 1)
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -92,7 +92,7 @@ class ForInProgressionExpressionLoopGenerator(codegen: ExpressionCodegen, forExp
|
||||
|
||||
override fun assignToLoopParameter() {}
|
||||
|
||||
override fun increment(loopExit: Label) {
|
||||
override fun checkPostConditionAndIncrement(loopExit: Label) {
|
||||
checkPostCondition(loopExit)
|
||||
|
||||
val loopParameter = loopParameter()
|
||||
|
||||
+58
@@ -0,0 +1,58 @@
|
||||
/*
|
||||
* Copyright 2010-2017 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.jetbrains.kotlin.codegen.forLoop
|
||||
|
||||
import org.jetbrains.kotlin.codegen.ExpressionCodegen
|
||||
import org.jetbrains.kotlin.codegen.StackValue
|
||||
import org.jetbrains.kotlin.psi.KtExpression
|
||||
import org.jetbrains.kotlin.psi.KtForExpression
|
||||
import org.jetbrains.kotlin.resolve.calls.model.ResolvedCall
|
||||
import org.jetbrains.kotlin.resolve.scopes.receivers.ReceiverValue
|
||||
import org.jetbrains.org.objectweb.asm.Label
|
||||
import org.jetbrains.org.objectweb.asm.Type
|
||||
|
||||
class ForInUntilRangeLoopGenerator(
|
||||
codegen: ExpressionCodegen,
|
||||
forExpression: KtForExpression,
|
||||
loopRangeCall: ResolvedCall<*>
|
||||
) : AbstractForInRangeLoopGenerator(codegen, forExpression) {
|
||||
private val from: ReceiverValue = loopRangeCall.extensionReceiver!!
|
||||
private val to: KtExpression = ExpressionCodegen.getSingleArgumentExpression(loopRangeCall)!!
|
||||
|
||||
override fun storeRangeStartAndEnd() {
|
||||
loopParameter().store(codegen.generateReceiverValue(from, false), v)
|
||||
StackValue.local(endVar, asmElementType).store(codegen.gen(to), v)
|
||||
}
|
||||
|
||||
override fun checkEmptyLoop(loopExit: Label) {}
|
||||
|
||||
override fun checkPreCondition(loopExit: Label) {
|
||||
loopParameter().put(asmElementType, v)
|
||||
v.load(endVar, asmElementType)
|
||||
if (asmElementType.sort == Type.LONG) {
|
||||
v.lcmp()
|
||||
v.ifge(loopExit)
|
||||
}
|
||||
else {
|
||||
v.ificmpge(loopExit)
|
||||
}
|
||||
}
|
||||
|
||||
override fun checkPostConditionAndIncrement(loopExit: Label) {
|
||||
incrementLoopVariable()
|
||||
}
|
||||
}
|
||||
@@ -68,6 +68,8 @@ private fun ExpressionCodegen.createOptimizedForLoopGeneratorOrNull(
|
||||
ForInRangeLiteralLoopGenerator(this, forExpression, loopRangeCall)
|
||||
RangeCodegenUtil.isPrimitiveNumberDownTo(loopRangeCallee) ->
|
||||
ForInDownToProgressionLoopGenerator(this, forExpression, loopRangeCall)
|
||||
RangeCodegenUtil.isPrimitiveNumberUntil(loopRangeCallee) ->
|
||||
ForInUntilRangeLoopGenerator(this, forExpression, loopRangeCall)
|
||||
RangeCodegenUtil.isArrayOrPrimitiveArrayIndices(loopRangeCallee) ->
|
||||
ForInArrayIndicesRangeLoopGenerator(this, forExpression, loopRangeCall)
|
||||
RangeCodegenUtil.isCollectionIndices(loopRangeCallee) ->
|
||||
|
||||
+1
-1
@@ -83,5 +83,5 @@ class IteratorForLoopGenerator(codegen: ExpressionCodegen, forExpression: KtForE
|
||||
StackValue.local(loopParameterVar, loopParameterType).store(value, v)
|
||||
}
|
||||
|
||||
override fun increment(loopExit: Label) {}
|
||||
override fun checkPostConditionAndIncrement(loopExit: Label) {}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
// IGNORE_BACKEND: JS
|
||||
// see KT-17700
|
||||
|
||||
// WITH_RUNTIME
|
||||
|
||||
import kotlin.test.assertEquals
|
||||
|
||||
fun box(): String {
|
||||
testChar()
|
||||
testNullableChar()
|
||||
return "OK"
|
||||
}
|
||||
|
||||
private fun testChar() {
|
||||
var sum = ""
|
||||
for (ch in '1' until '5') {
|
||||
sum = sum + ch
|
||||
}
|
||||
assertEquals("1234", sum)
|
||||
}
|
||||
|
||||
private fun testNullableChar() {
|
||||
var sum = ""
|
||||
for (ch: Char? in '1' until '5') {
|
||||
sum = sum + (ch ?: break)
|
||||
}
|
||||
assertEquals("1234", sum)
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
// WITH_RUNTIME
|
||||
|
||||
import kotlin.test.assertEquals
|
||||
|
||||
fun box(): String {
|
||||
for (ch in (-10).toChar() until '\u0000') {
|
||||
throw AssertionError("This loop shoud not be executed")
|
||||
}
|
||||
return "OK"
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
// WITH_RUNTIME
|
||||
|
||||
import kotlin.test.assertEquals
|
||||
|
||||
fun box(): String {
|
||||
testIntInIntUntilInt()
|
||||
testNullableIntInIntUntilInt()
|
||||
return "OK"
|
||||
}
|
||||
|
||||
private fun testIntInIntUntilInt() {
|
||||
var sum = 0
|
||||
for (i in 1 until 5) {
|
||||
sum = sum * 10 + i
|
||||
}
|
||||
assertEquals(1234, sum)
|
||||
}
|
||||
|
||||
private fun testNullableIntInIntUntilInt() {
|
||||
var sum = 0
|
||||
for (i: Int? in 1 until 5) {
|
||||
sum = sum * 10 + (i?.toInt() ?: break)
|
||||
}
|
||||
assertEquals(1234, sum)
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
// WITH_RUNTIME
|
||||
|
||||
import kotlin.test.assertEquals
|
||||
|
||||
fun box(): String {
|
||||
for (i in 10 until 0) {
|
||||
throw AssertionError("This loop should not be executed")
|
||||
}
|
||||
return "OK"
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
// WITH_RUNTIME
|
||||
|
||||
import kotlin.test.assertEquals
|
||||
|
||||
fun testLongInLongUntilLong() {
|
||||
var sum = 0
|
||||
for (i in 1L until 5L) {
|
||||
sum = sum * 10 + i.toInt()
|
||||
}
|
||||
assertEquals(1234, sum)
|
||||
}
|
||||
|
||||
fun testLongInLongUntilInt() {
|
||||
var sum = 0
|
||||
for (i in 1L until 5.toInt()) {
|
||||
sum = sum * 10 + i.toInt()
|
||||
}
|
||||
assertEquals(1234, sum)
|
||||
}
|
||||
|
||||
fun testLongInIntUntilLong() {
|
||||
var sum = 0
|
||||
for (i in 1.toInt() until 5L) {
|
||||
sum = sum * 10 + i.toInt()
|
||||
}
|
||||
assertEquals(1234, sum)
|
||||
}
|
||||
|
||||
fun testNullableLongInIntUntilLong() {
|
||||
var sum = 0
|
||||
for (i: Long? in 1.toInt() until 5L) {
|
||||
sum = sum * 10 + (i?.toInt() ?: break)
|
||||
}
|
||||
assertEquals(1234, sum)
|
||||
}
|
||||
|
||||
fun box(): String {
|
||||
testLongInLongUntilLong()
|
||||
testLongInIntUntilLong()
|
||||
testLongInLongUntilInt()
|
||||
testNullableLongInIntUntilLong()
|
||||
return "OK"
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
// WITH_RUNTIME
|
||||
|
||||
import kotlin.test.assertEquals
|
||||
|
||||
fun box(): String {
|
||||
for (i in Int.MAX_VALUE until Int.MAX_VALUE) {
|
||||
throw AssertionError("This loop shoud not be executed")
|
||||
}
|
||||
return "OK"
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
// WITH_RUNTIME
|
||||
|
||||
import kotlin.test.assertEquals
|
||||
|
||||
fun box(): String {
|
||||
for (i in 0 until Int.MIN_VALUE) {
|
||||
throw AssertionError("This loop shoud not be executed")
|
||||
}
|
||||
return "OK"
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
// WITH_RUNTIME
|
||||
|
||||
import kotlin.test.assertEquals
|
||||
|
||||
fun box(): String {
|
||||
for (i in 0 until Long.MIN_VALUE) {
|
||||
throw AssertionError("This loop shoud not be executed")
|
||||
}
|
||||
return "OK"
|
||||
}
|
||||
+21
@@ -0,0 +1,21 @@
|
||||
// WITH_RUNTIME
|
||||
|
||||
import kotlin.test.assertEquals
|
||||
|
||||
fun box(): String {
|
||||
testIntInIntUntilSmartcastInt()
|
||||
return "OK"
|
||||
}
|
||||
|
||||
private fun testIntInIntUntilSmartcastInt() {
|
||||
var sum = 0
|
||||
|
||||
val a: Any = 5
|
||||
if (a is Int) {
|
||||
for (i: Int in 1 until a) {
|
||||
sum = sum * 10 + i
|
||||
}
|
||||
}
|
||||
|
||||
assertEquals(1234, sum)
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
// WITH_RUNTIME
|
||||
|
||||
fun test(): Int {
|
||||
var sum = 0
|
||||
for (i in 1 until 6) {
|
||||
sum = sum * 10 + i
|
||||
}
|
||||
return sum
|
||||
}
|
||||
|
||||
// 0 iterator
|
||||
// 0 getStart
|
||||
// 0 getEnd
|
||||
// 0 getFirst
|
||||
// 0 getLast
|
||||
// 1 IF
|
||||
@@ -1,6 +1,7 @@
|
||||
fun Int.until(other: Int) = this..other - 1
|
||||
fun foo() {
|
||||
for (i in 1 until 2) {
|
||||
val range = 1 until 2
|
||||
for (i in range) {
|
||||
}
|
||||
|
||||
for (i in 1..2 step 4) {}
|
||||
|
||||
+63
@@ -13364,6 +13364,69 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes
|
||||
}
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/testData/codegen/box/ranges/forInUntil")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
public static class ForInUntil extends AbstractIrBlackBoxCodegenTest {
|
||||
public void testAllFilesPresentInForInUntil() throws Exception {
|
||||
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/codegen/box/ranges/forInUntil"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.JVM, true);
|
||||
}
|
||||
|
||||
@TestMetadata("forInUntilChar.kt")
|
||||
public void testForInUntilChar() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/ranges/forInUntil/forInUntilChar.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("forInUntilChar0.kt")
|
||||
public void testForInUntilChar0() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/ranges/forInUntil/forInUntilChar0.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("forInUntilInt.kt")
|
||||
public void testForInUntilInt() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/ranges/forInUntil/forInUntilInt.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("forInUntilLesserInt.kt")
|
||||
public void testForInUntilLesserInt() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/ranges/forInUntil/forInUntilLesserInt.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("forInUntilLong.kt")
|
||||
public void testForInUntilLong() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/ranges/forInUntil/forInUntilLong.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("forInUntilMaxint.kt")
|
||||
public void testForInUntilMaxint() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/ranges/forInUntil/forInUntilMaxint.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("forInUntilMinint.kt")
|
||||
public void testForInUntilMinint() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/ranges/forInUntil/forInUntilMinint.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("forInUntilMinlong.kt")
|
||||
public void testForInUntilMinlong() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/ranges/forInUntil/forInUntilMinlong.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("forIntInIntUntilSmartcastInt.kt")
|
||||
public void testForIntInIntUntilSmartcastInt() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/ranges/forInUntil/forIntInIntUntilSmartcastInt.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/testData/codegen/box/ranges/literal")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
|
||||
@@ -13364,6 +13364,69 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest {
|
||||
}
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/testData/codegen/box/ranges/forInUntil")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
public static class ForInUntil extends AbstractBlackBoxCodegenTest {
|
||||
public void testAllFilesPresentInForInUntil() throws Exception {
|
||||
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/codegen/box/ranges/forInUntil"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.JVM, true);
|
||||
}
|
||||
|
||||
@TestMetadata("forInUntilChar.kt")
|
||||
public void testForInUntilChar() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/ranges/forInUntil/forInUntilChar.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("forInUntilChar0.kt")
|
||||
public void testForInUntilChar0() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/ranges/forInUntil/forInUntilChar0.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("forInUntilInt.kt")
|
||||
public void testForInUntilInt() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/ranges/forInUntil/forInUntilInt.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("forInUntilLesserInt.kt")
|
||||
public void testForInUntilLesserInt() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/ranges/forInUntil/forInUntilLesserInt.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("forInUntilLong.kt")
|
||||
public void testForInUntilLong() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/ranges/forInUntil/forInUntilLong.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("forInUntilMaxint.kt")
|
||||
public void testForInUntilMaxint() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/ranges/forInUntil/forInUntilMaxint.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("forInUntilMinint.kt")
|
||||
public void testForInUntilMinint() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/ranges/forInUntil/forInUntilMinint.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("forInUntilMinlong.kt")
|
||||
public void testForInUntilMinlong() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/ranges/forInUntil/forInUntilMinlong.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("forIntInIntUntilSmartcastInt.kt")
|
||||
public void testForIntInIntUntilSmartcastInt() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/ranges/forInUntil/forIntInIntUntilSmartcastInt.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/testData/codegen/box/ranges/literal")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
|
||||
@@ -1151,6 +1151,12 @@ public class BytecodeTextTestGenerated extends AbstractBytecodeTextTest {
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("forInUntil.kt")
|
||||
public void testForInUntil() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/bytecodeText/forLoop/forInUntil.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("forIntInDownTo.kt")
|
||||
public void testForIntInDownTo() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/bytecodeText/forLoop/forIntInDownTo.kt");
|
||||
|
||||
@@ -13364,6 +13364,69 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes
|
||||
}
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/testData/codegen/box/ranges/forInUntil")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
public static class ForInUntil extends AbstractLightAnalysisModeTest {
|
||||
public void testAllFilesPresentInForInUntil() throws Exception {
|
||||
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/codegen/box/ranges/forInUntil"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.JVM, true);
|
||||
}
|
||||
|
||||
@TestMetadata("forInUntilChar.kt")
|
||||
public void testForInUntilChar() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/ranges/forInUntil/forInUntilChar.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("forInUntilChar0.kt")
|
||||
public void testForInUntilChar0() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/ranges/forInUntil/forInUntilChar0.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("forInUntilInt.kt")
|
||||
public void testForInUntilInt() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/ranges/forInUntil/forInUntilInt.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("forInUntilLesserInt.kt")
|
||||
public void testForInUntilLesserInt() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/ranges/forInUntil/forInUntilLesserInt.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("forInUntilLong.kt")
|
||||
public void testForInUntilLong() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/ranges/forInUntil/forInUntilLong.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("forInUntilMaxint.kt")
|
||||
public void testForInUntilMaxint() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/ranges/forInUntil/forInUntilMaxint.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("forInUntilMinint.kt")
|
||||
public void testForInUntilMinint() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/ranges/forInUntil/forInUntilMinint.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("forInUntilMinlong.kt")
|
||||
public void testForInUntilMinlong() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/ranges/forInUntil/forInUntilMinlong.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("forIntInIntUntilSmartcastInt.kt")
|
||||
public void testForIntInIntUntilSmartcastInt() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/ranges/forInUntil/forIntInIntUntilSmartcastInt.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/testData/codegen/box/ranges/literal")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
|
||||
+69
@@ -15184,6 +15184,75 @@ public class JsCodegenBoxTestGenerated extends AbstractJsCodegenBoxTest {
|
||||
}
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/testData/codegen/box/ranges/forInUntil")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
public static class ForInUntil extends AbstractJsCodegenBoxTest {
|
||||
public void testAllFilesPresentInForInUntil() throws Exception {
|
||||
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/codegen/box/ranges/forInUntil"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.JS, true);
|
||||
}
|
||||
|
||||
@TestMetadata("forInUntilChar.kt")
|
||||
public void testForInUntilChar() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/ranges/forInUntil/forInUntilChar.kt");
|
||||
try {
|
||||
doTest(fileName);
|
||||
}
|
||||
catch (Throwable ignore) {
|
||||
return;
|
||||
}
|
||||
throw new AssertionError("Looks like this test can be unmuted. Remove IGNORE_BACKEND directive for that.");
|
||||
}
|
||||
|
||||
@TestMetadata("forInUntilChar0.kt")
|
||||
public void testForInUntilChar0() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/ranges/forInUntil/forInUntilChar0.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("forInUntilInt.kt")
|
||||
public void testForInUntilInt() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/ranges/forInUntil/forInUntilInt.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("forInUntilLesserInt.kt")
|
||||
public void testForInUntilLesserInt() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/ranges/forInUntil/forInUntilLesserInt.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("forInUntilLong.kt")
|
||||
public void testForInUntilLong() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/ranges/forInUntil/forInUntilLong.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("forInUntilMaxint.kt")
|
||||
public void testForInUntilMaxint() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/ranges/forInUntil/forInUntilMaxint.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("forInUntilMinint.kt")
|
||||
public void testForInUntilMinint() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/ranges/forInUntil/forInUntilMinint.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("forInUntilMinlong.kt")
|
||||
public void testForInUntilMinlong() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/ranges/forInUntil/forInUntilMinlong.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("forIntInIntUntilSmartcastInt.kt")
|
||||
public void testForIntInIntUntilSmartcastInt() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/ranges/forInUntil/forIntInIntUntilSmartcastInt.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/testData/codegen/box/ranges/literal")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
|
||||
+1
@@ -59,4 +59,5 @@ public class OutputPrefixPostfixTestGenerated extends AbstractOutputPrefixPostfi
|
||||
String fileName = KotlinTestUtils.navigationMetadata("js/js.translator/testData/outputPrefixPostfix/simpleWithPrefixAndPostfix.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+1
@@ -53,4 +53,5 @@ public class SourceMapGenerationSmokeTestGenerated extends AbstractSourceMapGene
|
||||
String fileName = KotlinTestUtils.navigationMetadata("js/js.translator/testData/sourcemap/methodCallInMethod.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user