From 4fffe7b9c8dfcf0c17186fe0f0c3559d577bbbe7 Mon Sep 17 00:00:00 2001 From: "Denis.Zharkov" Date: Sat, 20 Feb 2021 15:01:57 +0300 Subject: [PATCH] FIR: Fix VerifyError caused by private delegates ^KT-45048 Fixed --- .../FirBlackBoxCodegenTestGenerated.java | 6 +++ .../FirStatusResolveTransformer.kt | 28 +++++++------- .../resolve/transformers/FirStatusResolver.kt | 38 ++++++++++++------- .../FirDeclarationsResolveTransformer.kt | 10 +++-- ...ementalJvmCompilerRunnerTestGenerated.java | 18 +++++++++ ...OldBackendCompilerRunnerTestGenerated.java | 18 +++++++++ .../delegatedProperty/privateInSubClass.kt | 20 ++++++++++ .../genericDelegatedDeepProperty.fir.kt.txt | 4 +- .../genericDelegatedDeepProperty.fir.txt | 16 ++++---- .../codegen/BlackBoxCodegenTestGenerated.java | 6 +++ .../IrBlackBoxCodegenTestGenerated.java | 6 +++ .../LightAnalysisModeTestGenerated.java | 5 +++ .../build/IncrementalJvmJpsTestGenerated.java | 23 ++++++++--- 13 files changed, 153 insertions(+), 45 deletions(-) create mode 100644 compiler/testData/codegen/box/delegatedProperty/privateInSubClass.kt diff --git a/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirBlackBoxCodegenTestGenerated.java b/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirBlackBoxCodegenTestGenerated.java index 68e6cd7a83f..2d8559e78b0 100644 --- a/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirBlackBoxCodegenTestGenerated.java +++ b/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirBlackBoxCodegenTestGenerated.java @@ -12674,6 +12674,12 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT runTest("compiler/testData/codegen/box/delegatedProperty/kt9712.kt"); } + @Test + @TestMetadata("privateInSubClass.kt") + public void testPrivateInSubClass() throws Exception { + runTest("compiler/testData/codegen/box/delegatedProperty/privateInSubClass.kt"); + } + @Test @TestMetadata("privateSetterKPropertyIsNotMutable.kt") public void testPrivateSetterKPropertyIsNotMutable() throws Exception { diff --git a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/transformers/FirStatusResolveTransformer.kt b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/transformers/FirStatusResolveTransformer.kt index 181c9254567..aed18b27dc9 100644 --- a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/transformers/FirStatusResolveTransformer.kt +++ b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/transformers/FirStatusResolveTransformer.kt @@ -284,10 +284,6 @@ abstract class AbstractFirStatusResolveTransformer( return when (declaration) { is FirCallableDeclaration<*> -> { when (declaration) { - is FirProperty -> { - declaration.getter?.let { transformPropertyAccessor(it, data) } - declaration.setter?.let { transformPropertyAccessor(it, data) } - } is FirFunction<*> -> { for (valueParameter in declaration.valueParameters) { transformValueParameter(valueParameter, data) @@ -296,9 +292,6 @@ abstract class AbstractFirStatusResolveTransformer( } declaration.compose() } - is FirPropertyAccessor -> { - declaration.compose() - } else -> { transformElement(declaration, data) } @@ -433,13 +426,16 @@ abstract class AbstractFirStatusResolveTransformer( statusComputationSession.endComputing(regularClass) } - override fun transformPropertyAccessor( + private fun transformPropertyAccessor( propertyAccessor: FirPropertyAccessor, - data: FirResolvedDeclarationStatus? - ): CompositeTransformResult { - propertyAccessor.transformStatus(this, statusResolver.resolveStatus(propertyAccessor, containingClass, isLocal = false)) - @Suppress("UNCHECKED_CAST") - return transformDeclaration(propertyAccessor, data) + containingProperty: FirProperty, + ) { + propertyAccessor.transformStatus( + this, + statusResolver.resolveStatus(propertyAccessor, containingClass, containingProperty, isLocal = false) + ) + + propertyAccessor.replaceResolvePhase(transformerPhase) } override fun transformConstructor( @@ -465,7 +461,11 @@ abstract class AbstractFirStatusResolveTransformer( ): CompositeTransformResult { property.replaceResolvePhase(transformerPhase) property.transformStatus(this, statusResolver.resolveStatus(property, containingClass, isLocal = false)) - return transformDeclaration(property, data) + + property.getter?.let { transformPropertyAccessor(it, property) } + property.setter?.let { transformPropertyAccessor(it, property) } + + return property.compose() } override fun transformField( diff --git a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/transformers/FirStatusResolver.kt b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/transformers/FirStatusResolver.kt index f5990fe22a5..3372d459a2a 100644 --- a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/transformers/FirStatusResolver.kt +++ b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/transformers/FirStatusResolver.kt @@ -17,7 +17,6 @@ import org.jetbrains.kotlin.fir.render import org.jetbrains.kotlin.fir.resolve.ScopeSession import org.jetbrains.kotlin.fir.scopes.ProcessorAction import org.jetbrains.kotlin.fir.scopes.unsubstitutedScope -import org.jetbrains.kotlin.fir.symbols.impl.FirNamedFunctionSymbol class FirStatusResolver( val session: FirSession, @@ -36,11 +35,16 @@ class FirStatusResolver( FirDeclarationStatusImpl.Modifier.values().toList() - NOT_INHERITED_MODIFIERS } - fun resolveStatus(declaration: FirDeclaration, containingClass: FirClass<*>?, isLocal: Boolean): FirResolvedDeclarationStatus { + fun resolveStatus( + declaration: FirDeclaration, + containingClass: FirClass<*>?, + containingProperty: FirProperty?, + isLocal: Boolean + ): FirResolvedDeclarationStatus { return when (declaration) { is FirProperty -> resolveStatus(declaration, containingClass, isLocal) is FirSimpleFunction -> resolveStatus(declaration, containingClass, isLocal) - is FirPropertyAccessor -> resolveStatus(declaration, containingClass, isLocal) + is FirPropertyAccessor -> resolveStatus(declaration, containingClass, containingProperty, isLocal) is FirRegularClass -> resolveStatus(declaration, containingClass, isLocal) is FirTypeAlias -> resolveStatus(declaration, containingClass, isLocal) is FirConstructor -> resolveStatus(declaration, containingClass, isLocal) @@ -51,7 +55,7 @@ class FirStatusResolver( @OptIn(ExperimentalStdlibApi::class) fun resolveStatus(property: FirProperty, containingClass: FirClass<*>?, isLocal: Boolean): FirResolvedDeclarationStatus { - return resolveStatus(property, property.status, containingClass, isLocal) l@{ + return resolveStatus(property, property.status, containingClass, null, isLocal) l@{ if (containingClass == null) return@l emptyList() @Suppress("RemoveExplicitTypeArguments") // Workaround for KT-42175 buildList { @@ -69,7 +73,7 @@ class FirStatusResolver( @OptIn(ExperimentalStdlibApi::class) fun resolveStatus(function: FirSimpleFunction, containingClass: FirClass<*>?, isLocal: Boolean): FirResolvedDeclarationStatus { - return resolveStatus(function, function.status, containingClass, isLocal) l@{ + return resolveStatus(function, function.status, containingClass, null, isLocal) l@{ if (containingClass == null) return@l emptyList() @Suppress("RemoveExplicitTypeArguments") // Workaround for KT-42175 buildList> { @@ -91,7 +95,7 @@ class FirStatusResolver( containingClass: FirClass<*>?, isLocal: Boolean ): FirResolvedDeclarationStatus { - return resolveStatus(regularClass, regularClass.status, containingClass, isLocal) { emptyList() } + return resolveStatus(regularClass, regularClass.status, containingClass, null, isLocal) { emptyList() } } fun resolveStatus( @@ -99,33 +103,35 @@ class FirStatusResolver( containingClass: FirClass<*>?, isLocal: Boolean ): FirResolvedDeclarationStatus { - return resolveStatus(typeAlias, typeAlias.status, containingClass, isLocal) { emptyList() } + return resolveStatus(typeAlias, typeAlias.status, containingClass, null, isLocal) { emptyList() } } fun resolveStatus( propertyAccessor: FirPropertyAccessor, containingClass: FirClass<*>?, + containingProperty: FirProperty?, isLocal: Boolean ): FirResolvedDeclarationStatus { - return resolveStatus(propertyAccessor, propertyAccessor.status, containingClass, isLocal) { emptyList() } + return resolveStatus(propertyAccessor, propertyAccessor.status, containingClass, containingProperty, isLocal) { emptyList() } } fun resolveStatus(constructor: FirConstructor, containingClass: FirClass<*>?, isLocal: Boolean): FirResolvedDeclarationStatus { - return resolveStatus(constructor, constructor.status, containingClass, isLocal) { emptyList() } + return resolveStatus(constructor, constructor.status, containingClass, null, isLocal) { emptyList() } } fun resolveStatus(field: FirField, containingClass: FirClass<*>?, isLocal: Boolean): FirResolvedDeclarationStatus { - return resolveStatus(field, field.status, containingClass, isLocal) { emptyList() } + return resolveStatus(field, field.status, containingClass, null, isLocal) { emptyList() } } fun resolveStatus(enumEntry: FirEnumEntry, containingClass: FirClass<*>?, isLocal: Boolean): FirResolvedDeclarationStatus { - return resolveStatus(enumEntry, enumEntry.status, containingClass, isLocal) { emptyList() } + return resolveStatus(enumEntry, enumEntry.status, containingClass, null, isLocal) { emptyList() } } private inline fun resolveStatus( declaration: FirDeclaration, status: FirDeclarationStatus, containingClass: FirClass<*>?, + containingProperty: FirProperty?, isLocal: Boolean, overriddenExtractor: () -> List ): FirResolvedDeclarationStatus { @@ -137,7 +143,7 @@ class FirStatusResolver( val visibility = when (status.visibility) { Visibilities.Unknown -> when { isLocal -> Visibilities.Local - else -> resolveVisibility(declaration, containingClass, overriddenStatuses) + else -> resolveVisibility(declaration, containingClass, containingProperty, overriddenStatuses) } else -> status.visibility } @@ -162,14 +168,20 @@ class FirStatusResolver( private fun resolveVisibility( declaration: FirDeclaration, containingClass: FirClass<*>?, + containingProperty: FirProperty?, overriddenStatuses: List ): Visibility { if (declaration is FirConstructor && containingClass?.hasPrivateConstructor() == true) return Visibilities.Private + val fallbackVisibility = when { + declaration is FirPropertyAccessor && containingProperty != null -> containingProperty.visibility + else -> Visibilities.Public + } + return overriddenStatuses.map { it.visibility } .maxWithOrNull { v1, v2 -> Visibilities.compare(v1, v2) ?: -1 } ?.normalize() - ?: Visibilities.Public + ?: fallbackVisibility } private fun FirClass<*>.hasPrivateConstructor(): Boolean { diff --git a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/transformers/body/resolve/FirDeclarationsResolveTransformer.kt b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/transformers/body/resolve/FirDeclarationsResolveTransformer.kt index bc5c67c3e9f..1f80b35ff1c 100644 --- a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/transformers/body/resolve/FirDeclarationsResolveTransformer.kt +++ b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/transformers/body/resolve/FirDeclarationsResolveTransformer.kt @@ -126,8 +126,8 @@ open class FirDeclarationsResolveTransformer(transformer: FirBodyResolveTransfor if (property.isLocal) { prepareSignatureForBodyResolve(property) property.transformStatus(this, property.resolveStatus().mode()) - property.getter?.let { it.transformStatus(this, it.resolveStatus().mode()) } - property.setter?.let { it.transformStatus(this, it.resolveStatus().mode()) } + property.getter?.let { it.transformStatus(this, it.resolveStatus(containingProperty = property).mode()) } + property.setter?.let { it.transformStatus(this, it.resolveStatus(containingProperty = property).mode()) } return transformLocalVariable(property) } @@ -380,11 +380,15 @@ open class FirDeclarationsResolveTransformer(transformer: FirBodyResolveTransfor } } - private fun FirDeclaration.resolveStatus(containingClass: FirClass<*>? = null): FirDeclarationStatus { + private fun FirDeclaration.resolveStatus( + containingClass: FirClass<*>? = null, + containingProperty: FirProperty? = null, + ): FirDeclarationStatus { val containingDeclaration = context.containerIfAny return statusResolver.resolveStatus( this, containingClass as? FirRegularClass, + containingProperty, isLocal = containingDeclaration != null && containingClass == null ) } diff --git a/compiler/incremental-compilation-impl/test/org/jetbrains/kotlin/incremental/IncrementalJvmCompilerRunnerTestGenerated.java b/compiler/incremental-compilation-impl/test/org/jetbrains/kotlin/incremental/IncrementalJvmCompilerRunnerTestGenerated.java index c491abb57cc..4aabb89cc90 100644 --- a/compiler/incremental-compilation-impl/test/org/jetbrains/kotlin/incremental/IncrementalJvmCompilerRunnerTestGenerated.java +++ b/compiler/incremental-compilation-impl/test/org/jetbrains/kotlin/incremental/IncrementalJvmCompilerRunnerTestGenerated.java @@ -2060,6 +2060,11 @@ public class IncrementalJvmCompilerRunnerTestGenerated extends AbstractIncrement runTest("jps-plugin/testData/incremental/withJava/other/multifileClassRemoved/"); } + @TestMetadata("multifileDependantUsage") + public void testMultifileDependantUsage() throws Exception { + runTest("jps-plugin/testData/incremental/withJava/other/multifileDependantUsage/"); + } + @TestMetadata("multifilePackagePartMethodAdded") public void testMultifilePackagePartMethodAdded() throws Exception { runTest("jps-plugin/testData/incremental/withJava/other/multifilePackagePartMethodAdded/"); @@ -2378,6 +2383,19 @@ public class IncrementalJvmCompilerRunnerTestGenerated extends AbstractIncrement } } + @TestMetadata("jps-plugin/testData/incremental/withJava/other/multifileDependantUsage") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class MultifileDependantUsage extends AbstractIncrementalJvmCompilerRunnerTest { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest(this::doTest, TargetBackend.JVM_IR, testDataFilePath); + } + + public void testAllFilesPresentInMultifileDependantUsage() throws Exception { + KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("jps-plugin/testData/incremental/withJava/other/multifileDependantUsage"), Pattern.compile("^([^\\.]+)$"), null, TargetBackend.JVM_IR, true); + } + } + @TestMetadata("jps-plugin/testData/incremental/withJava/other/multifilePackagePartMethodAdded") @TestDataPath("$PROJECT_ROOT") @RunWith(JUnit3RunnerWithInners.class) diff --git a/compiler/incremental-compilation-impl/test/org/jetbrains/kotlin/incremental/IncrementalJvmOldBackendCompilerRunnerTestGenerated.java b/compiler/incremental-compilation-impl/test/org/jetbrains/kotlin/incremental/IncrementalJvmOldBackendCompilerRunnerTestGenerated.java index 5ad5fe7932d..5e266ad16f5 100644 --- a/compiler/incremental-compilation-impl/test/org/jetbrains/kotlin/incremental/IncrementalJvmOldBackendCompilerRunnerTestGenerated.java +++ b/compiler/incremental-compilation-impl/test/org/jetbrains/kotlin/incremental/IncrementalJvmOldBackendCompilerRunnerTestGenerated.java @@ -2060,6 +2060,11 @@ public class IncrementalJvmOldBackendCompilerRunnerTestGenerated extends Abstrac runTest("jps-plugin/testData/incremental/withJava/other/multifileClassRemoved/"); } + @TestMetadata("multifileDependantUsage") + public void testMultifileDependantUsage() throws Exception { + runTest("jps-plugin/testData/incremental/withJava/other/multifileDependantUsage/"); + } + @TestMetadata("multifilePackagePartMethodAdded") public void testMultifilePackagePartMethodAdded() throws Exception { runTest("jps-plugin/testData/incremental/withJava/other/multifilePackagePartMethodAdded/"); @@ -2378,6 +2383,19 @@ public class IncrementalJvmOldBackendCompilerRunnerTestGenerated extends Abstrac } } + @TestMetadata("jps-plugin/testData/incremental/withJava/other/multifileDependantUsage") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class MultifileDependantUsage extends AbstractIncrementalJvmOldBackendCompilerRunnerTest { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest(this::doTest, TargetBackend.JVM, testDataFilePath); + } + + public void testAllFilesPresentInMultifileDependantUsage() throws Exception { + KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("jps-plugin/testData/incremental/withJava/other/multifileDependantUsage"), Pattern.compile("^([^\\.]+)$"), null, TargetBackend.JVM, true); + } + } + @TestMetadata("jps-plugin/testData/incremental/withJava/other/multifilePackagePartMethodAdded") @TestDataPath("$PROJECT_ROOT") @RunWith(JUnit3RunnerWithInners.class) diff --git a/compiler/testData/codegen/box/delegatedProperty/privateInSubClass.kt b/compiler/testData/codegen/box/delegatedProperty/privateInSubClass.kt new file mode 100644 index 00000000000..ad133694b07 --- /dev/null +++ b/compiler/testData/codegen/box/delegatedProperty/privateInSubClass.kt @@ -0,0 +1,20 @@ +// TARGET_BACKEND: JVM +// WITH_RUNTIME + +open class A { + private val _myVal by lazy { + "1" + "2" + } +} + +class B : A() { + private val _myVal by lazy { + "O" + "K" + } + + fun res() = _myVal +} + +fun box(): String { + return B().res() +} diff --git a/compiler/testData/ir/irText/types/genericDelegatedDeepProperty.fir.kt.txt b/compiler/testData/ir/irText/types/genericDelegatedDeepProperty.fir.kt.txt index 44b470be1c1..7faa11e7792 100644 --- a/compiler/testData/ir/irText/types/genericDelegatedDeepProperty.fir.kt.txt +++ b/compiler/testData/ir/irText/types/genericDelegatedDeepProperty.fir.kt.txt @@ -107,7 +107,7 @@ val Value>.additionalText: P /* by */ () } - get(): T { + private get(): T { return /*as */.#deepO$delegate.getValue(t = , p = ::deepO) } @@ -128,7 +128,7 @@ val Value>.additionalText: P /* by */ () } - get(): T { + private get(): T { return /*as */.#deepK$delegate.getValue(t = , p = ::deepK) } diff --git a/compiler/testData/ir/irText/types/genericDelegatedDeepProperty.fir.txt b/compiler/testData/ir/irText/types/genericDelegatedDeepProperty.fir.txt index 0787739c069..3dfd00798d5 100644 --- a/compiler/testData/ir/irText/types/genericDelegatedDeepProperty.fir.txt +++ b/compiler/testData/ir/irText/types/genericDelegatedDeepProperty.fir.txt @@ -271,18 +271,18 @@ FILE fqName: fileName:/genericDelegatedDeepProperty.kt public open fun toString (): kotlin.String [fake_override] declared in .IDelegate1 $this: VALUE_PARAMETER name: type:kotlin.Any CONSTRUCTOR_CALL 'private constructor () [primary] declared in .additionalText$delegate..deepO$delegate.' type=.additionalText$delegate..deepO$delegate..> origin=OBJECT_LITERAL - FUN DELEGATED_PROPERTY_ACCESSOR name: visibility:public modality:FINAL <> ($this:.additionalText$delegate..>, $receiver:.Value., .CR.>>) returnType:T of . + FUN DELEGATED_PROPERTY_ACCESSOR name: visibility:private modality:FINAL <> ($this:.additionalText$delegate..>, $receiver:.Value., .CR.>>) returnType:T of . correspondingProperty: PROPERTY name:deepO visibility:private modality:FINAL [delegated,val] $this: VALUE_PARAMETER name: type:.additionalText$delegate..> $receiver: VALUE_PARAMETER name: type:.Value., .CR.>> BLOCK_BODY - RETURN type=kotlin.Nothing from='public final fun (): T of . declared in .additionalText$delegate.' + RETURN type=kotlin.Nothing from='private final fun (): T of . declared in .additionalText$delegate.' CALL 'public final fun getValue (t: .Value., .CR.>>, p: kotlin.reflect.KProperty<*>): T of . [operator] declared in .additionalText$delegate..deepO$delegate.' type=T of . origin=null $this: GET_FIELD 'FIELD PROPERTY_DELEGATE name:deepO$delegate type:.additionalText$delegate..deepO$delegate..> visibility:private [final]' type=.additionalText$delegate..deepO$delegate..> origin=null receiver: TYPE_OP type=.additionalText$delegate. origin=IMPLICIT_CAST typeOperand=.additionalText$delegate. GET_VAR ': .additionalText$delegate..> declared in .additionalText$delegate..' type=.additionalText$delegate..> origin=null t: GET_VAR ': .Value., .CR.>> declared in .additionalText$delegate..' type=.Value., .CR.>> origin=null - p: PROPERTY_REFERENCE 'private final deepO: T of . [delegated,val]' field=null getter='public final fun (): T of . declared in .additionalText$delegate.' setter=null type=kotlin.reflect.KProperty2<.Value., .CR.>>, *, T of .> origin=PROPERTY_REFERENCE_FOR_DELEGATE + p: PROPERTY_REFERENCE 'private final deepO: T of . [delegated,val]' field=null getter='private final fun (): T of . declared in .additionalText$delegate.' setter=null type=kotlin.reflect.KProperty2<.Value., .CR.>>, *, T of .> origin=PROPERTY_REFERENCE_FOR_DELEGATE PROPERTY name:deepK visibility:private modality:FINAL [delegated,val] FIELD PROPERTY_DELEGATE name:deepK$delegate type:.additionalText$delegate..deepK$delegate..> visibility:private [final] EXPRESSION_BODY @@ -318,18 +318,18 @@ FILE fqName: fileName:/genericDelegatedDeepProperty.kt public open fun toString (): kotlin.String [fake_override] declared in .IDelegate1 $this: VALUE_PARAMETER name: type:kotlin.Any CONSTRUCTOR_CALL 'private constructor () [primary] declared in .additionalText$delegate..deepK$delegate.' type=.additionalText$delegate..deepK$delegate..> origin=OBJECT_LITERAL - FUN DELEGATED_PROPERTY_ACCESSOR name: visibility:public modality:FINAL <> ($this:.additionalText$delegate..>, $receiver:.Value., .CR.>>) returnType:T of . + FUN DELEGATED_PROPERTY_ACCESSOR name: visibility:private modality:FINAL <> ($this:.additionalText$delegate..>, $receiver:.Value., .CR.>>) returnType:T of . correspondingProperty: PROPERTY name:deepK visibility:private modality:FINAL [delegated,val] $this: VALUE_PARAMETER name: type:.additionalText$delegate..> $receiver: VALUE_PARAMETER name: type:.Value., .CR.>> BLOCK_BODY - RETURN type=kotlin.Nothing from='public final fun (): T of . declared in .additionalText$delegate.' + RETURN type=kotlin.Nothing from='private final fun (): T of . declared in .additionalText$delegate.' CALL 'public final fun getValue (t: .Value., .CR.>>, p: kotlin.reflect.KProperty<*>): T of . [operator] declared in .additionalText$delegate..deepK$delegate.' type=T of . origin=null $this: GET_FIELD 'FIELD PROPERTY_DELEGATE name:deepK$delegate type:.additionalText$delegate..deepK$delegate..> visibility:private [final]' type=.additionalText$delegate..deepK$delegate..> origin=null receiver: TYPE_OP type=.additionalText$delegate. origin=IMPLICIT_CAST typeOperand=.additionalText$delegate. GET_VAR ': .additionalText$delegate..> declared in .additionalText$delegate..' type=.additionalText$delegate..> origin=null t: GET_VAR ': .Value., .CR.>> declared in .additionalText$delegate..' type=.Value., .CR.>> origin=null - p: PROPERTY_REFERENCE 'private final deepK: T of . [delegated,val]' field=null getter='public final fun (): T of . declared in .additionalText$delegate.' setter=null type=kotlin.reflect.KProperty2<.Value., .CR.>>, *, T of .> origin=PROPERTY_REFERENCE_FOR_DELEGATE + p: PROPERTY_REFERENCE 'private final deepK: T of . [delegated,val]' field=null getter='private final fun (): T of . declared in .additionalText$delegate.' setter=null type=kotlin.reflect.KProperty2<.Value., .CR.>>, *, T of .> origin=PROPERTY_REFERENCE_FOR_DELEGATE FUN name:getValue visibility:public modality:FINAL <> ($this:.additionalText$delegate..>, t:.Value., .CR.>>, p:kotlin.reflect.KProperty<*>) returnType:.P., T of .> [operator] overridden: public abstract fun getValue (t: T1 of .IDelegate1, p: kotlin.reflect.KProperty<*>): R1 of .IDelegate1 [operator] declared in .IDelegate1 @@ -341,10 +341,10 @@ FILE fqName: fileName:/genericDelegatedDeepProperty.kt CONSTRUCTOR_CALL 'public constructor (p1: P1 of .P, p2: P2 of .P) [primary] declared in .P' type=.P., T of .> origin=null : T of . : T of . - p1: CALL 'public final fun (): T of . declared in .additionalText$delegate.' type=T of . origin=GET_PROPERTY + p1: CALL 'private final fun (): T of . declared in .additionalText$delegate.' type=T of . origin=GET_PROPERTY $this: GET_VAR ': .additionalText$delegate..> declared in .additionalText$delegate..getValue' type=.additionalText$delegate..> origin=null $receiver: GET_VAR 't: .Value., .CR.>> declared in .additionalText$delegate..getValue' type=.Value., .CR.>> origin=null - p2: CALL 'public final fun (): T of . declared in .additionalText$delegate.' type=T of . origin=GET_PROPERTY + p2: CALL 'private final fun (): T of . declared in .additionalText$delegate.' type=T of . origin=GET_PROPERTY $this: GET_VAR ': .additionalText$delegate..> declared in .additionalText$delegate..getValue' type=.additionalText$delegate..> origin=null $receiver: GET_VAR 't: .Value., .CR.>> declared in .additionalText$delegate..getValue' type=.Value., .CR.>> origin=null FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator] diff --git a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/BlackBoxCodegenTestGenerated.java b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/BlackBoxCodegenTestGenerated.java index f1e49163ddc..014a21aa035 100644 --- a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/BlackBoxCodegenTestGenerated.java +++ b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/BlackBoxCodegenTestGenerated.java @@ -12674,6 +12674,12 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest { runTest("compiler/testData/codegen/box/delegatedProperty/kt9712.kt"); } + @Test + @TestMetadata("privateInSubClass.kt") + public void testPrivateInSubClass() throws Exception { + runTest("compiler/testData/codegen/box/delegatedProperty/privateInSubClass.kt"); + } + @Test @TestMetadata("privateSetterKPropertyIsNotMutable.kt") public void testPrivateSetterKPropertyIsNotMutable() throws Exception { diff --git a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/IrBlackBoxCodegenTestGenerated.java b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/IrBlackBoxCodegenTestGenerated.java index d23888fe85b..696bd580a87 100644 --- a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/IrBlackBoxCodegenTestGenerated.java +++ b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/IrBlackBoxCodegenTestGenerated.java @@ -12674,6 +12674,12 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes runTest("compiler/testData/codegen/box/delegatedProperty/kt9712.kt"); } + @Test + @TestMetadata("privateInSubClass.kt") + public void testPrivateInSubClass() throws Exception { + runTest("compiler/testData/codegen/box/delegatedProperty/privateInSubClass.kt"); + } + @Test @TestMetadata("privateSetterKPropertyIsNotMutable.kt") public void testPrivateSetterKPropertyIsNotMutable() throws Exception { diff --git a/compiler/tests-gen/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java b/compiler/tests-gen/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java index 8f4ee1f9a21..aba956d031c 100644 --- a/compiler/tests-gen/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java +++ b/compiler/tests-gen/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java @@ -10351,6 +10351,11 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes runTest("compiler/testData/codegen/box/delegatedProperty/kt9712.kt"); } + @TestMetadata("privateInSubClass.kt") + public void testPrivateInSubClass() throws Exception { + runTest("compiler/testData/codegen/box/delegatedProperty/privateInSubClass.kt"); + } + @TestMetadata("privateSetterKPropertyIsNotMutable.kt") public void testPrivateSetterKPropertyIsNotMutable() throws Exception { runTest("compiler/testData/codegen/box/delegatedProperty/privateSetterKPropertyIsNotMutable.kt"); diff --git a/jps-plugin/jps-tests/test/org/jetbrains/kotlin/jps/build/IncrementalJvmJpsTestGenerated.java b/jps-plugin/jps-tests/test/org/jetbrains/kotlin/jps/build/IncrementalJvmJpsTestGenerated.java index fcaad30416a..c3ad69bc6e4 100644 --- a/jps-plugin/jps-tests/test/org/jetbrains/kotlin/jps/build/IncrementalJvmJpsTestGenerated.java +++ b/jps-plugin/jps-tests/test/org/jetbrains/kotlin/jps/build/IncrementalJvmJpsTestGenerated.java @@ -2251,6 +2251,11 @@ public class IncrementalJvmJpsTestGenerated extends AbstractIncrementalJvmJpsTes runTest("jps-plugin/testData/incremental/withJava/other/multifileClassRemoved/"); } + @TestMetadata("multifileDependantUsage") + public void testMultifileDependantUsage() throws Exception { + runTest("jps-plugin/testData/incremental/withJava/other/multifileDependantUsage/"); + } + @TestMetadata("multifilePackagePartMethodAdded") public void testMultifilePackagePartMethodAdded() throws Exception { runTest("jps-plugin/testData/incremental/withJava/other/multifilePackagePartMethodAdded/"); @@ -2261,11 +2266,6 @@ public class IncrementalJvmJpsTestGenerated extends AbstractIncrementalJvmJpsTes runTest("jps-plugin/testData/incremental/withJava/other/multifilePartsWithProperties/"); } - @TestMetadata("multifileDependantUsage") - public void testMultifileDependantUsage() throws Exception { - runTest("jps-plugin/testData/incremental/withJava/other/multifileDependantUsage/"); - } - @TestMetadata("optionalParameter") public void testOptionalParameter() throws Exception { runTest("jps-plugin/testData/incremental/withJava/other/optionalParameter/"); @@ -2574,6 +2574,19 @@ public class IncrementalJvmJpsTestGenerated extends AbstractIncrementalJvmJpsTes } } + @TestMetadata("jps-plugin/testData/incremental/withJava/other/multifileDependantUsage") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class MultifileDependantUsage extends AbstractIncrementalJvmJpsTest { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest(this::doTest, TargetBackend.JVM_IR, testDataFilePath); + } + + public void testAllFilesPresentInMultifileDependantUsage() throws Exception { + KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("jps-plugin/testData/incremental/withJava/other/multifileDependantUsage"), Pattern.compile("^([^\\.]+)$"), null, TargetBackend.JVM_IR, true); + } + } + @TestMetadata("jps-plugin/testData/incremental/withJava/other/multifilePackagePartMethodAdded") @TestDataPath("$PROJECT_ROOT") @RunWith(JUnit3RunnerWithInners.class)