[JVM_IR] Use direct field access to backing fields on current class.
The current backend uses direct field access to the backing field
instead of calling the companion object accessor, which calls
an accessibility bridge, which then gets the field for code such as:
```
class A {
companion object {
val s: String = "OK"
}
// f uses direct access to the A.s backing field.
fun f() = s
}
```
This change does the same for the IR backend.
This commit is contained in:
Generated
+23
@@ -5161,6 +5161,29 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT
|
||||
}
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/testData/codegen/box/companion")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
public static class Companion extends AbstractFirBlackBoxCodegenTest {
|
||||
private void runTest(String testDataFilePath) throws Exception {
|
||||
KotlinTestUtils.runTestWithCustomIgnoreDirective(this::doTest, TargetBackend.JVM_IR, testDataFilePath, "// IGNORE_BACKEND_FIR: ");
|
||||
}
|
||||
|
||||
public void testAllFilesPresentInCompanion() throws Exception {
|
||||
KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/companion"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true);
|
||||
}
|
||||
|
||||
@TestMetadata("delegatedPropertyOnCompanion.kt")
|
||||
public void testDelegatedPropertyOnCompanion() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/companion/delegatedPropertyOnCompanion.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("inlineFunctionCompanionPropertyAccess.kt")
|
||||
public void testInlineFunctionCompanionPropertyAccess() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/companion/inlineFunctionCompanionPropertyAccess.kt");
|
||||
}
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/testData/codegen/box/compatibility")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
|
||||
Generated
+20
@@ -966,11 +966,26 @@ public class FirBytecodeTextTestGenerated extends AbstractFirBytecodeTextTest {
|
||||
KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/bytecodeText/companion"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true);
|
||||
}
|
||||
|
||||
@TestMetadata("directAccessToBackingField.kt")
|
||||
public void testDirectAccessToBackingField() throws Exception {
|
||||
runTest("compiler/testData/codegen/bytecodeText/companion/directAccessToBackingField.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("floatingPointCompanionAccess.kt")
|
||||
public void testFloatingPointCompanionAccess() throws Exception {
|
||||
runTest("compiler/testData/codegen/bytecodeText/companion/floatingPointCompanionAccess.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("inlineFunctionCompanionPropertyAccess.kt")
|
||||
public void testInlineFunctionCompanionPropertyAccess() throws Exception {
|
||||
runTest("compiler/testData/codegen/bytecodeText/companion/inlineFunctionCompanionPropertyAccess.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("inlineFunctionObjectCompanionPropertyAccess.kt")
|
||||
public void testInlineFunctionObjectCompanionPropertyAccess() throws Exception {
|
||||
runTest("compiler/testData/codegen/bytecodeText/companion/inlineFunctionObjectCompanionPropertyAccess.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("kt14258_1.kt")
|
||||
public void testKt14258_1() throws Exception {
|
||||
runTest("compiler/testData/codegen/bytecodeText/companion/kt14258_1.kt");
|
||||
@@ -996,6 +1011,11 @@ public class FirBytecodeTextTestGenerated extends AbstractFirBytecodeTextTest {
|
||||
runTest("compiler/testData/codegen/bytecodeText/companion/kt14258_5.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("nonDefaultAccessors.kt")
|
||||
public void testNonDefaultAccessors() throws Exception {
|
||||
runTest("compiler/testData/codegen/bytecodeText/companion/nonDefaultAccessors.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("privateCompanionObjectAccessors_after.kt")
|
||||
public void testPrivateCompanionObjectAccessors_after() throws Exception {
|
||||
runTest("compiler/testData/codegen/bytecodeText/companion/privateCompanionObjectAccessors_after.kt");
|
||||
|
||||
+1
-1
@@ -43,7 +43,7 @@ interface JvmLoweredDeclarationOrigin : IrDeclarationOrigin {
|
||||
object FOR_INLINE_STATE_MACHINE_TEMPLATE : IrDeclarationOriginImpl("FOR_INLINE_TEMPLATE")
|
||||
object FOR_INLINE_STATE_MACHINE_TEMPLATE_CAPTURES_CROSSINLINE : IrDeclarationOriginImpl("FOR_INLINE_TEMPLATE_CROSSINLINE")
|
||||
object CONTINUATION_CLASS_RESULT_FIELD: IrDeclarationOriginImpl("CONTINUATION_CLASS_RESULT_FIELD", isSynthetic = true)
|
||||
object COMPANION_PROPERTY_BACKING_FIELD : IrDeclarationOriginImpl("COMPANION_MOVED_PROPERTY_BACKING_FIELD")
|
||||
object COMPANION_PROPERTY_BACKING_FIELD : IrDeclarationOriginImpl("COMPANION_PROPERTY_BACKING_FIELD")
|
||||
object FIELD_FOR_STATIC_CALLABLE_REFERENCE_INSTANCE : IrDeclarationOriginImpl("FIELD_FOR_STATIC_CALLABLE_REFERENCE_INSTANCE")
|
||||
object ABSTRACT_BRIDGE_STUB : IrDeclarationOriginImpl("ABSTRACT_BRIDGE_STUB")
|
||||
}
|
||||
|
||||
+23
-5
@@ -17,6 +17,7 @@ import org.jetbrains.kotlin.backend.jvm.lower.inlineclasses.requiresMangling
|
||||
import org.jetbrains.kotlin.config.LanguageFeature
|
||||
import org.jetbrains.kotlin.descriptors.ClassKind
|
||||
import org.jetbrains.kotlin.descriptors.Modality
|
||||
import org.jetbrains.kotlin.ir.IrElement
|
||||
import org.jetbrains.kotlin.ir.IrStatement
|
||||
import org.jetbrains.kotlin.ir.UNDEFINED_OFFSET
|
||||
import org.jetbrains.kotlin.ir.builders.*
|
||||
@@ -28,10 +29,7 @@ import org.jetbrains.kotlin.ir.expressions.IrFieldAccessExpression
|
||||
import org.jetbrains.kotlin.ir.expressions.impl.IrBlockBodyImpl
|
||||
import org.jetbrains.kotlin.ir.types.*
|
||||
import org.jetbrains.kotlin.ir.types.impl.makeTypeProjection
|
||||
import org.jetbrains.kotlin.ir.util.coerceToUnit
|
||||
import org.jetbrains.kotlin.ir.util.render
|
||||
import org.jetbrains.kotlin.ir.util.resolveFakeOverride
|
||||
import org.jetbrains.kotlin.ir.util.transformDeclarationsFlat
|
||||
import org.jetbrains.kotlin.ir.util.*
|
||||
import org.jetbrains.kotlin.ir.visitors.transformChildrenVoid
|
||||
import org.jetbrains.kotlin.load.java.JvmAbi
|
||||
import org.jetbrains.kotlin.name.Name
|
||||
@@ -54,7 +52,9 @@ class JvmPropertiesLowering(private val backendContext: JvmBackendContext) : IrE
|
||||
val property = simpleFunction.correspondingPropertySymbol?.owner ?: return super.visitCall(expression)
|
||||
expression.transformChildrenVoid()
|
||||
|
||||
if (shouldSubstituteAccessorWithField(property, simpleFunction)) {
|
||||
if (shouldSubstituteAccessorWithField(property, simpleFunction) ||
|
||||
isDefaultAccessorForCompanionPropertyBackingFieldOnCurrentClass(property, simpleFunction)
|
||||
) {
|
||||
backendContext.createIrBuilder(currentScope!!.scope.scopeOwnerSymbol, expression.startOffset, expression.endOffset).apply {
|
||||
return when (simpleFunction) {
|
||||
property.getter -> substituteGetter(property, expression)
|
||||
@@ -67,6 +67,24 @@ class JvmPropertiesLowering(private val backendContext: JvmBackendContext) : IrE
|
||||
return expression
|
||||
}
|
||||
|
||||
private fun isDefaultAccessorForCompanionPropertyBackingFieldOnCurrentClass(
|
||||
property: IrProperty,
|
||||
function: IrSimpleFunction
|
||||
): Boolean {
|
||||
if (function.origin != IrDeclarationOrigin.DEFAULT_PROPERTY_ACCESSOR) return false
|
||||
if (property.isLateinit) return false
|
||||
// If this code could end up inlined in another class (either an inline function or an
|
||||
// inlined lambda in an inline function) use the companion object accessor. Otherwise,
|
||||
// we could break binary compatibility if we only recompile the class with the companion
|
||||
// object and change to non-default field accessors. The inlined code would still attempt
|
||||
// to get the backing field which would no longer exist.
|
||||
val inInlineFunctionScope = allScopes.any { scope -> (scope.irElement as? IrFunction)?.isInline ?: false }
|
||||
if (inInlineFunctionScope) return false
|
||||
val backingField = property.resolveFakeOverride()!!.backingField
|
||||
return backingField?.parent == currentClass?.irElement &&
|
||||
backingField?.origin == JvmLoweredDeclarationOrigin.COMPANION_PROPERTY_BACKING_FIELD
|
||||
}
|
||||
|
||||
private fun IrBuilderWithScope.substituteSetter(irProperty: IrProperty, expression: IrCall): IrExpression =
|
||||
patchReceiver(
|
||||
irSetField(
|
||||
|
||||
@@ -0,0 +1,46 @@
|
||||
import kotlin.reflect.KProperty
|
||||
|
||||
class Delegate {
|
||||
operator fun getValue(t: Any?, p: KProperty<*>): String = "OK"
|
||||
}
|
||||
|
||||
class Delegate2 {
|
||||
var value: String = "NOT OK"
|
||||
|
||||
operator fun getValue(t: Any?, p: KProperty<*>): String = value
|
||||
|
||||
operator fun setValue(thisRef: Any?, property: KProperty<*>, value: String) {
|
||||
this.value = value
|
||||
}
|
||||
}
|
||||
|
||||
class A {
|
||||
companion object {
|
||||
val s: String by Delegate()
|
||||
var s2: String by Delegate2()
|
||||
var s3: String by Delegate2()
|
||||
}
|
||||
|
||||
fun f() = s
|
||||
inline fun g() = s
|
||||
|
||||
fun set2() {
|
||||
s2 = "OK"
|
||||
}
|
||||
fun get2() = s2
|
||||
|
||||
inline fun set3() {
|
||||
s3 = "OK"
|
||||
}
|
||||
inline fun get3() = s3
|
||||
}
|
||||
|
||||
fun box(): String {
|
||||
val a = A()
|
||||
if (a.f() != "OK") return "FAIL0"
|
||||
if (a.g() != "OK") return "FAIL0"
|
||||
a.set2()
|
||||
if (a.get2() != "OK") return "FAIL0"
|
||||
a.set3()
|
||||
return a.get3()
|
||||
}
|
||||
+19
@@ -0,0 +1,19 @@
|
||||
class A {
|
||||
companion object {
|
||||
val s = "OK"
|
||||
var v = "NOT OK"
|
||||
}
|
||||
|
||||
inline fun f(): String = s
|
||||
|
||||
inline fun g() {
|
||||
v = "OK"
|
||||
}
|
||||
}
|
||||
|
||||
fun box(): String {
|
||||
val a = A()
|
||||
if (a.f() != "OK") return "FAIL0"
|
||||
a.g()
|
||||
return A.v
|
||||
}
|
||||
+38
@@ -0,0 +1,38 @@
|
||||
class A {
|
||||
companion object {
|
||||
val s = "OK"
|
||||
var v = "NOT OK"
|
||||
}
|
||||
|
||||
fun f(): String = s
|
||||
|
||||
fun g() {
|
||||
v = "OK"
|
||||
}
|
||||
|
||||
inline fun i(j: () -> Unit) {
|
||||
j()
|
||||
}
|
||||
|
||||
fun h() {
|
||||
i {
|
||||
s
|
||||
v = "OK"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// One direct `A.s` access in `f`.
|
||||
// One direct `A.s` access in the accessibility bridge `access$getS$cp`.
|
||||
// One direct `A.s` access in `h`.
|
||||
// 3 GETSTATIC A.s
|
||||
|
||||
// One direct `A.v` set in `g`.
|
||||
// One direct `A.v` set in the accessibility bridge `access$setV$cp`.
|
||||
// One direct `A.v` set in `A.<clinit>`
|
||||
// One direct `A.v` set in `h`.
|
||||
// 4 PUTSTATIC A.v
|
||||
|
||||
// No calls to the getter/setter on the companion object.
|
||||
// 0 INVOKEVIRTUAL A\$Companion.getS
|
||||
// 0 INVOKEVIRTUAL A\$Companion.setV
|
||||
+29
@@ -0,0 +1,29 @@
|
||||
class A {
|
||||
companion object {
|
||||
val s = "OK"
|
||||
var v = "NOT OK"
|
||||
}
|
||||
|
||||
inline fun f(): String = s
|
||||
|
||||
inline fun g() {
|
||||
v = "OK"
|
||||
}
|
||||
}
|
||||
|
||||
// One direct `A.s` access in the accessibility bridge `access$getS$cp`.
|
||||
// 1 GETSTATIC A.s
|
||||
|
||||
// One direct `A.v` set in the accessibility bridge `access$setV$cp`.
|
||||
// One direct `A.v` set in `A.<clinit>`
|
||||
// 2 PUTSTATIC A.v
|
||||
|
||||
// One call to the getter/setter on the companion object from f and one from g.
|
||||
// 1 INVOKEVIRTUAL A\$Companion.getS
|
||||
// 1 INVOKEVIRTUAL A\$Companion.setV
|
||||
|
||||
// One call to the accessibility bridge `access$setV$cp` from Companion.setV.
|
||||
// 1 INVOKESTATIC A.access\$setV\$cp
|
||||
|
||||
// One call to the accessibility bridge `access$getS$cp` from Companion.getS.
|
||||
// 1 INVOKESTATIC A.access\$getS\$cp
|
||||
Vendored
+101
@@ -0,0 +1,101 @@
|
||||
class A {
|
||||
companion object {
|
||||
val s = "OK"
|
||||
var v = "NOT OK"
|
||||
}
|
||||
|
||||
inline fun g(crossinline f: () -> Unit) {
|
||||
{
|
||||
f()
|
||||
s
|
||||
v = "OK"
|
||||
} ()
|
||||
}
|
||||
|
||||
inline fun g2(crossinline f: () -> Unit) {
|
||||
object {
|
||||
fun run() {
|
||||
f()
|
||||
s
|
||||
v = "OK"
|
||||
}
|
||||
}.run ()
|
||||
}
|
||||
|
||||
inline fun use() {
|
||||
g {
|
||||
s
|
||||
g2 { s }
|
||||
}
|
||||
g {
|
||||
v = "OK"
|
||||
g2 {
|
||||
v = "OK"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fun useNonInline() {
|
||||
g {
|
||||
s
|
||||
g2 { s }
|
||||
}
|
||||
g {
|
||||
v = "OK"
|
||||
g2 {
|
||||
v = "OK"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// One direct `A.s` access in the accessibility bridge `access$getS$cp`.
|
||||
// 1 GETSTATIC A.s
|
||||
|
||||
// One direct `A.v` set in the accessibility bridge `access$setV$cp`.
|
||||
// One direct `A.v` set in `A.<clinit>`
|
||||
// 2 PUTSTATIC A.v
|
||||
|
||||
// JVM_IR_TEMPLATES
|
||||
|
||||
// Two accesses from the inline function code for `g` and `g2`.
|
||||
// Four accesses from the code for `g` and `g2` inlined in `useInline`.
|
||||
// Two accesses from the lambdas inlined in `useInline`.
|
||||
// Four accesses from the code for `g` and `g2` inlined in `useNonInline`.
|
||||
// 12 INVOKEVIRTUAL A\$Companion.getS
|
||||
|
||||
// Two accesses from the inline function code for `g` and `g2`.
|
||||
// Four accesses from the code for `g` and `g2` inlined in `useInline`.
|
||||
// Two accesses from the lambdas inlined in `useInline`.
|
||||
// Four accesses from the code for `g` and `g2` inlined in `useNonInline`.
|
||||
// 12 INVOKEVIRTUAL A\$Companion.setV
|
||||
|
||||
// One call to the accessibility bridge `access$setV$cp` from Companion.setV.
|
||||
// Two uses of the direct accessor from the lambdas inlined in useNonInline.
|
||||
// 3 INVOKESTATIC A.access\$setV\$cp
|
||||
|
||||
// One call to the accessibility bridge `access$getS$cp` from Companion.getS.
|
||||
// Two uses of the direct accessor from the lambdas inlined in useNonInline.
|
||||
// 3 INVOKESTATIC A.access\$getS\$cp
|
||||
|
||||
// JVM_TEMPLATES
|
||||
|
||||
// Two accesses from the inline function code for `g` and `g2`.
|
||||
// Four accesses from the code for `g` and `g2` inlined in `useInline`.
|
||||
// Two accesses from the lambdas inlined in `useInline`.
|
||||
// Four accesses from the code for `g` and `g2` inlined in `useNonInline`.
|
||||
// Two accesses from the lambdas inlined in `useNonInline`.
|
||||
// 14 INVOKEVIRTUAL A\$Companion.getS
|
||||
|
||||
// Two accesses from the inline function code for `g` and `g2`.
|
||||
// Four accesses from the code for `g` and `g2` inlined in `useInline`.
|
||||
// Two accesses from the lambdas inlined in `useInline`.
|
||||
// Four accesses from the code for `g` and `g2` inlined in `useNonInline`.
|
||||
// Two accesses from the lambdas inlined in `useNonInline`.
|
||||
// 14 INVOKEVIRTUAL A\$Companion.setV
|
||||
|
||||
// One call to the accessibility bridge `access$setV$cp` from Companion.setV.
|
||||
// 1 INVOKESTATIC A.access\$setV\$cp
|
||||
|
||||
// One call to the accessibility bridge `access$getS$cp` from Companion.getS.
|
||||
// 1 INVOKESTATIC A.access\$getS\$cp
|
||||
@@ -0,0 +1,23 @@
|
||||
class A {
|
||||
companion object {
|
||||
val s: String
|
||||
get() = "Ok"
|
||||
var v : String
|
||||
get() = "NOT OK"
|
||||
set(value) {}
|
||||
}
|
||||
|
||||
inline fun f(): String = s
|
||||
|
||||
inline fun g() {
|
||||
v = "OK"
|
||||
}
|
||||
}
|
||||
|
||||
// No backing field on A and all accesses call the getter/setter.
|
||||
// 0 GETSTATIC A.s
|
||||
// 0 PUTSTATIC A.v
|
||||
|
||||
// One `getS` call in `f` and one `setV` call in `g`
|
||||
// 1 INVOKEVIRTUAL A\$Companion.getS
|
||||
// 1 INVOKEVIRTUAL A\$Companion.setV
|
||||
+23
@@ -5161,6 +5161,29 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest {
|
||||
}
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/testData/codegen/box/companion")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
public static class Companion extends AbstractBlackBoxCodegenTest {
|
||||
private void runTest(String testDataFilePath) throws Exception {
|
||||
KotlinTestUtils.runTest(this::doTest, TargetBackend.JVM, testDataFilePath);
|
||||
}
|
||||
|
||||
public void testAllFilesPresentInCompanion() throws Exception {
|
||||
KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/companion"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM, true);
|
||||
}
|
||||
|
||||
@TestMetadata("delegatedPropertyOnCompanion.kt")
|
||||
public void testDelegatedPropertyOnCompanion() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/companion/delegatedPropertyOnCompanion.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("inlineFunctionCompanionPropertyAccess.kt")
|
||||
public void testInlineFunctionCompanionPropertyAccess() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/companion/inlineFunctionCompanionPropertyAccess.kt");
|
||||
}
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/testData/codegen/box/compatibility")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
|
||||
+20
@@ -966,11 +966,26 @@ public class BytecodeTextTestGenerated extends AbstractBytecodeTextTest {
|
||||
KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/bytecodeText/companion"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM, true);
|
||||
}
|
||||
|
||||
@TestMetadata("directAccessToBackingField.kt")
|
||||
public void testDirectAccessToBackingField() throws Exception {
|
||||
runTest("compiler/testData/codegen/bytecodeText/companion/directAccessToBackingField.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("floatingPointCompanionAccess.kt")
|
||||
public void testFloatingPointCompanionAccess() throws Exception {
|
||||
runTest("compiler/testData/codegen/bytecodeText/companion/floatingPointCompanionAccess.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("inlineFunctionCompanionPropertyAccess.kt")
|
||||
public void testInlineFunctionCompanionPropertyAccess() throws Exception {
|
||||
runTest("compiler/testData/codegen/bytecodeText/companion/inlineFunctionCompanionPropertyAccess.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("inlineFunctionObjectCompanionPropertyAccess.kt")
|
||||
public void testInlineFunctionObjectCompanionPropertyAccess() throws Exception {
|
||||
runTest("compiler/testData/codegen/bytecodeText/companion/inlineFunctionObjectCompanionPropertyAccess.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("kt14258_1.kt")
|
||||
public void testKt14258_1() throws Exception {
|
||||
runTest("compiler/testData/codegen/bytecodeText/companion/kt14258_1.kt");
|
||||
@@ -996,6 +1011,11 @@ public class BytecodeTextTestGenerated extends AbstractBytecodeTextTest {
|
||||
runTest("compiler/testData/codegen/bytecodeText/companion/kt14258_5.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("nonDefaultAccessors.kt")
|
||||
public void testNonDefaultAccessors() throws Exception {
|
||||
runTest("compiler/testData/codegen/bytecodeText/companion/nonDefaultAccessors.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("privateCompanionObjectAccessors_after.kt")
|
||||
public void testPrivateCompanionObjectAccessors_after() throws Exception {
|
||||
runTest("compiler/testData/codegen/bytecodeText/companion/privateCompanionObjectAccessors_after.kt");
|
||||
|
||||
+23
@@ -5161,6 +5161,29 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes
|
||||
}
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/testData/codegen/box/companion")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
public static class Companion extends AbstractLightAnalysisModeTest {
|
||||
private void runTest(String testDataFilePath) throws Exception {
|
||||
KotlinTestUtils.runTest(this::doTest, TargetBackend.JVM, testDataFilePath);
|
||||
}
|
||||
|
||||
public void testAllFilesPresentInCompanion() throws Exception {
|
||||
KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/companion"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM, true);
|
||||
}
|
||||
|
||||
@TestMetadata("delegatedPropertyOnCompanion.kt")
|
||||
public void testDelegatedPropertyOnCompanion() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/companion/delegatedPropertyOnCompanion.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("inlineFunctionCompanionPropertyAccess.kt")
|
||||
public void testInlineFunctionCompanionPropertyAccess() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/companion/inlineFunctionCompanionPropertyAccess.kt");
|
||||
}
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/testData/codegen/box/compatibility")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
|
||||
+23
@@ -5161,6 +5161,29 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes
|
||||
}
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/testData/codegen/box/companion")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
public static class Companion extends AbstractIrBlackBoxCodegenTest {
|
||||
private void runTest(String testDataFilePath) throws Exception {
|
||||
KotlinTestUtils.runTest(this::doTest, TargetBackend.JVM_IR, testDataFilePath);
|
||||
}
|
||||
|
||||
public void testAllFilesPresentInCompanion() throws Exception {
|
||||
KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/companion"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true);
|
||||
}
|
||||
|
||||
@TestMetadata("delegatedPropertyOnCompanion.kt")
|
||||
public void testDelegatedPropertyOnCompanion() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/companion/delegatedPropertyOnCompanion.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("inlineFunctionCompanionPropertyAccess.kt")
|
||||
public void testInlineFunctionCompanionPropertyAccess() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/companion/inlineFunctionCompanionPropertyAccess.kt");
|
||||
}
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/testData/codegen/box/compatibility")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
|
||||
+20
@@ -966,11 +966,26 @@ public class IrBytecodeTextTestGenerated extends AbstractIrBytecodeTextTest {
|
||||
KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/bytecodeText/companion"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true);
|
||||
}
|
||||
|
||||
@TestMetadata("directAccessToBackingField.kt")
|
||||
public void testDirectAccessToBackingField() throws Exception {
|
||||
runTest("compiler/testData/codegen/bytecodeText/companion/directAccessToBackingField.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("floatingPointCompanionAccess.kt")
|
||||
public void testFloatingPointCompanionAccess() throws Exception {
|
||||
runTest("compiler/testData/codegen/bytecodeText/companion/floatingPointCompanionAccess.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("inlineFunctionCompanionPropertyAccess.kt")
|
||||
public void testInlineFunctionCompanionPropertyAccess() throws Exception {
|
||||
runTest("compiler/testData/codegen/bytecodeText/companion/inlineFunctionCompanionPropertyAccess.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("inlineFunctionObjectCompanionPropertyAccess.kt")
|
||||
public void testInlineFunctionObjectCompanionPropertyAccess() throws Exception {
|
||||
runTest("compiler/testData/codegen/bytecodeText/companion/inlineFunctionObjectCompanionPropertyAccess.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("kt14258_1.kt")
|
||||
public void testKt14258_1() throws Exception {
|
||||
runTest("compiler/testData/codegen/bytecodeText/companion/kt14258_1.kt");
|
||||
@@ -996,6 +1011,11 @@ public class IrBytecodeTextTestGenerated extends AbstractIrBytecodeTextTest {
|
||||
runTest("compiler/testData/codegen/bytecodeText/companion/kt14258_5.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("nonDefaultAccessors.kt")
|
||||
public void testNonDefaultAccessors() throws Exception {
|
||||
runTest("compiler/testData/codegen/bytecodeText/companion/nonDefaultAccessors.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("privateCompanionObjectAccessors_after.kt")
|
||||
public void testPrivateCompanionObjectAccessors_after() throws Exception {
|
||||
runTest("compiler/testData/codegen/bytecodeText/companion/privateCompanionObjectAccessors_after.kt");
|
||||
|
||||
js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/es6/semantics/IrJsCodegenBoxES6TestGenerated.java
Generated
+23
@@ -4131,6 +4131,29 @@ public class IrJsCodegenBoxES6TestGenerated extends AbstractIrJsCodegenBoxES6Tes
|
||||
}
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/testData/codegen/box/companion")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
public static class Companion extends AbstractIrJsCodegenBoxES6Test {
|
||||
private void runTest(String testDataFilePath) throws Exception {
|
||||
KotlinTestUtils.runTest0(this::doTest, TargetBackend.JS_IR_ES6, testDataFilePath);
|
||||
}
|
||||
|
||||
public void testAllFilesPresentInCompanion() throws Exception {
|
||||
KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/companion"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS_IR_ES6, true);
|
||||
}
|
||||
|
||||
@TestMetadata("delegatedPropertyOnCompanion.kt")
|
||||
public void testDelegatedPropertyOnCompanion() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/companion/delegatedPropertyOnCompanion.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("inlineFunctionCompanionPropertyAccess.kt")
|
||||
public void testInlineFunctionCompanionPropertyAccess() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/companion/inlineFunctionCompanionPropertyAccess.kt");
|
||||
}
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/testData/codegen/box/compatibility")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
|
||||
Generated
+23
@@ -4131,6 +4131,29 @@ public class IrJsCodegenBoxTestGenerated extends AbstractIrJsCodegenBoxTest {
|
||||
}
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/testData/codegen/box/companion")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
public static class Companion extends AbstractIrJsCodegenBoxTest {
|
||||
private void runTest(String testDataFilePath) throws Exception {
|
||||
KotlinTestUtils.runTest0(this::doTest, TargetBackend.JS_IR, testDataFilePath);
|
||||
}
|
||||
|
||||
public void testAllFilesPresentInCompanion() throws Exception {
|
||||
KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/companion"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS_IR, true);
|
||||
}
|
||||
|
||||
@TestMetadata("delegatedPropertyOnCompanion.kt")
|
||||
public void testDelegatedPropertyOnCompanion() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/companion/delegatedPropertyOnCompanion.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("inlineFunctionCompanionPropertyAccess.kt")
|
||||
public void testInlineFunctionCompanionPropertyAccess() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/companion/inlineFunctionCompanionPropertyAccess.kt");
|
||||
}
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/testData/codegen/box/compatibility")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
|
||||
Generated
+23
@@ -4131,6 +4131,29 @@ public class JsCodegenBoxTestGenerated extends AbstractJsCodegenBoxTest {
|
||||
}
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/testData/codegen/box/companion")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
public static class Companion extends AbstractJsCodegenBoxTest {
|
||||
private void runTest(String testDataFilePath) throws Exception {
|
||||
KotlinTestUtils.runTest0(this::doTest, TargetBackend.JS, testDataFilePath);
|
||||
}
|
||||
|
||||
public void testAllFilesPresentInCompanion() throws Exception {
|
||||
KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/companion"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS, true);
|
||||
}
|
||||
|
||||
@TestMetadata("delegatedPropertyOnCompanion.kt")
|
||||
public void testDelegatedPropertyOnCompanion() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/companion/delegatedPropertyOnCompanion.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("inlineFunctionCompanionPropertyAccess.kt")
|
||||
public void testInlineFunctionCompanionPropertyAccess() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/companion/inlineFunctionCompanionPropertyAccess.kt");
|
||||
}
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/testData/codegen/box/compatibility")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
|
||||
js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/wasm/semantics/IrCodegenBoxWasmTestGenerated.java
Generated
+23
@@ -2982,6 +2982,29 @@ public class IrCodegenBoxWasmTestGenerated extends AbstractIrCodegenBoxWasmTest
|
||||
}
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/testData/codegen/box/companion")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
public static class Companion extends AbstractIrCodegenBoxWasmTest {
|
||||
private void runTest(String testDataFilePath) throws Exception {
|
||||
KotlinTestUtils.runTest0(this::doTest, TargetBackend.WASM, testDataFilePath);
|
||||
}
|
||||
|
||||
public void testAllFilesPresentInCompanion() throws Exception {
|
||||
KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/companion"), Pattern.compile("^([^_](.+))\\.kt$"), null, TargetBackend.WASM, true);
|
||||
}
|
||||
|
||||
@TestMetadata("delegatedPropertyOnCompanion.kt")
|
||||
public void testDelegatedPropertyOnCompanion() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/companion/delegatedPropertyOnCompanion.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("inlineFunctionCompanionPropertyAccess.kt")
|
||||
public void testInlineFunctionCompanionPropertyAccess() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/companion/inlineFunctionCompanionPropertyAccess.kt");
|
||||
}
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/testData/codegen/box/compatibility")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
|
||||
Reference in New Issue
Block a user