Minor: add tests for KT-45893
This commit is contained in:
+12
@@ -28390,6 +28390,18 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT
|
|||||||
runTest("compiler/testData/codegen/box/ranges/forInCustomIterable.kt");
|
runTest("compiler/testData/codegen/box/ranges/forInCustomIterable.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("forInDoubleRangeWithCustomIterator.kt")
|
||||||
|
public void testForInDoubleRangeWithCustomIterator() throws Exception {
|
||||||
|
runTest("compiler/testData/codegen/box/ranges/forInDoubleRangeWithCustomIterator.kt");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("forInFloatRangeWithCustomIterator.kt")
|
||||||
|
public void testForInFloatRangeWithCustomIterator() throws Exception {
|
||||||
|
runTest("compiler/testData/codegen/box/ranges/forInFloatRangeWithCustomIterator.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@TestMetadata("forInRangeLiteralWithMixedTypeBounds.kt")
|
@TestMetadata("forInRangeLiteralWithMixedTypeBounds.kt")
|
||||||
public void testForInRangeLiteralWithMixedTypeBounds() throws Exception {
|
public void testForInRangeLiteralWithMixedTypeBounds() throws Exception {
|
||||||
|
|||||||
@@ -0,0 +1,29 @@
|
|||||||
|
// IGNORE_BACKEND: JVM
|
||||||
|
// WITH_RUNTIME
|
||||||
|
// KJS_WITH_FULL_RUNTIME
|
||||||
|
|
||||||
|
operator fun ClosedRange<Double>.iterator() =
|
||||||
|
object : Iterator<Double> {
|
||||||
|
private var current = this@iterator.start
|
||||||
|
private val end = this@iterator.endInclusive
|
||||||
|
|
||||||
|
override fun hasNext(): Boolean =
|
||||||
|
current <= end
|
||||||
|
|
||||||
|
override fun next(): Double {
|
||||||
|
val next = current
|
||||||
|
current += 0.1
|
||||||
|
return next
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fun box(): String {
|
||||||
|
var s = 0.0
|
||||||
|
for (x in 0.0 .. 1.0) {
|
||||||
|
s += x
|
||||||
|
}
|
||||||
|
if (s != 5.5)
|
||||||
|
return "Failed: $s"
|
||||||
|
|
||||||
|
return "OK"
|
||||||
|
}
|
||||||
@@ -0,0 +1,29 @@
|
|||||||
|
// IGNORE_BACKEND: JVM
|
||||||
|
// WITH_RUNTIME
|
||||||
|
// KJS_WITH_FULL_RUNTIME
|
||||||
|
|
||||||
|
operator fun ClosedRange<Float>.iterator() =
|
||||||
|
object : Iterator<Float> {
|
||||||
|
private var current = this@iterator.start
|
||||||
|
private val end = this@iterator.endInclusive
|
||||||
|
|
||||||
|
override fun hasNext(): Boolean =
|
||||||
|
current <= end
|
||||||
|
|
||||||
|
override fun next(): Float {
|
||||||
|
val next = current
|
||||||
|
current += 0.125f
|
||||||
|
return next
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fun box(): String {
|
||||||
|
var s = 0.0
|
||||||
|
for (x in 0.0f .. 1.0f) {
|
||||||
|
s += x
|
||||||
|
}
|
||||||
|
if (s != 4.5)
|
||||||
|
return "Failed: $s"
|
||||||
|
|
||||||
|
return "OK"
|
||||||
|
}
|
||||||
+12
@@ -28372,6 +28372,18 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest {
|
|||||||
runTest("compiler/testData/codegen/box/ranges/forInCustomIterable.kt");
|
runTest("compiler/testData/codegen/box/ranges/forInCustomIterable.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("forInDoubleRangeWithCustomIterator.kt")
|
||||||
|
public void testForInDoubleRangeWithCustomIterator() throws Exception {
|
||||||
|
runTest("compiler/testData/codegen/box/ranges/forInDoubleRangeWithCustomIterator.kt");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("forInFloatRangeWithCustomIterator.kt")
|
||||||
|
public void testForInFloatRangeWithCustomIterator() throws Exception {
|
||||||
|
runTest("compiler/testData/codegen/box/ranges/forInFloatRangeWithCustomIterator.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@TestMetadata("forInRangeLiteralWithMixedTypeBounds.kt")
|
@TestMetadata("forInRangeLiteralWithMixedTypeBounds.kt")
|
||||||
public void testForInRangeLiteralWithMixedTypeBounds() throws Exception {
|
public void testForInRangeLiteralWithMixedTypeBounds() throws Exception {
|
||||||
|
|||||||
+12
@@ -28390,6 +28390,18 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes
|
|||||||
runTest("compiler/testData/codegen/box/ranges/forInCustomIterable.kt");
|
runTest("compiler/testData/codegen/box/ranges/forInCustomIterable.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("forInDoubleRangeWithCustomIterator.kt")
|
||||||
|
public void testForInDoubleRangeWithCustomIterator() throws Exception {
|
||||||
|
runTest("compiler/testData/codegen/box/ranges/forInDoubleRangeWithCustomIterator.kt");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("forInFloatRangeWithCustomIterator.kt")
|
||||||
|
public void testForInFloatRangeWithCustomIterator() throws Exception {
|
||||||
|
runTest("compiler/testData/codegen/box/ranges/forInFloatRangeWithCustomIterator.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@TestMetadata("forInRangeLiteralWithMixedTypeBounds.kt")
|
@TestMetadata("forInRangeLiteralWithMixedTypeBounds.kt")
|
||||||
public void testForInRangeLiteralWithMixedTypeBounds() throws Exception {
|
public void testForInRangeLiteralWithMixedTypeBounds() throws Exception {
|
||||||
|
|||||||
+10
@@ -24124,6 +24124,16 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes
|
|||||||
runTest("compiler/testData/codegen/box/ranges/forInCustomIterable.kt");
|
runTest("compiler/testData/codegen/box/ranges/forInCustomIterable.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("forInDoubleRangeWithCustomIterator.kt")
|
||||||
|
public void testForInDoubleRangeWithCustomIterator() throws Exception {
|
||||||
|
runTest("compiler/testData/codegen/box/ranges/forInDoubleRangeWithCustomIterator.kt");
|
||||||
|
}
|
||||||
|
|
||||||
|
@TestMetadata("forInFloatRangeWithCustomIterator.kt")
|
||||||
|
public void testForInFloatRangeWithCustomIterator() throws Exception {
|
||||||
|
runTest("compiler/testData/codegen/box/ranges/forInFloatRangeWithCustomIterator.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("forInRangeLiteralWithMixedTypeBounds.kt")
|
@TestMetadata("forInRangeLiteralWithMixedTypeBounds.kt")
|
||||||
public void testForInRangeLiteralWithMixedTypeBounds() throws Exception {
|
public void testForInRangeLiteralWithMixedTypeBounds() throws Exception {
|
||||||
runTest("compiler/testData/codegen/box/ranges/forInRangeLiteralWithMixedTypeBounds.kt");
|
runTest("compiler/testData/codegen/box/ranges/forInRangeLiteralWithMixedTypeBounds.kt");
|
||||||
|
|||||||
js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/es6/semantics/IrJsCodegenBoxES6TestGenerated.java
Generated
+10
@@ -19213,6 +19213,16 @@ public class IrJsCodegenBoxES6TestGenerated extends AbstractIrJsCodegenBoxES6Tes
|
|||||||
runTest("compiler/testData/codegen/box/ranges/forInCustomIterable.kt");
|
runTest("compiler/testData/codegen/box/ranges/forInCustomIterable.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("forInDoubleRangeWithCustomIterator.kt")
|
||||||
|
public void testForInDoubleRangeWithCustomIterator() throws Exception {
|
||||||
|
runTest("compiler/testData/codegen/box/ranges/forInDoubleRangeWithCustomIterator.kt");
|
||||||
|
}
|
||||||
|
|
||||||
|
@TestMetadata("forInFloatRangeWithCustomIterator.kt")
|
||||||
|
public void testForInFloatRangeWithCustomIterator() throws Exception {
|
||||||
|
runTest("compiler/testData/codegen/box/ranges/forInFloatRangeWithCustomIterator.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("forInRangeLiteralWithMixedTypeBounds.kt")
|
@TestMetadata("forInRangeLiteralWithMixedTypeBounds.kt")
|
||||||
public void testForInRangeLiteralWithMixedTypeBounds() throws Exception {
|
public void testForInRangeLiteralWithMixedTypeBounds() throws Exception {
|
||||||
runTest("compiler/testData/codegen/box/ranges/forInRangeLiteralWithMixedTypeBounds.kt");
|
runTest("compiler/testData/codegen/box/ranges/forInRangeLiteralWithMixedTypeBounds.kt");
|
||||||
|
|||||||
Generated
+10
@@ -18634,6 +18634,16 @@ public class IrJsCodegenBoxTestGenerated extends AbstractIrJsCodegenBoxTest {
|
|||||||
runTest("compiler/testData/codegen/box/ranges/forInCustomIterable.kt");
|
runTest("compiler/testData/codegen/box/ranges/forInCustomIterable.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("forInDoubleRangeWithCustomIterator.kt")
|
||||||
|
public void testForInDoubleRangeWithCustomIterator() throws Exception {
|
||||||
|
runTest("compiler/testData/codegen/box/ranges/forInDoubleRangeWithCustomIterator.kt");
|
||||||
|
}
|
||||||
|
|
||||||
|
@TestMetadata("forInFloatRangeWithCustomIterator.kt")
|
||||||
|
public void testForInFloatRangeWithCustomIterator() throws Exception {
|
||||||
|
runTest("compiler/testData/codegen/box/ranges/forInFloatRangeWithCustomIterator.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("forInRangeLiteralWithMixedTypeBounds.kt")
|
@TestMetadata("forInRangeLiteralWithMixedTypeBounds.kt")
|
||||||
public void testForInRangeLiteralWithMixedTypeBounds() throws Exception {
|
public void testForInRangeLiteralWithMixedTypeBounds() throws Exception {
|
||||||
runTest("compiler/testData/codegen/box/ranges/forInRangeLiteralWithMixedTypeBounds.kt");
|
runTest("compiler/testData/codegen/box/ranges/forInRangeLiteralWithMixedTypeBounds.kt");
|
||||||
|
|||||||
Generated
+10
@@ -18684,6 +18684,16 @@ public class JsCodegenBoxTestGenerated extends AbstractJsCodegenBoxTest {
|
|||||||
runTest("compiler/testData/codegen/box/ranges/forInCustomIterable.kt");
|
runTest("compiler/testData/codegen/box/ranges/forInCustomIterable.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("forInDoubleRangeWithCustomIterator.kt")
|
||||||
|
public void testForInDoubleRangeWithCustomIterator() throws Exception {
|
||||||
|
runTest("compiler/testData/codegen/box/ranges/forInDoubleRangeWithCustomIterator.kt");
|
||||||
|
}
|
||||||
|
|
||||||
|
@TestMetadata("forInFloatRangeWithCustomIterator.kt")
|
||||||
|
public void testForInFloatRangeWithCustomIterator() throws Exception {
|
||||||
|
runTest("compiler/testData/codegen/box/ranges/forInFloatRangeWithCustomIterator.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("forInRangeLiteralWithMixedTypeBounds.kt")
|
@TestMetadata("forInRangeLiteralWithMixedTypeBounds.kt")
|
||||||
public void testForInRangeLiteralWithMixedTypeBounds() throws Exception {
|
public void testForInRangeLiteralWithMixedTypeBounds() throws Exception {
|
||||||
runTest("compiler/testData/codegen/box/ranges/forInRangeLiteralWithMixedTypeBounds.kt");
|
runTest("compiler/testData/codegen/box/ranges/forInRangeLiteralWithMixedTypeBounds.kt");
|
||||||
|
|||||||
js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/wasm/semantics/IrCodegenBoxWasmTestGenerated.java
Generated
+10
@@ -11971,6 +11971,16 @@ public class IrCodegenBoxWasmTestGenerated extends AbstractIrCodegenBoxWasmTest
|
|||||||
runTest("compiler/testData/codegen/box/ranges/forByteProgressionWithIntIncrement.kt");
|
runTest("compiler/testData/codegen/box/ranges/forByteProgressionWithIntIncrement.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("forInDoubleRangeWithCustomIterator.kt")
|
||||||
|
public void testForInDoubleRangeWithCustomIterator() throws Exception {
|
||||||
|
runTest("compiler/testData/codegen/box/ranges/forInDoubleRangeWithCustomIterator.kt");
|
||||||
|
}
|
||||||
|
|
||||||
|
@TestMetadata("forInFloatRangeWithCustomIterator.kt")
|
||||||
|
public void testForInFloatRangeWithCustomIterator() throws Exception {
|
||||||
|
runTest("compiler/testData/codegen/box/ranges/forInFloatRangeWithCustomIterator.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("forInRangeLiteralWithMixedTypeBounds.kt")
|
@TestMetadata("forInRangeLiteralWithMixedTypeBounds.kt")
|
||||||
public void testForInRangeLiteralWithMixedTypeBounds() throws Exception {
|
public void testForInRangeLiteralWithMixedTypeBounds() throws Exception {
|
||||||
runTest("compiler/testData/codegen/box/ranges/forInRangeLiteralWithMixedTypeBounds.kt");
|
runTest("compiler/testData/codegen/box/ranges/forInRangeLiteralWithMixedTypeBounds.kt");
|
||||||
|
|||||||
Reference in New Issue
Block a user