This commit is contained in:
Generated
+10
@@ -22572,6 +22572,16 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT
|
|||||||
public void testKt13241_Collection() throws Exception {
|
public void testKt13241_Collection() throws Exception {
|
||||||
runTest("compiler/testData/codegen/box/ranges/forInIndices/kt13241_Collection.kt");
|
runTest("compiler/testData/codegen/box/ranges/forInIndices/kt13241_Collection.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("kt43159_ArrayUpperBound.kt")
|
||||||
|
public void testKt43159_ArrayUpperBound() throws Exception {
|
||||||
|
runTest("compiler/testData/codegen/box/ranges/forInIndices/kt43159_ArrayUpperBound.kt");
|
||||||
|
}
|
||||||
|
|
||||||
|
@TestMetadata("kt43159_GenericArray.kt")
|
||||||
|
public void testKt43159_GenericArray() throws Exception {
|
||||||
|
runTest("compiler/testData/codegen/box/ranges/forInIndices/kt43159_GenericArray.kt");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestMetadata("compiler/testData/codegen/box/ranges/forInProgressionWithIndex")
|
@TestMetadata("compiler/testData/codegen/box/ranges/forInProgressionWithIndex")
|
||||||
|
|||||||
+2
-3
@@ -26,9 +26,8 @@ internal abstract class IndicesHandler(protected val context: CommonBackendConte
|
|||||||
override fun build(expression: IrCall, data: ProgressionType, scopeOwner: IrSymbol): HeaderInfo? =
|
override fun build(expression: IrCall, data: ProgressionType, scopeOwner: IrSymbol): HeaderInfo? =
|
||||||
with(context.createIrBuilder(scopeOwner, expression.startOffset, expression.endOffset)) {
|
with(context.createIrBuilder(scopeOwner, expression.startOffset, expression.endOffset)) {
|
||||||
// `last = array.size - 1` (last is inclusive) for the loop `for (i in array.indices)`.
|
// `last = array.size - 1` (last is inclusive) for the loop `for (i in array.indices)`.
|
||||||
val receiver = expression.extensionReceiver!!
|
val last = irCall(expression.symbol.owner.extensionReceiverParameter!!.type.sizePropertyGetter).apply {
|
||||||
val last = irCall(receiver.type.sizePropertyGetter).apply {
|
dispatchReceiver = expression.extensionReceiver!!
|
||||||
dispatchReceiver = receiver
|
|
||||||
}.decrement()
|
}.decrement()
|
||||||
|
|
||||||
ProgressionHeaderInfo(
|
ProgressionHeaderInfo(
|
||||||
|
|||||||
@@ -0,0 +1,16 @@
|
|||||||
|
// KJS_WITH_FULL_RUNTIME
|
||||||
|
// WITH_RUNTIME
|
||||||
|
// IGNORE_BACKEND: JVM, JVM_IR
|
||||||
|
|
||||||
|
fun <T : IntArray> test(array: T): Int {
|
||||||
|
var sum = 0
|
||||||
|
for (i in array.indices) {
|
||||||
|
sum = sum * 10 + i
|
||||||
|
}
|
||||||
|
return sum
|
||||||
|
}
|
||||||
|
|
||||||
|
fun box(): String {
|
||||||
|
if (test(intArrayOf(0, 0, 0, 0)) != 123) return "fail"
|
||||||
|
return "OK"
|
||||||
|
}
|
||||||
@@ -0,0 +1,19 @@
|
|||||||
|
// KJS_WITH_FULL_RUNTIME
|
||||||
|
// WITH_RUNTIME
|
||||||
|
|
||||||
|
class Value<T>(val value: T) {
|
||||||
|
inline fun <R> runBlock(block: (T) -> R) = block(value)
|
||||||
|
}
|
||||||
|
|
||||||
|
fun <T> Value<Array<T>>.test() =
|
||||||
|
runBlock {
|
||||||
|
var sum = 0
|
||||||
|
for (i in it.indices)
|
||||||
|
sum = sum * 10 + i
|
||||||
|
sum
|
||||||
|
}
|
||||||
|
|
||||||
|
fun box(): String {
|
||||||
|
if (Value<Array<Int>>(Array<Int>(4) { 0 }).test() != 123) return "fail"
|
||||||
|
return "OK"
|
||||||
|
}
|
||||||
+10
@@ -24343,6 +24343,16 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest {
|
|||||||
public void testKt13241_Collection() throws Exception {
|
public void testKt13241_Collection() throws Exception {
|
||||||
runTest("compiler/testData/codegen/box/ranges/forInIndices/kt13241_Collection.kt");
|
runTest("compiler/testData/codegen/box/ranges/forInIndices/kt13241_Collection.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("kt43159_ArrayUpperBound.kt")
|
||||||
|
public void testKt43159_ArrayUpperBound() throws Exception {
|
||||||
|
runTest("compiler/testData/codegen/box/ranges/forInIndices/kt43159_ArrayUpperBound.kt");
|
||||||
|
}
|
||||||
|
|
||||||
|
@TestMetadata("kt43159_GenericArray.kt")
|
||||||
|
public void testKt43159_GenericArray() throws Exception {
|
||||||
|
runTest("compiler/testData/codegen/box/ranges/forInIndices/kt43159_GenericArray.kt");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestMetadata("compiler/testData/codegen/box/ranges/forInProgressionWithIndex")
|
@TestMetadata("compiler/testData/codegen/box/ranges/forInProgressionWithIndex")
|
||||||
|
|||||||
+10
@@ -24241,6 +24241,11 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes
|
|||||||
@TestDataPath("$PROJECT_ROOT")
|
@TestDataPath("$PROJECT_ROOT")
|
||||||
@RunWith(JUnit3RunnerWithInners.class)
|
@RunWith(JUnit3RunnerWithInners.class)
|
||||||
public static class ForInIndices extends AbstractLightAnalysisModeTest {
|
public static class ForInIndices extends AbstractLightAnalysisModeTest {
|
||||||
|
@TestMetadata("kt43159_ArrayUpperBound.kt")
|
||||||
|
public void ignoreKt43159_ArrayUpperBound() throws Exception {
|
||||||
|
runTest("compiler/testData/codegen/box/ranges/forInIndices/kt43159_ArrayUpperBound.kt");
|
||||||
|
}
|
||||||
|
|
||||||
private void runTest(String testDataFilePath) throws Exception {
|
private void runTest(String testDataFilePath) throws Exception {
|
||||||
KotlinTestUtils.runTest(this::doTest, TargetBackend.JVM, testDataFilePath);
|
KotlinTestUtils.runTest(this::doTest, TargetBackend.JVM, testDataFilePath);
|
||||||
}
|
}
|
||||||
@@ -24343,6 +24348,11 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes
|
|||||||
public void testKt13241_Collection() throws Exception {
|
public void testKt13241_Collection() throws Exception {
|
||||||
runTest("compiler/testData/codegen/box/ranges/forInIndices/kt13241_Collection.kt");
|
runTest("compiler/testData/codegen/box/ranges/forInIndices/kt13241_Collection.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("kt43159_GenericArray.kt")
|
||||||
|
public void testKt43159_GenericArray() throws Exception {
|
||||||
|
runTest("compiler/testData/codegen/box/ranges/forInIndices/kt43159_GenericArray.kt");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestMetadata("compiler/testData/codegen/box/ranges/forInProgressionWithIndex")
|
@TestMetadata("compiler/testData/codegen/box/ranges/forInProgressionWithIndex")
|
||||||
|
|||||||
+10
@@ -22572,6 +22572,16 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes
|
|||||||
public void testKt13241_Collection() throws Exception {
|
public void testKt13241_Collection() throws Exception {
|
||||||
runTest("compiler/testData/codegen/box/ranges/forInIndices/kt13241_Collection.kt");
|
runTest("compiler/testData/codegen/box/ranges/forInIndices/kt13241_Collection.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("kt43159_ArrayUpperBound.kt")
|
||||||
|
public void testKt43159_ArrayUpperBound() throws Exception {
|
||||||
|
runTest("compiler/testData/codegen/box/ranges/forInIndices/kt43159_ArrayUpperBound.kt");
|
||||||
|
}
|
||||||
|
|
||||||
|
@TestMetadata("kt43159_GenericArray.kt")
|
||||||
|
public void testKt43159_GenericArray() throws Exception {
|
||||||
|
runTest("compiler/testData/codegen/box/ranges/forInIndices/kt43159_GenericArray.kt");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestMetadata("compiler/testData/codegen/box/ranges/forInProgressionWithIndex")
|
@TestMetadata("compiler/testData/codegen/box/ranges/forInProgressionWithIndex")
|
||||||
|
|||||||
Generated
+10
@@ -18793,6 +18793,16 @@ public class IrJsCodegenBoxES6TestGenerated extends AbstractIrJsCodegenBoxES6Tes
|
|||||||
public void testKt13241_Collection() throws Exception {
|
public void testKt13241_Collection() throws Exception {
|
||||||
runTest("compiler/testData/codegen/box/ranges/forInIndices/kt13241_Collection.kt");
|
runTest("compiler/testData/codegen/box/ranges/forInIndices/kt13241_Collection.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("kt43159_ArrayUpperBound.kt")
|
||||||
|
public void testKt43159_ArrayUpperBound() throws Exception {
|
||||||
|
runTest("compiler/testData/codegen/box/ranges/forInIndices/kt43159_ArrayUpperBound.kt");
|
||||||
|
}
|
||||||
|
|
||||||
|
@TestMetadata("kt43159_GenericArray.kt")
|
||||||
|
public void testKt43159_GenericArray() throws Exception {
|
||||||
|
runTest("compiler/testData/codegen/box/ranges/forInIndices/kt43159_GenericArray.kt");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestMetadata("compiler/testData/codegen/box/ranges/forInProgressionWithIndex")
|
@TestMetadata("compiler/testData/codegen/box/ranges/forInProgressionWithIndex")
|
||||||
|
|||||||
Generated
+10
@@ -18793,6 +18793,16 @@ public class IrJsCodegenBoxTestGenerated extends AbstractIrJsCodegenBoxTest {
|
|||||||
public void testKt13241_Collection() throws Exception {
|
public void testKt13241_Collection() throws Exception {
|
||||||
runTest("compiler/testData/codegen/box/ranges/forInIndices/kt13241_Collection.kt");
|
runTest("compiler/testData/codegen/box/ranges/forInIndices/kt13241_Collection.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("kt43159_ArrayUpperBound.kt")
|
||||||
|
public void testKt43159_ArrayUpperBound() throws Exception {
|
||||||
|
runTest("compiler/testData/codegen/box/ranges/forInIndices/kt43159_ArrayUpperBound.kt");
|
||||||
|
}
|
||||||
|
|
||||||
|
@TestMetadata("kt43159_GenericArray.kt")
|
||||||
|
public void testKt43159_GenericArray() throws Exception {
|
||||||
|
runTest("compiler/testData/codegen/box/ranges/forInIndices/kt43159_GenericArray.kt");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestMetadata("compiler/testData/codegen/box/ranges/forInProgressionWithIndex")
|
@TestMetadata("compiler/testData/codegen/box/ranges/forInProgressionWithIndex")
|
||||||
|
|||||||
+10
@@ -18898,6 +18898,16 @@ public class JsCodegenBoxTestGenerated extends AbstractJsCodegenBoxTest {
|
|||||||
public void testKt13241_Collection() throws Exception {
|
public void testKt13241_Collection() throws Exception {
|
||||||
runTest("compiler/testData/codegen/box/ranges/forInIndices/kt13241_Collection.kt");
|
runTest("compiler/testData/codegen/box/ranges/forInIndices/kt13241_Collection.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("kt43159_ArrayUpperBound.kt")
|
||||||
|
public void testKt43159_ArrayUpperBound() throws Exception {
|
||||||
|
runTest("compiler/testData/codegen/box/ranges/forInIndices/kt43159_ArrayUpperBound.kt");
|
||||||
|
}
|
||||||
|
|
||||||
|
@TestMetadata("kt43159_GenericArray.kt")
|
||||||
|
public void testKt43159_GenericArray() throws Exception {
|
||||||
|
runTest("compiler/testData/codegen/box/ranges/forInIndices/kt43159_GenericArray.kt");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestMetadata("compiler/testData/codegen/box/ranges/forInProgressionWithIndex")
|
@TestMetadata("compiler/testData/codegen/box/ranges/forInProgressionWithIndex")
|
||||||
|
|||||||
Reference in New Issue
Block a user