JVM_IR KT-29822 KT-48669 loop over unsigned array, indices, withIndex

This commit is contained in:
Dmitry Petrov
2021-09-21 19:35:21 +03:00
committed by TeamCityServer
parent 2cc6b589f3
commit be28b3c74d
28 changed files with 819 additions and 8 deletions
@@ -1234,6 +1234,64 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT
}
}
@Nested
@TestMetadata("compiler/testData/codegen/box/arrays/forInUnsignedArray")
@TestDataPath("$PROJECT_ROOT")
public class ForInUnsignedArray {
@Test
public void testAllFilesPresentInForInUnsignedArray() throws Exception {
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/arrays/forInUnsignedArray"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true);
}
@Test
@TestMetadata("forInUnsignedArray.kt")
public void testForInUnsignedArray() throws Exception {
runTest("compiler/testData/codegen/box/arrays/forInUnsignedArray/forInUnsignedArray.kt");
}
@Test
@TestMetadata("forInUnsignedArrayIndices.kt")
public void testForInUnsignedArrayIndices() throws Exception {
runTest("compiler/testData/codegen/box/arrays/forInUnsignedArray/forInUnsignedArrayIndices.kt");
}
@Test
@TestMetadata("forInUnsignedArrayIndicesReversed.kt")
public void testForInUnsignedArrayIndicesReversed() throws Exception {
runTest("compiler/testData/codegen/box/arrays/forInUnsignedArray/forInUnsignedArrayIndicesReversed.kt");
}
@Test
@TestMetadata("forInUnsignedArrayReversed.kt")
public void testForInUnsignedArrayReversed() throws Exception {
runTest("compiler/testData/codegen/box/arrays/forInUnsignedArray/forInUnsignedArrayReversed.kt");
}
@Test
@TestMetadata("forInUnsignedArrayWithIndex.kt")
public void testForInUnsignedArrayWithIndex() throws Exception {
runTest("compiler/testData/codegen/box/arrays/forInUnsignedArray/forInUnsignedArrayWithIndex.kt");
}
@Test
@TestMetadata("forInUnsignedArrayWithIndexNoElementVar.kt")
public void testForInUnsignedArrayWithIndexNoElementVar() throws Exception {
runTest("compiler/testData/codegen/box/arrays/forInUnsignedArray/forInUnsignedArrayWithIndexNoElementVar.kt");
}
@Test
@TestMetadata("forInUnsignedArrayWithIndexNoIndexVar.kt")
public void testForInUnsignedArrayWithIndexNoIndexVar() throws Exception {
runTest("compiler/testData/codegen/box/arrays/forInUnsignedArray/forInUnsignedArrayWithIndexNoIndexVar.kt");
}
@Test
@TestMetadata("forInUnsignedArrayWithIndexReversed.kt")
public void testForInUnsignedArrayWithIndexReversed() throws Exception {
runTest("compiler/testData/codegen/box/arrays/forInUnsignedArray/forInUnsignedArrayWithIndexReversed.kt");
}
}
@Nested
@TestMetadata("compiler/testData/codegen/box/arrays/multiDecl")
@TestDataPath("$PROJECT_ROOT")
@@ -3113,6 +3113,24 @@ public class FirBytecodeTextTestGenerated extends AbstractFirBytecodeTextTest {
runTest("compiler/testData/codegen/bytecodeText/forLoop/unsigned/forInRangeToULongMaxValue.kt");
}
@Test
@TestMetadata("forInUnsignedArray.kt")
public void testForInUnsignedArray() throws Exception {
runTest("compiler/testData/codegen/bytecodeText/forLoop/unsigned/forInUnsignedArray.kt");
}
@Test
@TestMetadata("forInUnsignedArrayIndices.kt")
public void testForInUnsignedArrayIndices() throws Exception {
runTest("compiler/testData/codegen/bytecodeText/forLoop/unsigned/forInUnsignedArrayIndices.kt");
}
@Test
@TestMetadata("forInUnsignedArrayWithIndex.kt")
public void testForInUnsignedArrayWithIndex() throws Exception {
runTest("compiler/testData/codegen/bytecodeText/forLoop/unsigned/forInUnsignedArrayWithIndex.kt");
}
@Test
@TestMetadata("forInUntilUIntMaxValue.kt")
public void testForInUntilUIntMaxValue() throws Exception {
@@ -19,10 +19,7 @@ import org.jetbrains.kotlin.ir.declarations.IrSimpleFunction
import org.jetbrains.kotlin.ir.expressions.IrExpression
import org.jetbrains.kotlin.ir.symbols.IrSymbol
import org.jetbrains.kotlin.ir.types.*
import org.jetbrains.kotlin.ir.util.functions
import org.jetbrains.kotlin.ir.util.getPropertyGetter
import org.jetbrains.kotlin.ir.util.getSimpleFunction
import org.jetbrains.kotlin.ir.util.isPrimitiveArray
import org.jetbrains.kotlin.ir.util.*
import org.jetbrains.kotlin.name.FqName
import org.jetbrains.kotlin.name.Name
import org.jetbrains.kotlin.util.OperatorNameConventions
@@ -75,7 +72,7 @@ abstract class IndexedGetIterationHandler(
/** Builds a [HeaderInfo] for arrays. */
internal class ArrayIterationHandler(context: CommonBackendContext) : IndexedGetIterationHandler(context, canCacheLast = true) {
override fun matchIterable(expression: IrExpression) = expression.type.run { isArray() || isPrimitiveArray() }
override fun matchIterable(expression: IrExpression) = expression.type.run { isArray() || isPrimitiveArray() || isUnsignedArray() }
override val IrType.sizePropertyGetter
get() = getClass()!!.getPropertyGetter("size")!!.owner
@@ -18,6 +18,7 @@ import org.jetbrains.kotlin.ir.symbols.IrSymbol
import org.jetbrains.kotlin.ir.types.*
import org.jetbrains.kotlin.ir.util.getPropertyGetter
import org.jetbrains.kotlin.ir.util.isPrimitiveArray
import org.jetbrains.kotlin.ir.util.isUnsignedArray
import org.jetbrains.kotlin.name.FqName
/** Builds a [HeaderInfo] for progressions built using the `indices` extension property. */
@@ -77,7 +78,7 @@ internal class CollectionIndicesHandler(context: CommonBackendContext) : Indices
internal class ArrayIndicesHandler(context: CommonBackendContext) : IndicesHandler(context) {
override val matcher = SimpleCalleeMatcher {
extensionReceiver { it != null && it.type.run { isArray() || isPrimitiveArray() } }
extensionReceiver { it != null && it.type.run { isArray() || isPrimitiveArray() || isUnsignedArray() } }
fqName { it == FqName("kotlin.collections.<get-indices>") }
parameterCount { it == 0 }
}
@@ -19,6 +19,7 @@ import org.jetbrains.kotlin.ir.types.isIterable
import org.jetbrains.kotlin.ir.types.isSequence
import org.jetbrains.kotlin.ir.types.isSubtypeOfClass
import org.jetbrains.kotlin.ir.util.isPrimitiveArray
import org.jetbrains.kotlin.ir.util.isUnsignedArray
import org.jetbrains.kotlin.name.FqName
/** Builds a [HeaderInfo] for calls to `withIndex()`. */
@@ -30,7 +31,7 @@ internal class WithIndexHandler(context: CommonBackendContext, private val visit
createIrCallMatcher(Quantifier.ANY) {
callee {
fqName { it == FqName("kotlin.collections.withIndex") }
extensionReceiver { it != null && it.type.run { isArray() || isPrimitiveArray() || isIterable() } }
extensionReceiver { it != null && it.type.run { isArray() || isPrimitiveArray() || isUnsignedArray() || isIterable() } }
parameterCount { it == 0 }
}
callee {
@@ -67,6 +67,8 @@ fun IrType.isThrowable(): Boolean = isTypeFromKotlinPackage { name -> name.asStr
fun IrType.isUnsigned(): Boolean = isTypeFromKotlinPackage { name -> UnsignedTypes.isShortNameOfUnsignedType(name) }
fun IrType.isUnsignedArray(): Boolean = isTypeFromKotlinPackage { name -> UnsignedTypes.isShortNameOfUnsignedArray(name) }
private inline fun IrType.isTypeFromKotlinPackage(namePredicate: (Name) -> Boolean): Boolean {
if (this is IrSimpleType) {
val classClassifier = classifier as? IrClassSymbol ?: return false
@@ -0,0 +1,17 @@
// WITH_RUNTIME
// IGNORE_BACKEND: WASM
fun test(uis: UIntArray): String {
var s = ""
for (ui in uis) {
s += ui
}
return s
}
fun box(): String {
val test = test(uintArrayOf(1U, 2U, 3U))
if (test != "123") return "Failed: $test"
return "OK"
}
@@ -0,0 +1,17 @@
// WITH_RUNTIME
// IGNORE_BACKEND: WASM
fun test(uis: UIntArray): String {
var s = ""
for (i in uis.indices) {
s += "$i:${uis[i]};"
}
return s
}
fun box(): String {
val test = test(uintArrayOf(1U, 2U, 3U))
if (test != "0:1;1:2;2:3;") return "Failed: $test"
return "OK"
}
@@ -0,0 +1,17 @@
// WITH_RUNTIME
// IGNORE_BACKEND: WASM
fun test(uis: UIntArray): String {
var s = ""
for (i in uis.indices.reversed()) {
s += "$i:${uis[i]};"
}
return s
}
fun box(): String {
val test = test(uintArrayOf(1U, 2U, 3U))
if (test != "2:3;1:2;0:1;") return "Failed: $test"
return "OK"
}
@@ -0,0 +1,17 @@
// WITH_RUNTIME
// IGNORE_BACKEND: WASM
fun test(uis: UIntArray): String {
var s = ""
for (ui in uis.reversed()) {
s += ui
}
return s
}
fun box(): String {
val test = test(uintArrayOf(1U, 2U, 3U))
if (test != "321") return "Failed: $test"
return "OK"
}
@@ -0,0 +1,17 @@
// WITH_RUNTIME
// IGNORE_BACKEND: WASM
fun test(uis: UIntArray): String {
var s = ""
for ((i, ui) in uis.withIndex()) {
s += "$i:$ui;"
}
return s
}
fun box(): String {
val test = test(uintArrayOf(1U, 2U, 3U))
if (test != "0:1;1:2;2:3;") return "Failed: $test"
return "OK"
}
@@ -0,0 +1,17 @@
// WITH_RUNTIME
// IGNORE_BACKEND: WASM
fun test(uis: UIntArray): String {
var s = ""
for ((i, _) in uis.withIndex()) {
s += "$i:${uis[i]};"
}
return s
}
fun box(): String {
val test = test(uintArrayOf(1U, 2U, 3U))
if (test != "0:1;1:2;2:3;") return "Failed: $test"
return "OK"
}
@@ -0,0 +1,17 @@
// WITH_RUNTIME
// IGNORE_BACKEND: WASM
fun test(uis: UIntArray): String {
var s = ""
for ((_, ui) in uis.withIndex()) {
s += ui
}
return s
}
fun box(): String {
val test = test(uintArrayOf(1U, 2U, 3U))
if (test != "123") return "Failed: $test"
return "OK"
}
@@ -0,0 +1,17 @@
// WITH_RUNTIME
// IGNORE_BACKEND: WASM
fun test(uis: UIntArray): String {
var s = ""
for ((i, ui) in uis.withIndex().reversed()) {
s += "$i:$ui;"
}
return s
}
fun box(): String {
val test = test(uintArrayOf(1U, 2U, 3U))
if (test != "2:3;1:2;0:1;") return "Failed: $test"
return "OK"
}
@@ -47,7 +47,9 @@ fun testLong() {
s += i
if (t > 2) throw Exception("too many iterations: $t")
}
if (s != "-9223372036854775807-9223372036854775808") throw Exception(s)
if (s != "-9223372036854775807-9223372036854775808" &&
s != "-9223372036854776000-9223372036854776000" // JS
) throw Exception(s)
}
fun testChar() {
@@ -0,0 +1,35 @@
// WITH_RUNTIME
// IMPORTANT!
// Please, when your changes cause failures in bytecodeText tests for 'for' loops,
// examine the resulting bytecode shape carefully.
// Range and progression-based loops generated with Kotlin compiler should be
// as close as possible to Java counter loops ('for (int i = a; i < b; ++i) { ... }').
// Otherwise it may result in performance regression due to missing HotSpot optimizations.
// Run Kotlin compiler benchmarks (https://github.com/Kotlin/kotlin-benchmarks)
// with compiler built from your changes if you are not sure.
fun test(uis: UIntArray): UInt {
var s = 0U
for (ui in uis) {
s += ui
}
return s
}
// 0 iterator
// 0 getStart
// 0 getEnd
// 0 getFirst
// 0 getLast
// 1 IF_ICMPGE
// 0 IF_ICMPGT
// 0 IF_ICMPLE
// 1 IF
// JVM_IR_TEMPLATES
// 6 ILOAD
// 5 ISTORE
// 1 IADD
// 0 ISUB
// 1 IINC
@@ -0,0 +1,45 @@
// WITH_RUNTIME
// IMPORTANT!
// Please, when your changes cause failures in bytecodeText tests for 'for' loops,
// examine the resulting bytecode shape carefully.
// Range and progression-based loops generated with Kotlin compiler should be
// as close as possible to Java counter loops ('for (int i = a; i < b; ++i) { ... }').
// Otherwise it may result in performance regression due to missing HotSpot optimizations.
// Run Kotlin compiler benchmarks (https://github.com/Kotlin/kotlin-benchmarks)
// with compiler built from your changes if you are not sure.
fun test(uis: UIntArray): UInt {
var s = 0U
for (i in uis.indices) {
s += uis[i]
}
return s
}
// 0 iterator
// 0 getStart
// 0 getEnd
// JVM_TEMPLATES
// 1 getFirst
// 1 getLast
// 0 IF_ICMPGE
// 1 IF_ICMPGT
// 0 IF_ICMPLE
// 2 IF
// JVM_IR_TEMPLATES
// 0 getFirst
// 0 getLast
// 1 IF_ICMPGE
// 0 IF_ICMPGT
// 0 IF_ICMPLE
// 1 IF
// JVM_IR_TEMPLATES
// 5 ILOAD
// 4 ISTORE
// 1 IADD
// 0 ISUB
// 1 IINC
@@ -0,0 +1,46 @@
// WITH_RUNTIME
// IGNORE_BACKEND_FIR: JVM_IR
// IMPORTANT!
// Please, when your changes cause failures in bytecodeText tests for 'for' loops,
// examine the resulting bytecode shape carefully.
// Range and progression-based loops generated with Kotlin compiler should be
// as close as possible to Java counter loops ('for (int i = a; i < b; ++i) { ... }').
// Otherwise it may result in performance regression due to missing HotSpot optimizations.
// Run Kotlin compiler benchmarks (https://github.com/Kotlin/kotlin-benchmarks)
// with compiler built from your changes if you are not sure.
fun test(uis: UIntArray): UInt {
var s = 0U
for ((i, ui) in uis.withIndex()) {
s += ui
}
return s
}
// JVM_TEMPLATES
// 1 withIndex
// 1 iterator
// 1 hasNext
// 1 next
// 1 component1
// 1 component2
// 0 ARRAYLENGTH
// 1 ICONST_0
// JVM_IR_TEMPLATES
// 0 withIndex
// 0 iterator
// 0 hasNext
// 0 next
// 0 component1
// 0 component2
// 1 INVOKESTATIC kotlin\/UIntArray\.getSize\-impl \(\[I\)I
// 2 ICONST_0
// JVM_IR_TEMPLATES
// 7 ILOAD
// 6 ISTORE
// 1 IADD
// 0 ISUB
// 1 IINC
@@ -1168,6 +1168,64 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest {
}
}
@Nested
@TestMetadata("compiler/testData/codegen/box/arrays/forInUnsignedArray")
@TestDataPath("$PROJECT_ROOT")
public class ForInUnsignedArray {
@Test
public void testAllFilesPresentInForInUnsignedArray() throws Exception {
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/arrays/forInUnsignedArray"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM, true);
}
@Test
@TestMetadata("forInUnsignedArray.kt")
public void testForInUnsignedArray() throws Exception {
runTest("compiler/testData/codegen/box/arrays/forInUnsignedArray/forInUnsignedArray.kt");
}
@Test
@TestMetadata("forInUnsignedArrayIndices.kt")
public void testForInUnsignedArrayIndices() throws Exception {
runTest("compiler/testData/codegen/box/arrays/forInUnsignedArray/forInUnsignedArrayIndices.kt");
}
@Test
@TestMetadata("forInUnsignedArrayIndicesReversed.kt")
public void testForInUnsignedArrayIndicesReversed() throws Exception {
runTest("compiler/testData/codegen/box/arrays/forInUnsignedArray/forInUnsignedArrayIndicesReversed.kt");
}
@Test
@TestMetadata("forInUnsignedArrayReversed.kt")
public void testForInUnsignedArrayReversed() throws Exception {
runTest("compiler/testData/codegen/box/arrays/forInUnsignedArray/forInUnsignedArrayReversed.kt");
}
@Test
@TestMetadata("forInUnsignedArrayWithIndex.kt")
public void testForInUnsignedArrayWithIndex() throws Exception {
runTest("compiler/testData/codegen/box/arrays/forInUnsignedArray/forInUnsignedArrayWithIndex.kt");
}
@Test
@TestMetadata("forInUnsignedArrayWithIndexNoElementVar.kt")
public void testForInUnsignedArrayWithIndexNoElementVar() throws Exception {
runTest("compiler/testData/codegen/box/arrays/forInUnsignedArray/forInUnsignedArrayWithIndexNoElementVar.kt");
}
@Test
@TestMetadata("forInUnsignedArrayWithIndexNoIndexVar.kt")
public void testForInUnsignedArrayWithIndexNoIndexVar() throws Exception {
runTest("compiler/testData/codegen/box/arrays/forInUnsignedArray/forInUnsignedArrayWithIndexNoIndexVar.kt");
}
@Test
@TestMetadata("forInUnsignedArrayWithIndexReversed.kt")
public void testForInUnsignedArrayWithIndexReversed() throws Exception {
runTest("compiler/testData/codegen/box/arrays/forInUnsignedArray/forInUnsignedArrayWithIndexReversed.kt");
}
}
@Nested
@TestMetadata("compiler/testData/codegen/box/arrays/multiDecl")
@TestDataPath("$PROJECT_ROOT")
@@ -3005,6 +3005,24 @@ public class BytecodeTextTestGenerated extends AbstractBytecodeTextTest {
runTest("compiler/testData/codegen/bytecodeText/forLoop/unsigned/forInRangeToULongMaxValue.kt");
}
@Test
@TestMetadata("forInUnsignedArray.kt")
public void testForInUnsignedArray() throws Exception {
runTest("compiler/testData/codegen/bytecodeText/forLoop/unsigned/forInUnsignedArray.kt");
}
@Test
@TestMetadata("forInUnsignedArrayIndices.kt")
public void testForInUnsignedArrayIndices() throws Exception {
runTest("compiler/testData/codegen/bytecodeText/forLoop/unsigned/forInUnsignedArrayIndices.kt");
}
@Test
@TestMetadata("forInUnsignedArrayWithIndex.kt")
public void testForInUnsignedArrayWithIndex() throws Exception {
runTest("compiler/testData/codegen/bytecodeText/forLoop/unsigned/forInUnsignedArrayWithIndex.kt");
}
@Test
@TestMetadata("forInUntilUIntMaxValue.kt")
public void testForInUntilUIntMaxValue() throws Exception {
@@ -1234,6 +1234,64 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes
}
}
@Nested
@TestMetadata("compiler/testData/codegen/box/arrays/forInUnsignedArray")
@TestDataPath("$PROJECT_ROOT")
public class ForInUnsignedArray {
@Test
public void testAllFilesPresentInForInUnsignedArray() throws Exception {
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/arrays/forInUnsignedArray"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true);
}
@Test
@TestMetadata("forInUnsignedArray.kt")
public void testForInUnsignedArray() throws Exception {
runTest("compiler/testData/codegen/box/arrays/forInUnsignedArray/forInUnsignedArray.kt");
}
@Test
@TestMetadata("forInUnsignedArrayIndices.kt")
public void testForInUnsignedArrayIndices() throws Exception {
runTest("compiler/testData/codegen/box/arrays/forInUnsignedArray/forInUnsignedArrayIndices.kt");
}
@Test
@TestMetadata("forInUnsignedArrayIndicesReversed.kt")
public void testForInUnsignedArrayIndicesReversed() throws Exception {
runTest("compiler/testData/codegen/box/arrays/forInUnsignedArray/forInUnsignedArrayIndicesReversed.kt");
}
@Test
@TestMetadata("forInUnsignedArrayReversed.kt")
public void testForInUnsignedArrayReversed() throws Exception {
runTest("compiler/testData/codegen/box/arrays/forInUnsignedArray/forInUnsignedArrayReversed.kt");
}
@Test
@TestMetadata("forInUnsignedArrayWithIndex.kt")
public void testForInUnsignedArrayWithIndex() throws Exception {
runTest("compiler/testData/codegen/box/arrays/forInUnsignedArray/forInUnsignedArrayWithIndex.kt");
}
@Test
@TestMetadata("forInUnsignedArrayWithIndexNoElementVar.kt")
public void testForInUnsignedArrayWithIndexNoElementVar() throws Exception {
runTest("compiler/testData/codegen/box/arrays/forInUnsignedArray/forInUnsignedArrayWithIndexNoElementVar.kt");
}
@Test
@TestMetadata("forInUnsignedArrayWithIndexNoIndexVar.kt")
public void testForInUnsignedArrayWithIndexNoIndexVar() throws Exception {
runTest("compiler/testData/codegen/box/arrays/forInUnsignedArray/forInUnsignedArrayWithIndexNoIndexVar.kt");
}
@Test
@TestMetadata("forInUnsignedArrayWithIndexReversed.kt")
public void testForInUnsignedArrayWithIndexReversed() throws Exception {
runTest("compiler/testData/codegen/box/arrays/forInUnsignedArray/forInUnsignedArrayWithIndexReversed.kt");
}
}
@Nested
@TestMetadata("compiler/testData/codegen/box/arrays/multiDecl")
@TestDataPath("$PROJECT_ROOT")
@@ -3113,6 +3113,24 @@ public class IrBytecodeTextTestGenerated extends AbstractIrBytecodeTextTest {
runTest("compiler/testData/codegen/bytecodeText/forLoop/unsigned/forInRangeToULongMaxValue.kt");
}
@Test
@TestMetadata("forInUnsignedArray.kt")
public void testForInUnsignedArray() throws Exception {
runTest("compiler/testData/codegen/bytecodeText/forLoop/unsigned/forInUnsignedArray.kt");
}
@Test
@TestMetadata("forInUnsignedArrayIndices.kt")
public void testForInUnsignedArrayIndices() throws Exception {
runTest("compiler/testData/codegen/bytecodeText/forLoop/unsigned/forInUnsignedArrayIndices.kt");
}
@Test
@TestMetadata("forInUnsignedArrayWithIndex.kt")
public void testForInUnsignedArrayWithIndex() throws Exception {
runTest("compiler/testData/codegen/bytecodeText/forLoop/unsigned/forInUnsignedArrayWithIndex.kt");
}
@Test
@TestMetadata("forInUntilUIntMaxValue.kt")
public void testForInUntilUIntMaxValue() throws Exception {
@@ -1029,6 +1029,59 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes
}
}
@TestMetadata("compiler/testData/codegen/box/arrays/forInUnsignedArray")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public static class ForInUnsignedArray extends AbstractLightAnalysisModeTest {
private void runTest(String testDataFilePath) throws Exception {
KotlinTestUtils.runTest(this::doTest, TargetBackend.JVM, testDataFilePath);
}
public void testAllFilesPresentInForInUnsignedArray() throws Exception {
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/arrays/forInUnsignedArray"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM, true);
}
@TestMetadata("forInUnsignedArray.kt")
public void testForInUnsignedArray() throws Exception {
runTest("compiler/testData/codegen/box/arrays/forInUnsignedArray/forInUnsignedArray.kt");
}
@TestMetadata("forInUnsignedArrayIndices.kt")
public void testForInUnsignedArrayIndices() throws Exception {
runTest("compiler/testData/codegen/box/arrays/forInUnsignedArray/forInUnsignedArrayIndices.kt");
}
@TestMetadata("forInUnsignedArrayIndicesReversed.kt")
public void testForInUnsignedArrayIndicesReversed() throws Exception {
runTest("compiler/testData/codegen/box/arrays/forInUnsignedArray/forInUnsignedArrayIndicesReversed.kt");
}
@TestMetadata("forInUnsignedArrayReversed.kt")
public void testForInUnsignedArrayReversed() throws Exception {
runTest("compiler/testData/codegen/box/arrays/forInUnsignedArray/forInUnsignedArrayReversed.kt");
}
@TestMetadata("forInUnsignedArrayWithIndex.kt")
public void testForInUnsignedArrayWithIndex() throws Exception {
runTest("compiler/testData/codegen/box/arrays/forInUnsignedArray/forInUnsignedArrayWithIndex.kt");
}
@TestMetadata("forInUnsignedArrayWithIndexNoElementVar.kt")
public void testForInUnsignedArrayWithIndexNoElementVar() throws Exception {
runTest("compiler/testData/codegen/box/arrays/forInUnsignedArray/forInUnsignedArrayWithIndexNoElementVar.kt");
}
@TestMetadata("forInUnsignedArrayWithIndexNoIndexVar.kt")
public void testForInUnsignedArrayWithIndexNoIndexVar() throws Exception {
runTest("compiler/testData/codegen/box/arrays/forInUnsignedArray/forInUnsignedArrayWithIndexNoIndexVar.kt");
}
@TestMetadata("forInUnsignedArrayWithIndexReversed.kt")
public void testForInUnsignedArrayWithIndexReversed() throws Exception {
runTest("compiler/testData/codegen/box/arrays/forInUnsignedArray/forInUnsignedArrayWithIndexReversed.kt");
}
}
@TestMetadata("compiler/testData/codegen/box/arrays/multiDecl")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
@@ -659,6 +659,59 @@ public class IrJsCodegenBoxES6TestGenerated extends AbstractIrJsCodegenBoxES6Tes
}
}
@TestMetadata("compiler/testData/codegen/box/arrays/forInUnsignedArray")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public static class ForInUnsignedArray extends AbstractIrJsCodegenBoxES6Test {
private void runTest(String testDataFilePath) throws Exception {
KotlinTestUtils.runTest0(this::doTest, TargetBackend.JS_IR_ES6, testDataFilePath);
}
public void testAllFilesPresentInForInUnsignedArray() throws Exception {
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/arrays/forInUnsignedArray"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS_IR_ES6, true);
}
@TestMetadata("forInUnsignedArray.kt")
public void testForInUnsignedArray() throws Exception {
runTest("compiler/testData/codegen/box/arrays/forInUnsignedArray/forInUnsignedArray.kt");
}
@TestMetadata("forInUnsignedArrayIndices.kt")
public void testForInUnsignedArrayIndices() throws Exception {
runTest("compiler/testData/codegen/box/arrays/forInUnsignedArray/forInUnsignedArrayIndices.kt");
}
@TestMetadata("forInUnsignedArrayIndicesReversed.kt")
public void testForInUnsignedArrayIndicesReversed() throws Exception {
runTest("compiler/testData/codegen/box/arrays/forInUnsignedArray/forInUnsignedArrayIndicesReversed.kt");
}
@TestMetadata("forInUnsignedArrayReversed.kt")
public void testForInUnsignedArrayReversed() throws Exception {
runTest("compiler/testData/codegen/box/arrays/forInUnsignedArray/forInUnsignedArrayReversed.kt");
}
@TestMetadata("forInUnsignedArrayWithIndex.kt")
public void testForInUnsignedArrayWithIndex() throws Exception {
runTest("compiler/testData/codegen/box/arrays/forInUnsignedArray/forInUnsignedArrayWithIndex.kt");
}
@TestMetadata("forInUnsignedArrayWithIndexNoElementVar.kt")
public void testForInUnsignedArrayWithIndexNoElementVar() throws Exception {
runTest("compiler/testData/codegen/box/arrays/forInUnsignedArray/forInUnsignedArrayWithIndexNoElementVar.kt");
}
@TestMetadata("forInUnsignedArrayWithIndexNoIndexVar.kt")
public void testForInUnsignedArrayWithIndexNoIndexVar() throws Exception {
runTest("compiler/testData/codegen/box/arrays/forInUnsignedArray/forInUnsignedArrayWithIndexNoIndexVar.kt");
}
@TestMetadata("forInUnsignedArrayWithIndexReversed.kt")
public void testForInUnsignedArrayWithIndexReversed() throws Exception {
runTest("compiler/testData/codegen/box/arrays/forInUnsignedArray/forInUnsignedArrayWithIndexReversed.kt");
}
}
@TestMetadata("compiler/testData/codegen/box/arrays/multiDecl")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
@@ -659,6 +659,59 @@ public class IrJsCodegenBoxTestGenerated extends AbstractIrJsCodegenBoxTest {
}
}
@TestMetadata("compiler/testData/codegen/box/arrays/forInUnsignedArray")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public static class ForInUnsignedArray extends AbstractIrJsCodegenBoxTest {
private void runTest(String testDataFilePath) throws Exception {
KotlinTestUtils.runTest0(this::doTest, TargetBackend.JS_IR, testDataFilePath);
}
public void testAllFilesPresentInForInUnsignedArray() throws Exception {
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/arrays/forInUnsignedArray"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS_IR, true);
}
@TestMetadata("forInUnsignedArray.kt")
public void testForInUnsignedArray() throws Exception {
runTest("compiler/testData/codegen/box/arrays/forInUnsignedArray/forInUnsignedArray.kt");
}
@TestMetadata("forInUnsignedArrayIndices.kt")
public void testForInUnsignedArrayIndices() throws Exception {
runTest("compiler/testData/codegen/box/arrays/forInUnsignedArray/forInUnsignedArrayIndices.kt");
}
@TestMetadata("forInUnsignedArrayIndicesReversed.kt")
public void testForInUnsignedArrayIndicesReversed() throws Exception {
runTest("compiler/testData/codegen/box/arrays/forInUnsignedArray/forInUnsignedArrayIndicesReversed.kt");
}
@TestMetadata("forInUnsignedArrayReversed.kt")
public void testForInUnsignedArrayReversed() throws Exception {
runTest("compiler/testData/codegen/box/arrays/forInUnsignedArray/forInUnsignedArrayReversed.kt");
}
@TestMetadata("forInUnsignedArrayWithIndex.kt")
public void testForInUnsignedArrayWithIndex() throws Exception {
runTest("compiler/testData/codegen/box/arrays/forInUnsignedArray/forInUnsignedArrayWithIndex.kt");
}
@TestMetadata("forInUnsignedArrayWithIndexNoElementVar.kt")
public void testForInUnsignedArrayWithIndexNoElementVar() throws Exception {
runTest("compiler/testData/codegen/box/arrays/forInUnsignedArray/forInUnsignedArrayWithIndexNoElementVar.kt");
}
@TestMetadata("forInUnsignedArrayWithIndexNoIndexVar.kt")
public void testForInUnsignedArrayWithIndexNoIndexVar() throws Exception {
runTest("compiler/testData/codegen/box/arrays/forInUnsignedArray/forInUnsignedArrayWithIndexNoIndexVar.kt");
}
@TestMetadata("forInUnsignedArrayWithIndexReversed.kt")
public void testForInUnsignedArrayWithIndexReversed() throws Exception {
runTest("compiler/testData/codegen/box/arrays/forInUnsignedArray/forInUnsignedArrayWithIndexReversed.kt");
}
}
@TestMetadata("compiler/testData/codegen/box/arrays/multiDecl")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
@@ -624,6 +624,59 @@ public class JsCodegenBoxTestGenerated extends AbstractJsCodegenBoxTest {
}
}
@TestMetadata("compiler/testData/codegen/box/arrays/forInUnsignedArray")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public static class ForInUnsignedArray extends AbstractJsCodegenBoxTest {
private void runTest(String testDataFilePath) throws Exception {
KotlinTestUtils.runTest0(this::doTest, TargetBackend.JS, testDataFilePath);
}
public void testAllFilesPresentInForInUnsignedArray() throws Exception {
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/arrays/forInUnsignedArray"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS, true);
}
@TestMetadata("forInUnsignedArray.kt")
public void testForInUnsignedArray() throws Exception {
runTest("compiler/testData/codegen/box/arrays/forInUnsignedArray/forInUnsignedArray.kt");
}
@TestMetadata("forInUnsignedArrayIndices.kt")
public void testForInUnsignedArrayIndices() throws Exception {
runTest("compiler/testData/codegen/box/arrays/forInUnsignedArray/forInUnsignedArrayIndices.kt");
}
@TestMetadata("forInUnsignedArrayIndicesReversed.kt")
public void testForInUnsignedArrayIndicesReversed() throws Exception {
runTest("compiler/testData/codegen/box/arrays/forInUnsignedArray/forInUnsignedArrayIndicesReversed.kt");
}
@TestMetadata("forInUnsignedArrayReversed.kt")
public void testForInUnsignedArrayReversed() throws Exception {
runTest("compiler/testData/codegen/box/arrays/forInUnsignedArray/forInUnsignedArrayReversed.kt");
}
@TestMetadata("forInUnsignedArrayWithIndex.kt")
public void testForInUnsignedArrayWithIndex() throws Exception {
runTest("compiler/testData/codegen/box/arrays/forInUnsignedArray/forInUnsignedArrayWithIndex.kt");
}
@TestMetadata("forInUnsignedArrayWithIndexNoElementVar.kt")
public void testForInUnsignedArrayWithIndexNoElementVar() throws Exception {
runTest("compiler/testData/codegen/box/arrays/forInUnsignedArray/forInUnsignedArrayWithIndexNoElementVar.kt");
}
@TestMetadata("forInUnsignedArrayWithIndexNoIndexVar.kt")
public void testForInUnsignedArrayWithIndexNoIndexVar() throws Exception {
runTest("compiler/testData/codegen/box/arrays/forInUnsignedArray/forInUnsignedArrayWithIndexNoIndexVar.kt");
}
@TestMetadata("forInUnsignedArrayWithIndexReversed.kt")
public void testForInUnsignedArrayWithIndexReversed() throws Exception {
runTest("compiler/testData/codegen/box/arrays/forInUnsignedArray/forInUnsignedArrayWithIndexReversed.kt");
}
}
@TestMetadata("compiler/testData/codegen/box/arrays/multiDecl")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
@@ -406,6 +406,59 @@ public class JsLegacyPrimitiveArraysBoxTestGenerated extends AbstractJsLegacyPri
}
}
@TestMetadata("compiler/testData/codegen/box/arrays/forInUnsignedArray")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public static class ForInUnsignedArray extends AbstractJsLegacyPrimitiveArraysBoxTest {
private void runTest(String testDataFilePath) throws Exception {
KotlinTestUtils.runTest0(this::doTest, TargetBackend.JS, testDataFilePath);
}
public void testAllFilesPresentInForInUnsignedArray() throws Exception {
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/arrays/forInUnsignedArray"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS, true);
}
@TestMetadata("forInUnsignedArray.kt")
public void testForInUnsignedArray() throws Exception {
runTest("compiler/testData/codegen/box/arrays/forInUnsignedArray/forInUnsignedArray.kt");
}
@TestMetadata("forInUnsignedArrayIndices.kt")
public void testForInUnsignedArrayIndices() throws Exception {
runTest("compiler/testData/codegen/box/arrays/forInUnsignedArray/forInUnsignedArrayIndices.kt");
}
@TestMetadata("forInUnsignedArrayIndicesReversed.kt")
public void testForInUnsignedArrayIndicesReversed() throws Exception {
runTest("compiler/testData/codegen/box/arrays/forInUnsignedArray/forInUnsignedArrayIndicesReversed.kt");
}
@TestMetadata("forInUnsignedArrayReversed.kt")
public void testForInUnsignedArrayReversed() throws Exception {
runTest("compiler/testData/codegen/box/arrays/forInUnsignedArray/forInUnsignedArrayReversed.kt");
}
@TestMetadata("forInUnsignedArrayWithIndex.kt")
public void testForInUnsignedArrayWithIndex() throws Exception {
runTest("compiler/testData/codegen/box/arrays/forInUnsignedArray/forInUnsignedArrayWithIndex.kt");
}
@TestMetadata("forInUnsignedArrayWithIndexNoElementVar.kt")
public void testForInUnsignedArrayWithIndexNoElementVar() throws Exception {
runTest("compiler/testData/codegen/box/arrays/forInUnsignedArray/forInUnsignedArrayWithIndexNoElementVar.kt");
}
@TestMetadata("forInUnsignedArrayWithIndexNoIndexVar.kt")
public void testForInUnsignedArrayWithIndexNoIndexVar() throws Exception {
runTest("compiler/testData/codegen/box/arrays/forInUnsignedArray/forInUnsignedArrayWithIndexNoIndexVar.kt");
}
@TestMetadata("forInUnsignedArrayWithIndexReversed.kt")
public void testForInUnsignedArrayWithIndexReversed() throws Exception {
runTest("compiler/testData/codegen/box/arrays/forInUnsignedArray/forInUnsignedArrayWithIndexReversed.kt");
}
}
@TestMetadata("compiler/testData/codegen/box/arrays/multiDecl")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
@@ -579,6 +579,59 @@ public class IrCodegenBoxWasmTestGenerated extends AbstractIrCodegenBoxWasmTest
}
}
@TestMetadata("compiler/testData/codegen/box/arrays/forInUnsignedArray")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public static class ForInUnsignedArray extends AbstractIrCodegenBoxWasmTest {
private void runTest(String testDataFilePath) throws Exception {
KotlinTestUtils.runTest0(this::doTest, TargetBackend.WASM, testDataFilePath);
}
public void testAllFilesPresentInForInUnsignedArray() throws Exception {
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/arrays/forInUnsignedArray"), Pattern.compile("^([^_](.+))\\.kt$"), null, TargetBackend.WASM, true);
}
@TestMetadata("forInUnsignedArray.kt")
public void testForInUnsignedArray() throws Exception {
runTest("compiler/testData/codegen/box/arrays/forInUnsignedArray/forInUnsignedArray.kt");
}
@TestMetadata("forInUnsignedArrayIndices.kt")
public void testForInUnsignedArrayIndices() throws Exception {
runTest("compiler/testData/codegen/box/arrays/forInUnsignedArray/forInUnsignedArrayIndices.kt");
}
@TestMetadata("forInUnsignedArrayIndicesReversed.kt")
public void testForInUnsignedArrayIndicesReversed() throws Exception {
runTest("compiler/testData/codegen/box/arrays/forInUnsignedArray/forInUnsignedArrayIndicesReversed.kt");
}
@TestMetadata("forInUnsignedArrayReversed.kt")
public void testForInUnsignedArrayReversed() throws Exception {
runTest("compiler/testData/codegen/box/arrays/forInUnsignedArray/forInUnsignedArrayReversed.kt");
}
@TestMetadata("forInUnsignedArrayWithIndex.kt")
public void testForInUnsignedArrayWithIndex() throws Exception {
runTest("compiler/testData/codegen/box/arrays/forInUnsignedArray/forInUnsignedArrayWithIndex.kt");
}
@TestMetadata("forInUnsignedArrayWithIndexNoElementVar.kt")
public void testForInUnsignedArrayWithIndexNoElementVar() throws Exception {
runTest("compiler/testData/codegen/box/arrays/forInUnsignedArray/forInUnsignedArrayWithIndexNoElementVar.kt");
}
@TestMetadata("forInUnsignedArrayWithIndexNoIndexVar.kt")
public void testForInUnsignedArrayWithIndexNoIndexVar() throws Exception {
runTest("compiler/testData/codegen/box/arrays/forInUnsignedArray/forInUnsignedArrayWithIndexNoIndexVar.kt");
}
@TestMetadata("forInUnsignedArrayWithIndexReversed.kt")
public void testForInUnsignedArrayWithIndexReversed() throws Exception {
runTest("compiler/testData/codegen/box/arrays/forInUnsignedArray/forInUnsignedArrayWithIndexReversed.kt");
}
}
@TestMetadata("compiler/testData/codegen/box/arrays/multiDecl")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)