[IR] MFVC lateinit variables and properties test
Signed-off-by: Evgeniy.Zhelenskiy <Evgeniy.Zhelenskiy@jetbrains.com> #KT-1179
This commit is contained in:
committed by
Space Team
parent
b7f249cdb6
commit
50310d42e3
+3
-4
@@ -19,7 +19,6 @@ import org.jetbrains.kotlin.ir.util.*
|
|||||||
import org.jetbrains.kotlin.ir.visitors.IrElementVisitor
|
import org.jetbrains.kotlin.ir.visitors.IrElementVisitor
|
||||||
import org.jetbrains.kotlin.load.java.JvmAbi
|
import org.jetbrains.kotlin.load.java.JvmAbi
|
||||||
import org.jetbrains.kotlin.name.Name
|
import org.jetbrains.kotlin.name.Name
|
||||||
import org.jetbrains.kotlin.utils.addToStdlib.safeAs
|
|
||||||
|
|
||||||
internal abstract class JvmValueClassAbstractLowering(
|
internal abstract class JvmValueClassAbstractLowering(
|
||||||
val context: JvmBackendContext,
|
val context: JvmBackendContext,
|
||||||
@@ -171,7 +170,7 @@ internal abstract class JvmValueClassAbstractLowering(
|
|||||||
|
|
||||||
// Anonymous initializers in inline classes are processed when building the primary constructor.
|
// Anonymous initializers in inline classes are processed when building the primary constructor.
|
||||||
final override fun visitAnonymousInitializerNew(declaration: IrAnonymousInitializer): IrStatement =
|
final override fun visitAnonymousInitializerNew(declaration: IrAnonymousInitializer): IrStatement =
|
||||||
if (declaration.parent.safeAs<IrClass>()?.isSpecificLoweringLogicApplicable() == true)
|
if ((declaration.parent as? IrClass)?.isSpecificLoweringLogicApplicable() == true)
|
||||||
declaration
|
declaration
|
||||||
else
|
else
|
||||||
super.visitAnonymousInitializerNew(declaration)
|
super.visitAnonymousInitializerNew(declaration)
|
||||||
@@ -271,11 +270,11 @@ internal abstract class JvmValueClassAbstractLowering(
|
|||||||
visitValueDeclaration(expression.symbol.owner)
|
visitValueDeclaration(expression.symbol.owner)
|
||||||
|
|
||||||
override fun visitStringConcatenation(expression: IrStringConcatenation, data: Nothing?): Boolean = false
|
override fun visitStringConcatenation(expression: IrStringConcatenation, data: Nothing?): Boolean = false
|
||||||
override fun visitReturn(expression: IrReturn, data: Nothing?): Boolean = expression.returnTargetSymbol.owner.safeAs<IrFunction>()
|
override fun visitReturn(expression: IrReturn, data: Nothing?): Boolean = (expression.returnTargetSymbol.owner as? IrFunction)
|
||||||
?.let { replacements.quickCheckIfFunctionIsNotApplicable(it) } ?: false
|
?.let { replacements.quickCheckIfFunctionIsNotApplicable(it) } ?: false
|
||||||
|
|
||||||
override fun visitAnonymousInitializer(declaration: IrAnonymousInitializer, data: Nothing?): Boolean =
|
override fun visitAnonymousInitializer(declaration: IrAnonymousInitializer, data: Nothing?): Boolean =
|
||||||
declaration.parent.safeAs<IrClass>()?.isSpecificLoweringLogicApplicable() == true
|
(declaration.parent as? IrClass)?.isSpecificLoweringLogicApplicable() == true
|
||||||
|
|
||||||
private fun visitStatementContainer(container: IrStatementContainer) = container.statements.any { it.accept(this, null) }
|
private fun visitStatementContainer(container: IrStatementContainer) = container.statements.any { it.accept(this, null) }
|
||||||
|
|
||||||
|
|||||||
@@ -133,6 +133,7 @@ public final class C {
|
|||||||
@kotlin.Metadata
|
@kotlin.Metadata
|
||||||
public final class ComplexKt {
|
public final class ComplexKt {
|
||||||
// source: 'complex.kt'
|
// source: 'complex.kt'
|
||||||
|
public static field late1: E
|
||||||
private final static @org.jetbrains.annotations.NotNull field lines: java.util.List
|
private final static @org.jetbrains.annotations.NotNull field lines: java.util.List
|
||||||
static method <clinit>(): void
|
static method <clinit>(): void
|
||||||
public final static @org.jetbrains.annotations.NotNull method box(): java.lang.String
|
public final static @org.jetbrains.annotations.NotNull method box(): java.lang.String
|
||||||
@@ -140,12 +141,14 @@ public final class ComplexKt {
|
|||||||
public final static method equalsChecks1-iUtXLc0(@org.jetbrains.annotations.NotNull p0: java.util.List): void
|
public final static method equalsChecks1-iUtXLc0(@org.jetbrains.annotations.NotNull p0: java.util.List): void
|
||||||
public final static method f-sUp7gFk(p0: int, p1: int, p2: int, p3: int, @org.jetbrains.annotations.NotNull p4: java.lang.String, @org.jetbrains.annotations.NotNull p5: java.util.List): void
|
public final static method f-sUp7gFk(p0: int, p1: int, p2: int, p3: int, @org.jetbrains.annotations.NotNull p4: java.lang.String, @org.jetbrains.annotations.NotNull p5: java.util.List): void
|
||||||
public final static method g-sUp7gFk(p0: int, p1: int, @org.jetbrains.annotations.NotNull p2: java.lang.String): void
|
public final static method g-sUp7gFk(p0: int, p1: int, @org.jetbrains.annotations.NotNull p2: java.lang.String): void
|
||||||
|
public final static @org.jetbrains.annotations.NotNull method getLate1(): E
|
||||||
public final static @org.jetbrains.annotations.NotNull method getLines(): java.util.List
|
public final static @org.jetbrains.annotations.NotNull method getLines(): java.util.List
|
||||||
public final static method h-sUp7gFk(p0: int, p1: int, p2: int, p3: int, @org.jetbrains.annotations.NotNull p4: java.lang.String, @org.jetbrains.annotations.NotNull p5: java.util.List): void
|
public final static method h-sUp7gFk(p0: int, p1: int, p2: int, p3: int, @org.jetbrains.annotations.NotNull p4: java.lang.String, @org.jetbrains.annotations.NotNull p5: java.util.List): void
|
||||||
public final static method h1(): void
|
public final static method h1(): void
|
||||||
public final static @org.jetbrains.annotations.NotNull method inlined-OsBMiQA(p0: int, p1: int, p2: int): D
|
public final static @org.jetbrains.annotations.NotNull method inlined-OsBMiQA(p0: int, p1: int, p2: int): D
|
||||||
public final static @org.jetbrains.annotations.NotNull method notInlined-OsBMiQA(p0: int, p1: int, p2: int): D
|
public final static @org.jetbrains.annotations.NotNull method notInlined-OsBMiQA(p0: int, p1: int, p2: int): D
|
||||||
public final static method reuseBoxed(@org.jetbrains.annotations.NotNull p0: java.util.List): void
|
public final static method reuseBoxed(@org.jetbrains.annotations.NotNull p0: java.util.List): void
|
||||||
|
public final static method setLate1-sUp7gFk(p0: int, p1: int, @org.jetbrains.annotations.NotNull p2: java.lang.String): void
|
||||||
public final static method supply(@org.jetbrains.annotations.NotNull p0: java.lang.Object): void
|
public final static method supply(@org.jetbrains.annotations.NotNull p0: java.lang.Object): void
|
||||||
public final static method testVars(@org.jetbrains.annotations.NotNull p0: NotInlined): void
|
public final static method testVars(@org.jetbrains.annotations.NotNull p0: NotInlined): void
|
||||||
}
|
}
|
||||||
|
|||||||
+12
-1
@@ -183,7 +183,7 @@ fun equalsChecks(left: R<List<Int>>, right: R<List<Int>>) {
|
|||||||
supply(left == right as R<List<Int>>?)
|
supply(left == right as R<List<Int>>?)
|
||||||
}
|
}
|
||||||
|
|
||||||
// todo add default parameters
|
lateinit var late1: E
|
||||||
|
|
||||||
fun box(): String {
|
fun box(): String {
|
||||||
supply("#1")
|
supply("#1")
|
||||||
@@ -219,6 +219,13 @@ fun box(): String {
|
|||||||
supply("#16")
|
supply("#16")
|
||||||
equalsChecks1(A(listOf(listOf())))
|
equalsChecks1(A(listOf(listOf())))
|
||||||
supply("#17")
|
supply("#17")
|
||||||
|
late1 = e
|
||||||
|
lateinit var late2: E
|
||||||
|
late2 = e
|
||||||
|
supply(e)
|
||||||
|
supply(late1)
|
||||||
|
supply(late2)
|
||||||
|
supply("#18")
|
||||||
|
|
||||||
val log = lines.joinToString("\n")
|
val log = lines.joinToString("\n")
|
||||||
val expectedLog =
|
val expectedLog =
|
||||||
@@ -305,6 +312,10 @@ fun box(): String {
|
|||||||
true
|
true
|
||||||
#16
|
#16
|
||||||
#17
|
#17
|
||||||
|
E(x=D(x=C(x=3, y=B(x=4), z=5)))
|
||||||
|
E(x=D(x=C(x=3, y=B(x=4), z=5)))
|
||||||
|
E(x=D(x=C(x=3, y=B(x=4), z=5)))
|
||||||
|
#18
|
||||||
""".trimIndent()
|
""".trimIndent()
|
||||||
require(log == expectedLog) { log }
|
require(log == expectedLog) { log }
|
||||||
|
|
||||||
|
|||||||
@@ -133,6 +133,7 @@ public final class C {
|
|||||||
@kotlin.Metadata
|
@kotlin.Metadata
|
||||||
public final class ComplexKt {
|
public final class ComplexKt {
|
||||||
// source: 'complex.kt'
|
// source: 'complex.kt'
|
||||||
|
public static field late1: E
|
||||||
private final static @org.jetbrains.annotations.NotNull field lines: java.util.List
|
private final static @org.jetbrains.annotations.NotNull field lines: java.util.List
|
||||||
static method <clinit>(): void
|
static method <clinit>(): void
|
||||||
public final static @org.jetbrains.annotations.NotNull method box(): java.lang.String
|
public final static @org.jetbrains.annotations.NotNull method box(): java.lang.String
|
||||||
@@ -140,12 +141,14 @@ public final class ComplexKt {
|
|||||||
public final static method equalsChecks1-iUtXLc0(@org.jetbrains.annotations.NotNull p0: java.util.List): void
|
public final static method equalsChecks1-iUtXLc0(@org.jetbrains.annotations.NotNull p0: java.util.List): void
|
||||||
public final static method f-sUp7gFk(p0: int, p1: int, p2: int, p3: int, @org.jetbrains.annotations.NotNull p4: java.lang.String, @org.jetbrains.annotations.NotNull p5: java.util.List): void
|
public final static method f-sUp7gFk(p0: int, p1: int, p2: int, p3: int, @org.jetbrains.annotations.NotNull p4: java.lang.String, @org.jetbrains.annotations.NotNull p5: java.util.List): void
|
||||||
public final static method g-sUp7gFk(p0: int, p1: int, @org.jetbrains.annotations.NotNull p2: java.lang.String): void
|
public final static method g-sUp7gFk(p0: int, p1: int, @org.jetbrains.annotations.NotNull p2: java.lang.String): void
|
||||||
|
public final static @org.jetbrains.annotations.NotNull method getLate1(): E
|
||||||
public final static @org.jetbrains.annotations.NotNull method getLines(): java.util.List
|
public final static @org.jetbrains.annotations.NotNull method getLines(): java.util.List
|
||||||
public final static method h-sUp7gFk(p0: int, p1: int, p2: int, p3: int, @org.jetbrains.annotations.NotNull p4: java.lang.String, @org.jetbrains.annotations.NotNull p5: java.util.List): void
|
public final static method h-sUp7gFk(p0: int, p1: int, p2: int, p3: int, @org.jetbrains.annotations.NotNull p4: java.lang.String, @org.jetbrains.annotations.NotNull p5: java.util.List): void
|
||||||
public final static method h1(): void
|
public final static method h1(): void
|
||||||
public final static @org.jetbrains.annotations.NotNull method inlined-OsBMiQA(p0: int, p1: int, p2: int): D
|
public final static @org.jetbrains.annotations.NotNull method inlined-OsBMiQA(p0: int, p1: int, p2: int): D
|
||||||
public final static @org.jetbrains.annotations.NotNull method notInlined-OsBMiQA(p0: int, p1: int, p2: int): D
|
public final static @org.jetbrains.annotations.NotNull method notInlined-OsBMiQA(p0: int, p1: int, p2: int): D
|
||||||
public final static method reuseBoxed(@org.jetbrains.annotations.NotNull p0: java.util.List): void
|
public final static method reuseBoxed(@org.jetbrains.annotations.NotNull p0: java.util.List): void
|
||||||
|
public final static method setLate1-sUp7gFk(p0: int, p1: int, @org.jetbrains.annotations.NotNull p2: java.lang.String): void
|
||||||
public final static method supply(@org.jetbrains.annotations.NotNull p0: java.lang.Object): void
|
public final static method supply(@org.jetbrains.annotations.NotNull p0: java.lang.Object): void
|
||||||
public final static method testVars(@org.jetbrains.annotations.NotNull p0: NotInlined): void
|
public final static method testVars(@org.jetbrains.annotations.NotNull p0: NotInlined): void
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,8 +4,6 @@
|
|||||||
// TARGET_BACKEND: JVM_IR
|
// TARGET_BACKEND: JVM_IR
|
||||||
// WORKS_WHEN_VALUE_CLASS
|
// WORKS_WHEN_VALUE_CLASS
|
||||||
// LANGUAGE: +ValueClasses
|
// LANGUAGE: +ValueClasses
|
||||||
// LAMBDAS: INDY
|
|
||||||
// ^ to ensure that LAMBDAS are actually CLASSes
|
|
||||||
|
|
||||||
// FILE: caller.kt
|
// FILE: caller.kt
|
||||||
import kotlin.coroutines.*
|
import kotlin.coroutines.*
|
||||||
|
|||||||
Reference in New Issue
Block a user