[IR] Add for statement to tests for MFVC returning from inline functions
Signed-off-by: Evgeniy.Zhelenskiy <Evgeniy.Zhelenskiy@jetbrains.com> #KT-1179
This commit is contained in:
committed by
Space Team
parent
19424702e0
commit
9b3fc34f78
@@ -42,6 +42,25 @@ import kotlin.math.sqrt
|
|||||||
|
|
||||||
fun supply(x: Any?) = Unit
|
fun supply(x: Any?) = Unit
|
||||||
|
|
||||||
|
object InfiniteDPoints {
|
||||||
|
class DPointsIterator {
|
||||||
|
@PublishedApi
|
||||||
|
internal var i = 1.0
|
||||||
|
inline operator fun next() = DPoint(i, -i).also { i++ }
|
||||||
|
inline operator fun hasNext() = true
|
||||||
|
}
|
||||||
|
operator fun iterator() = DPointsIterator()
|
||||||
|
}
|
||||||
|
|
||||||
|
fun forStatement() {
|
||||||
|
var i = 1.0
|
||||||
|
for (x in InfiniteDPoints) {
|
||||||
|
require(x == DPoint(i, -i))
|
||||||
|
i++
|
||||||
|
if (i == 5.0) break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
fun box(): String {
|
fun box(): String {
|
||||||
val point = DPoint(1.0, 2.0)
|
val point = DPoint(1.0, 2.0)
|
||||||
val pointX2 = DPoint(2.0, 4.0)
|
val pointX2 = DPoint(2.0, 4.0)
|
||||||
@@ -95,6 +114,7 @@ fun box(): String {
|
|||||||
require(segment.middle1.x == 1.5)
|
require(segment.middle1.x == 1.5)
|
||||||
require(segment.middle1.y == 3.0)
|
require(segment.middle1.y == 3.0)
|
||||||
supply("v")
|
supply("v")
|
||||||
|
forStatement()
|
||||||
|
|
||||||
return "OK"
|
return "OK"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -76,6 +76,29 @@ public final class DependencyKt {
|
|||||||
public final static method square(p0: double): double
|
public final static method square(p0: double): double
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@kotlin.Metadata
|
||||||
|
public final class InfiniteDPoints$DPointsIterator {
|
||||||
|
// source: 'test.kt'
|
||||||
|
private field i: double
|
||||||
|
public method <init>(): void
|
||||||
|
public synthetic deprecated static @kotlin.PublishedApi method getI$annotations(): void
|
||||||
|
public final method getI(): double
|
||||||
|
public final method hasNext(): boolean
|
||||||
|
public final @org.jetbrains.annotations.NotNull method next(): DPoint
|
||||||
|
public final method setI(p0: double): void
|
||||||
|
public final inner class InfiniteDPoints$DPointsIterator
|
||||||
|
}
|
||||||
|
|
||||||
|
@kotlin.Metadata
|
||||||
|
public final class InfiniteDPoints {
|
||||||
|
// source: 'test.kt'
|
||||||
|
public final static @org.jetbrains.annotations.NotNull field INSTANCE: InfiniteDPoints
|
||||||
|
static method <clinit>(): void
|
||||||
|
private method <init>(): void
|
||||||
|
public final @org.jetbrains.annotations.NotNull method iterator(): InfiniteDPoints$DPointsIterator
|
||||||
|
public final inner class InfiniteDPoints$DPointsIterator
|
||||||
|
}
|
||||||
|
|
||||||
@kotlin.coroutines.jvm.internal.DebugMetadata
|
@kotlin.coroutines.jvm.internal.DebugMetadata
|
||||||
@kotlin.Metadata
|
@kotlin.Metadata
|
||||||
final class TestKt$box$13 {
|
final class TestKt$box$13 {
|
||||||
@@ -109,7 +132,9 @@ public final class TestKt {
|
|||||||
inner (anonymous) class TestKt$suspendFun$1
|
inner (anonymous) class TestKt$suspendFun$1
|
||||||
public final static @org.jetbrains.annotations.NotNull method box(): java.lang.String
|
public final static @org.jetbrains.annotations.NotNull method box(): java.lang.String
|
||||||
public final static @org.jetbrains.annotations.Nullable method f(@org.jetbrains.annotations.NotNull p0: kotlin.coroutines.Continuation): java.lang.Object
|
public final static @org.jetbrains.annotations.Nullable method f(@org.jetbrains.annotations.NotNull p0: kotlin.coroutines.Continuation): java.lang.Object
|
||||||
|
public final static method forStatement(): void
|
||||||
public final static method supply(@org.jetbrains.annotations.Nullable p0: java.lang.Object): void
|
public final static method supply(@org.jetbrains.annotations.Nullable p0: java.lang.Object): void
|
||||||
public final static @org.jetbrains.annotations.Nullable method suspendFun(@org.jetbrains.annotations.NotNull p0: kotlin.coroutines.Continuation): java.lang.Object
|
public final static @org.jetbrains.annotations.Nullable method suspendFun(@org.jetbrains.annotations.NotNull p0: kotlin.coroutines.Continuation): java.lang.Object
|
||||||
|
public final inner class InfiniteDPoints$DPointsIterator
|
||||||
public final inner class kotlin/jvm/internal/Ref$IntRef
|
public final inner class kotlin/jvm/internal/Ref$IntRef
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user