[FIR] KT-57104: Preserve @JvmName on fake-override accessors
Otherwise, when we come to `ClassCodegen.kt:173 for `GradleActionTest` and check `FUN FAKE_OVERRIDE name:<get-project>`, we then go to `JvmSignatureClashDetector.kt:37`, and call `mapRawSignature(overriddenFunction)` which ignores the original `@JvmName`. It does so because it relies on the property copy which forgets to copy the getter, but `@get:JvmName` is stored in it. Extra when-branches for `FAKE_OVERRIDE` are needed, because otherwise the annotations would not be copied in `Fir2IrDeclarationStorage.kt:723`. Extra when-branches for `DELEGATED_MEMBER` are needed, because otherwise the generated IR changes in some tests. For example, see: `FirLightTreeIrTextTestGenerated.Declarations.testKt35550`. The `assumesBackingField`-related change is backed by the `FirLightTreeIrTextTestGenerated.Stubs.testJavaEnum` test. `this.body = null` ensures the resulting IR matches K1. The change in `FirImplicitBodyResolve.kt` is needed, because otherwise the bootstrap compiler fails at `:compiler:frontend:compileKotlin`, but I didn't come up with a smaller test for it. If we don't make an explicit accessor copy, then when we later create a `Fir2IrLazyPropertyAccessor` for the fake override getter, it's `fir` will be a reference to the `FirProperty`, not `FirPropertyAccessor`. That's why `DumpIrTreeVisitor` will render `IntrinsicConstEvaluation` as a getter annotation as well. `FirPsiIrTextTestGenerated.testDelegatedGenericImplementation` renders type parameters from `<get-x>`, because when assigning `extensionReceiverParameter` of the setter `<set-x>` we come to `Fir2IrClassifierStorage.kt:638`, and in this cache there's the parameter with the `<get-x>` parent. Note that `typeContext.origin == DEFAULT` in `getCachedIrTypeParameter`. It's `DEFAULT` because at the line `Fir2IrDeclarationStorage.kt:335` the `function` variable is `null` (because there's no setter). The change in `declarationAttributes.kt` is backed by the `FirPsiIrTextTestGenerated.testKt45853` test. ^KT-57104 Fixed ^KT-57432 Fixed Merge-request: KT-MR-9210 Merged-by: Nikolay Lunyak <Nikolay.Lunyak@jetbrains.com>
This commit is contained in:
committed by
Space Team
parent
9a4a3d1f49
commit
7b04201e77
+11
-4
@@ -323,6 +323,7 @@ class Fir2IrDeclarationStorage(
|
|||||||
function: FirFunction?,
|
function: FirFunction?,
|
||||||
containingClass: IrClass?,
|
containingClass: IrClass?,
|
||||||
isStatic: Boolean,
|
isStatic: Boolean,
|
||||||
|
forSetter: Boolean,
|
||||||
// Can be not-null only for property accessors
|
// Can be not-null only for property accessors
|
||||||
parentPropertyReceiver: FirReceiverParameter?
|
parentPropertyReceiver: FirReceiverParameter?
|
||||||
) {
|
) {
|
||||||
@@ -332,7 +333,6 @@ class Fir2IrDeclarationStorage(
|
|||||||
setTypeParameters(function)
|
setTypeParameters(function)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
val forSetter = function is FirPropertyAccessor && function.isSetter
|
|
||||||
val typeContext = ConversionTypeContext(
|
val typeContext = ConversionTypeContext(
|
||||||
origin = if (forSetter) ConversionTypeOrigin.SETTER else ConversionTypeOrigin.DEFAULT
|
origin = if (forSetter) ConversionTypeOrigin.SETTER else ConversionTypeOrigin.DEFAULT
|
||||||
)
|
)
|
||||||
@@ -417,10 +417,11 @@ class Fir2IrDeclarationStorage(
|
|||||||
irParent: IrDeclarationParent?,
|
irParent: IrDeclarationParent?,
|
||||||
thisReceiverOwner: IrClass? = irParent as? IrClass,
|
thisReceiverOwner: IrClass? = irParent as? IrClass,
|
||||||
isStatic: Boolean,
|
isStatic: Boolean,
|
||||||
|
forSetter: Boolean,
|
||||||
parentPropertyReceiver: FirReceiverParameter? = null
|
parentPropertyReceiver: FirReceiverParameter? = null
|
||||||
): T {
|
): T {
|
||||||
setAndModifyParent(irParent)
|
setAndModifyParent(irParent)
|
||||||
declareParameters(function, thisReceiverOwner, isStatic, parentPropertyReceiver)
|
declareParameters(function, thisReceiverOwner, isStatic, forSetter, parentPropertyReceiver)
|
||||||
return this
|
return this
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -563,7 +564,8 @@ class Fir2IrDeclarationStorage(
|
|||||||
enterScope(this)
|
enterScope(this)
|
||||||
bindAndDeclareParameters(
|
bindAndDeclareParameters(
|
||||||
function, irParent,
|
function, irParent,
|
||||||
thisReceiverOwner, isStatic = simpleFunction?.isStatic == true
|
thisReceiverOwner, isStatic = simpleFunction?.isStatic == true,
|
||||||
|
forSetter = false,
|
||||||
)
|
)
|
||||||
convertAnnotationsForNonDeclaredMembers(function, origin)
|
convertAnnotationsForNonDeclaredMembers(function, origin)
|
||||||
leaveScope(this)
|
leaveScope(this)
|
||||||
@@ -645,7 +647,7 @@ class Fir2IrDeclarationStorage(
|
|||||||
).apply {
|
).apply {
|
||||||
metadata = FirMetadataSource.Function(constructor)
|
metadata = FirMetadataSource.Function(constructor)
|
||||||
enterScope(this)
|
enterScope(this)
|
||||||
bindAndDeclareParameters(constructor, irParent, isStatic = false)
|
bindAndDeclareParameters(constructor, irParent, isStatic = false, forSetter = false)
|
||||||
leaveScope(this)
|
leaveScope(this)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -745,6 +747,7 @@ class Fir2IrDeclarationStorage(
|
|||||||
bindAndDeclareParameters(
|
bindAndDeclareParameters(
|
||||||
propertyAccessor, irParent,
|
propertyAccessor, irParent,
|
||||||
thisReceiverOwner, isStatic = irParent !is IrClass || propertyAccessor?.isStatic == true,
|
thisReceiverOwner, isStatic = irParent !is IrClass || propertyAccessor?.isStatic == true,
|
||||||
|
forSetter = isSetter,
|
||||||
parentPropertyReceiver = property.receiverParameter,
|
parentPropertyReceiver = property.receiverParameter,
|
||||||
)
|
)
|
||||||
leaveScope(this)
|
leaveScope(this)
|
||||||
@@ -940,6 +943,8 @@ class Fir2IrDeclarationStorage(
|
|||||||
origin == IrDeclarationOrigin.IR_EXTERNAL_DECLARATION_STUB -> origin
|
origin == IrDeclarationOrigin.IR_EXTERNAL_DECLARATION_STUB -> origin
|
||||||
origin == IrDeclarationOrigin.ENUM_CLASS_SPECIAL_MEMBER -> origin
|
origin == IrDeclarationOrigin.ENUM_CLASS_SPECIAL_MEMBER -> origin
|
||||||
delegate != null -> IrDeclarationOrigin.DELEGATED_PROPERTY_ACCESSOR
|
delegate != null -> IrDeclarationOrigin.DELEGATED_PROPERTY_ACCESSOR
|
||||||
|
origin == IrDeclarationOrigin.FAKE_OVERRIDE -> origin
|
||||||
|
origin == IrDeclarationOrigin.DELEGATED_MEMBER -> origin
|
||||||
getter is FirDefaultPropertyGetter -> IrDeclarationOrigin.DEFAULT_PROPERTY_ACCESSOR
|
getter is FirDefaultPropertyGetter -> IrDeclarationOrigin.DEFAULT_PROPERTY_ACCESSOR
|
||||||
else -> origin
|
else -> origin
|
||||||
},
|
},
|
||||||
@@ -953,6 +958,8 @@ class Fir2IrDeclarationStorage(
|
|||||||
setter, property, this, type, irParent, thisReceiverOwner, true,
|
setter, property, this, type, irParent, thisReceiverOwner, true,
|
||||||
when {
|
when {
|
||||||
delegate != null -> IrDeclarationOrigin.DELEGATED_PROPERTY_ACCESSOR
|
delegate != null -> IrDeclarationOrigin.DELEGATED_PROPERTY_ACCESSOR
|
||||||
|
origin == IrDeclarationOrigin.FAKE_OVERRIDE -> origin
|
||||||
|
origin == IrDeclarationOrigin.DELEGATED_MEMBER -> origin
|
||||||
setter is FirDefaultPropertySetter -> IrDeclarationOrigin.DEFAULT_PROPERTY_ACCESSOR
|
setter is FirDefaultPropertySetter -> IrDeclarationOrigin.DEFAULT_PROPERTY_ACCESSOR
|
||||||
else -> origin
|
else -> origin
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -129,7 +129,7 @@ class Fir2IrLazyProperty(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
fir.initializer != null || fir.getter is FirDefaultPropertyGetter || fir.isVar && fir.setter is FirDefaultPropertySetter -> {
|
fir.hasBackingField && origin != IrDeclarationOrigin.FAKE_OVERRIDE -> {
|
||||||
with(declarationStorage) {
|
with(declarationStorage) {
|
||||||
createBackingField(
|
createBackingField(
|
||||||
fir, IrDeclarationOrigin.PROPERTY_BACKING_FIELD,
|
fir, IrDeclarationOrigin.PROPERTY_BACKING_FIELD,
|
||||||
@@ -170,6 +170,8 @@ class Fir2IrLazyProperty(
|
|||||||
when {
|
when {
|
||||||
origin == IrDeclarationOrigin.IR_EXTERNAL_DECLARATION_STUB -> origin
|
origin == IrDeclarationOrigin.IR_EXTERNAL_DECLARATION_STUB -> origin
|
||||||
fir.delegate != null -> IrDeclarationOrigin.DELEGATED_PROPERTY_ACCESSOR
|
fir.delegate != null -> IrDeclarationOrigin.DELEGATED_PROPERTY_ACCESSOR
|
||||||
|
origin == IrDeclarationOrigin.FAKE_OVERRIDE -> origin
|
||||||
|
origin == IrDeclarationOrigin.DELEGATED_MEMBER -> origin
|
||||||
fir.getter is FirDefaultPropertyGetter -> IrDeclarationOrigin.DEFAULT_PROPERTY_ACCESSOR
|
fir.getter is FirDefaultPropertyGetter -> IrDeclarationOrigin.DEFAULT_PROPERTY_ACCESSOR
|
||||||
else -> origin
|
else -> origin
|
||||||
},
|
},
|
||||||
@@ -203,6 +205,8 @@ class Fir2IrLazyProperty(
|
|||||||
when {
|
when {
|
||||||
origin == IrDeclarationOrigin.IR_EXTERNAL_DECLARATION_STUB -> origin
|
origin == IrDeclarationOrigin.IR_EXTERNAL_DECLARATION_STUB -> origin
|
||||||
fir.delegate != null -> IrDeclarationOrigin.DELEGATED_PROPERTY_ACCESSOR
|
fir.delegate != null -> IrDeclarationOrigin.DELEGATED_PROPERTY_ACCESSOR
|
||||||
|
origin == IrDeclarationOrigin.FAKE_OVERRIDE -> origin
|
||||||
|
origin == IrDeclarationOrigin.DELEGATED_MEMBER -> origin
|
||||||
fir.setter is FirDefaultPropertySetter -> IrDeclarationOrigin.DEFAULT_PROPERTY_ACCESSOR
|
fir.setter is FirDefaultPropertySetter -> IrDeclarationOrigin.DEFAULT_PROPERTY_ACCESSOR
|
||||||
else -> origin
|
else -> origin
|
||||||
},
|
},
|
||||||
|
|||||||
+12
@@ -48,6 +48,18 @@ public class FirPsiOldDiagnosticsTestWithJvmIrBackendGenerated extends AbstractF
|
|||||||
runTest("compiler/testData/diagnostics/testsWithJvmBackend/inlineCycle_ir.kt");
|
runTest("compiler/testData/diagnostics/testsWithJvmBackend/inlineCycle_ir.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("kt57104.kt")
|
||||||
|
public void testKt57104() throws Exception {
|
||||||
|
runTest("compiler/testData/diagnostics/testsWithJvmBackend/kt57104.kt");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("kt57104_2.kt")
|
||||||
|
public void testKt57104_2() throws Exception {
|
||||||
|
runTest("compiler/testData/diagnostics/testsWithJvmBackend/kt57104_2.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@TestMetadata("multipleBigArityFunsImplemented.kt")
|
@TestMetadata("multipleBigArityFunsImplemented.kt")
|
||||||
public void testMultipleBigArityFunsImplemented() throws Exception {
|
public void testMultipleBigArityFunsImplemented() throws Exception {
|
||||||
|
|||||||
+108
-2
@@ -10,10 +10,12 @@ import org.jetbrains.kotlin.descriptors.Visibility
|
|||||||
import org.jetbrains.kotlin.fir.*
|
import org.jetbrains.kotlin.fir.*
|
||||||
import org.jetbrains.kotlin.fir.declarations.*
|
import org.jetbrains.kotlin.fir.declarations.*
|
||||||
import org.jetbrains.kotlin.fir.declarations.builder.*
|
import org.jetbrains.kotlin.fir.declarations.builder.*
|
||||||
|
import org.jetbrains.kotlin.fir.declarations.impl.FirDefaultPropertyAccessor
|
||||||
|
import org.jetbrains.kotlin.fir.declarations.impl.FirDefaultPropertyGetter
|
||||||
|
import org.jetbrains.kotlin.fir.declarations.impl.FirDefaultPropertySetter
|
||||||
import org.jetbrains.kotlin.fir.declarations.synthetic.FirSyntheticProperty
|
import org.jetbrains.kotlin.fir.declarations.synthetic.FirSyntheticProperty
|
||||||
import org.jetbrains.kotlin.fir.declarations.synthetic.buildSyntheticProperty
|
import org.jetbrains.kotlin.fir.declarations.synthetic.buildSyntheticProperty
|
||||||
import org.jetbrains.kotlin.fir.declarations.utils.isExpect
|
import org.jetbrains.kotlin.fir.declarations.utils.*
|
||||||
import org.jetbrains.kotlin.fir.declarations.utils.isStatic
|
|
||||||
import org.jetbrains.kotlin.fir.resolve.substitution.ChainedSubstitutor
|
import org.jetbrains.kotlin.fir.resolve.substitution.ChainedSubstitutor
|
||||||
import org.jetbrains.kotlin.fir.resolve.substitution.ConeSubstitutor
|
import org.jetbrains.kotlin.fir.resolve.substitution.ConeSubstitutor
|
||||||
import org.jetbrains.kotlin.fir.resolve.substitution.substitutorByMap
|
import org.jetbrains.kotlin.fir.resolve.substitution.substitutorByMap
|
||||||
@@ -374,11 +376,115 @@ object FirFakeOverrideGenerator {
|
|||||||
fakeOverrideSubstitution
|
fakeOverrideSubstitution
|
||||||
)
|
)
|
||||||
deprecationsProvider = baseProperty.deprecationsProvider
|
deprecationsProvider = baseProperty.deprecationsProvider
|
||||||
|
|
||||||
|
getter = baseProperty.getter?.buildCopyIfNeeded(
|
||||||
|
moduleData = session.moduleData,
|
||||||
|
origin = origin,
|
||||||
|
propertyReturnTypeRef = this@buildProperty.returnTypeRef,
|
||||||
|
propertySymbol = newSymbol,
|
||||||
|
dispatchReceiverType = dispatchReceiverType,
|
||||||
|
derivedClassLookupTag = derivedClassLookupTag,
|
||||||
|
baseProperty = baseProperty,
|
||||||
|
)
|
||||||
|
|
||||||
|
setter = baseProperty.setter?.buildCopyIfNeeded(
|
||||||
|
moduleData = session.moduleData,
|
||||||
|
origin = origin,
|
||||||
|
propertyReturnTypeRef = this@buildProperty.returnTypeRef,
|
||||||
|
propertySymbol = newSymbol,
|
||||||
|
dispatchReceiverType = dispatchReceiverType,
|
||||||
|
derivedClassLookupTag = derivedClassLookupTag,
|
||||||
|
baseProperty = baseProperty,
|
||||||
|
)
|
||||||
}.apply {
|
}.apply {
|
||||||
containingClassForStaticMemberAttr = derivedClassLookupTag.takeIf { shouldOverrideSetContainingClass(baseProperty) }
|
containingClassForStaticMemberAttr = derivedClassLookupTag.takeIf { shouldOverrideSetContainingClass(baseProperty) }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private fun FirPropertyAccessor.buildCopyIfNeeded(
|
||||||
|
moduleData: FirModuleData,
|
||||||
|
origin: FirDeclarationOrigin,
|
||||||
|
propertyReturnTypeRef: FirTypeRef,
|
||||||
|
propertySymbol: FirPropertySymbol,
|
||||||
|
dispatchReceiverType: ConeSimpleKotlinType?,
|
||||||
|
derivedClassLookupTag: ConeClassLikeLookupTag?,
|
||||||
|
baseProperty: FirProperty,
|
||||||
|
) = when {
|
||||||
|
annotations.isNotEmpty() || visibility != baseProperty.visibility -> buildCopy(
|
||||||
|
moduleData,
|
||||||
|
origin,
|
||||||
|
propertyReturnTypeRef,
|
||||||
|
propertySymbol,
|
||||||
|
dispatchReceiverType,
|
||||||
|
derivedClassLookupTag,
|
||||||
|
baseProperty,
|
||||||
|
)
|
||||||
|
else -> null
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun FirPropertyAccessor.buildCopy(
|
||||||
|
moduleData: FirModuleData,
|
||||||
|
origin: FirDeclarationOrigin,
|
||||||
|
propertyReturnTypeRef: FirTypeRef,
|
||||||
|
propertySymbol: FirPropertySymbol,
|
||||||
|
dispatchReceiverType: ConeSimpleKotlinType?,
|
||||||
|
derivedClassLookupTag: ConeClassLikeLookupTag?,
|
||||||
|
baseProperty: FirProperty,
|
||||||
|
) = when (this) {
|
||||||
|
is FirDefaultPropertyGetter -> FirDefaultPropertyGetter(
|
||||||
|
source = source,
|
||||||
|
moduleData = moduleData,
|
||||||
|
origin = origin,
|
||||||
|
propertyTypeRef = propertyReturnTypeRef,
|
||||||
|
visibility = visibility,
|
||||||
|
propertySymbol = propertySymbol,
|
||||||
|
modality = modality ?: Modality.FINAL,
|
||||||
|
effectiveVisibility = effectiveVisibility,
|
||||||
|
).apply {
|
||||||
|
replaceAnnotations(annotations)
|
||||||
|
}
|
||||||
|
is FirDefaultPropertySetter -> FirDefaultPropertySetter(
|
||||||
|
source = source,
|
||||||
|
moduleData = moduleData,
|
||||||
|
origin = origin,
|
||||||
|
propertyTypeRef = propertyReturnTypeRef,
|
||||||
|
visibility = visibility,
|
||||||
|
propertySymbol = propertySymbol,
|
||||||
|
modality = modality ?: Modality.FINAL,
|
||||||
|
effectiveVisibility = effectiveVisibility,
|
||||||
|
).apply {
|
||||||
|
replaceAnnotations(annotations)
|
||||||
|
}
|
||||||
|
else -> buildPropertyAccessorCopy(this) {
|
||||||
|
this.symbol = FirPropertyAccessorSymbol()
|
||||||
|
this.moduleData = moduleData
|
||||||
|
this.origin = origin
|
||||||
|
this.propertySymbol = propertySymbol
|
||||||
|
this.dispatchReceiverType = dispatchReceiverType
|
||||||
|
this.body = null
|
||||||
|
}.also {
|
||||||
|
if (it.isSetter) {
|
||||||
|
val newParameter = buildValueParameterCopy(it.valueParameters.first()) {
|
||||||
|
this.symbol = FirValueParameterSymbol(symbol.name)
|
||||||
|
this.returnTypeRef = propertyReturnTypeRef
|
||||||
|
}
|
||||||
|
it.replaceValueParameters(listOf(newParameter))
|
||||||
|
} else {
|
||||||
|
it.replaceReturnTypeRef(propertyReturnTypeRef)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}.also { accessor ->
|
||||||
|
when (accessor.origin) {
|
||||||
|
FirDeclarationOrigin.IntersectionOverride -> accessor.originalForIntersectionOverrideAttr = this
|
||||||
|
FirDeclarationOrigin.SubstitutionOverride -> accessor.originalForSubstitutionOverrideAttr = this
|
||||||
|
else -> {}
|
||||||
|
}
|
||||||
|
|
||||||
|
accessor.containingClassForStaticMemberAttr = derivedClassLookupTag.takeIf {
|
||||||
|
accessor is FirDefaultPropertyAccessor || shouldOverrideSetContainingClass(baseProperty)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
fun createCopyForFirField(
|
fun createCopyForFirField(
|
||||||
newSymbol: FirFieldSymbol,
|
newSymbol: FirFieldSymbol,
|
||||||
baseField: FirField,
|
baseField: FirField,
|
||||||
|
|||||||
+4
@@ -257,6 +257,10 @@ private class ReturnTypeCalculatorWithJump(
|
|||||||
val coneType = substitutor.substituteOrSelf(baseReturnType)
|
val coneType = substitutor.substituteOrSelf(baseReturnType)
|
||||||
val returnType = declaration.returnTypeRef.resolvedTypeFromPrototype(coneType)
|
val returnType = declaration.returnTypeRef.resolvedTypeFromPrototype(coneType)
|
||||||
declaration.replaceReturnTypeRef(returnType)
|
declaration.replaceReturnTypeRef(returnType)
|
||||||
|
if (declaration is FirProperty) {
|
||||||
|
declaration.getter?.replaceReturnTypeRef(returnType)
|
||||||
|
declaration.setter?.valueParameters?.firstOrNull()?.replaceReturnTypeRef(returnType)
|
||||||
|
}
|
||||||
return returnType
|
return returnType
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+2
@@ -14,6 +14,7 @@ import org.jetbrains.kotlin.fir.expressions.FirPropertyAccessExpression
|
|||||||
import org.jetbrains.kotlin.fir.references.impl.FirPropertyFromParameterResolvedNamedReference
|
import org.jetbrains.kotlin.fir.references.impl.FirPropertyFromParameterResolvedNamedReference
|
||||||
import org.jetbrains.kotlin.fir.symbols.impl.FirClassLikeSymbol
|
import org.jetbrains.kotlin.fir.symbols.impl.FirClassLikeSymbol
|
||||||
import org.jetbrains.kotlin.fir.symbols.impl.FirPropertySymbol
|
import org.jetbrains.kotlin.fir.symbols.impl.FirPropertySymbol
|
||||||
|
import org.jetbrains.kotlin.fir.symbols.impl.FirSyntheticPropertySymbol
|
||||||
import org.jetbrains.kotlin.fir.symbols.impl.FirValueParameterSymbol
|
import org.jetbrains.kotlin.fir.symbols.impl.FirValueParameterSymbol
|
||||||
import org.jetbrains.kotlin.fir.symbols.lazyResolveToPhase
|
import org.jetbrains.kotlin.fir.symbols.lazyResolveToPhase
|
||||||
import org.jetbrains.kotlin.fir.types.coneType
|
import org.jetbrains.kotlin.fir.types.coneType
|
||||||
@@ -88,6 +89,7 @@ val FirProperty.hasBackingField: Boolean
|
|||||||
if (isAbstract) return false
|
if (isAbstract) return false
|
||||||
if (delegate != null) return false
|
if (delegate != null) return false
|
||||||
if (hasExplicitBackingField) return true
|
if (hasExplicitBackingField) return true
|
||||||
|
if (symbol is FirSyntheticPropertySymbol) return false
|
||||||
if (isStatic) return false // For Enum.entries
|
if (isStatic) return false // For Enum.entries
|
||||||
when (origin) {
|
when (origin) {
|
||||||
FirDeclarationOrigin.SubstitutionOverride -> return false
|
FirDeclarationOrigin.SubstitutionOverride -> return false
|
||||||
|
|||||||
@@ -0,0 +1,22 @@
|
|||||||
|
// FIR_IDENTICAL
|
||||||
|
// JVM_TARGET: 1.8
|
||||||
|
// WITH_STDLIB
|
||||||
|
|
||||||
|
// MODULE: lib
|
||||||
|
// FILE: tests.kt
|
||||||
|
|
||||||
|
interface BaseTest {
|
||||||
|
fun getProject() = Any()
|
||||||
|
}
|
||||||
|
|
||||||
|
open class GradleTestCase {
|
||||||
|
@get:JvmName("myProject")
|
||||||
|
val project = Any()
|
||||||
|
}
|
||||||
|
|
||||||
|
open class GradleCodeInsightTestCase: GradleTestCase(), BaseTest
|
||||||
|
|
||||||
|
// MODULE: main(lib)
|
||||||
|
// FILE: main.kt
|
||||||
|
|
||||||
|
class GradleActionTest: GradleCodeInsightTestCase() // K1: ok, K2: CONFLICTING_INHERITED_JVM_DECLARATIONS
|
||||||
@@ -0,0 +1,20 @@
|
|||||||
|
// FIR_IDENTICAL
|
||||||
|
// JVM_TARGET: 1.8
|
||||||
|
// WITH_STDLIB
|
||||||
|
|
||||||
|
// MODULE: lib
|
||||||
|
// FILE: tests.kt
|
||||||
|
|
||||||
|
interface BaseTest {
|
||||||
|
fun getProject() = Any()
|
||||||
|
}
|
||||||
|
|
||||||
|
open class GradleTestCase {
|
||||||
|
@get:JvmName("myProject")
|
||||||
|
val project = Any()
|
||||||
|
}
|
||||||
|
|
||||||
|
// MODULE: main(lib)
|
||||||
|
// FILE: main.kt
|
||||||
|
|
||||||
|
class GradleActionTest: GradleTestCase(), BaseTest // K1 & K2: ok
|
||||||
+6
-6
@@ -94,20 +94,20 @@ FILE fqName:<root> fileName:/delegatedGenericImplementation.kt
|
|||||||
$this: GET_FIELD 'FIELD DELEGATE name:$$delegate_0 type:<root>.IBase<E of <root>.Test1> visibility:private [final]' type=<root>.IBase<E of <root>.Test1> origin=null
|
$this: GET_FIELD 'FIELD DELEGATE name:$$delegate_0 type:<root>.IBase<E of <root>.Test1> visibility:private [final]' type=<root>.IBase<E of <root>.Test1> origin=null
|
||||||
receiver: GET_VAR '<this>: <root>.Test1<E of <root>.Test1> declared in <root>.Test1.<get-x>' type=<root>.Test1<E of <root>.Test1> origin=null
|
receiver: GET_VAR '<this>: <root>.Test1<E of <root>.Test1> declared in <root>.Test1.<get-x>' type=<root>.Test1<E of <root>.Test1> origin=null
|
||||||
$receiver: GET_VAR '<this>: kotlin.collections.List<D of <root>.Test1.<get-x>> declared in <root>.Test1.<get-x>' type=kotlin.collections.List<D of <root>.Test1.<get-x>> origin=null
|
$receiver: GET_VAR '<this>: kotlin.collections.List<D of <root>.Test1.<get-x>> declared in <root>.Test1.<get-x>' type=kotlin.collections.List<D of <root>.Test1.<get-x>> origin=null
|
||||||
FUN DELEGATED_MEMBER name:<set-x> visibility:public modality:OPEN <D> ($this:<root>.Test1<E of <root>.Test1>, $receiver:kotlin.collections.List<D of <root>.Test1.<get-x>>, <set-?>:D of <root>.Test1.<set-x>?) returnType:kotlin.Unit
|
FUN DELEGATED_MEMBER name:<set-x> visibility:public modality:OPEN <D> ($this:<root>.Test1<E of <root>.Test1>, $receiver:kotlin.collections.List<D of <root>.Test1.<set-x>>, <set-?>:D of <root>.Test1.<set-x>?) returnType:kotlin.Unit
|
||||||
correspondingProperty: PROPERTY DELEGATED_MEMBER name:x visibility:public modality:OPEN [var]
|
correspondingProperty: PROPERTY DELEGATED_MEMBER name:x visibility:public modality:OPEN [var]
|
||||||
overridden:
|
overridden:
|
||||||
public abstract fun <set-x> <D> (<set-?>: D of <root>.IBase.<set-x>?): kotlin.Unit declared in <root>.IBase
|
public abstract fun <set-x> <D> (<set-?>: D of <root>.IBase.<set-x>?): kotlin.Unit declared in <root>.IBase
|
||||||
TYPE_PARAMETER name:D index:0 variance: superTypes:[kotlin.Any?] reified:false
|
TYPE_PARAMETER name:D index:0 variance: superTypes:[kotlin.Any?] reified:false
|
||||||
$this: VALUE_PARAMETER name:<this> type:<root>.Test1<E of <root>.Test1>
|
$this: VALUE_PARAMETER name:<this> type:<root>.Test1<E of <root>.Test1>
|
||||||
$receiver: VALUE_PARAMETER name:<this> type:kotlin.collections.List<D of <root>.Test1.<get-x>>
|
$receiver: VALUE_PARAMETER name:<this> type:kotlin.collections.List<D of <root>.Test1.<set-x>>
|
||||||
VALUE_PARAMETER name:<set-?> index:0 type:D of <root>.Test1.<set-x>?
|
VALUE_PARAMETER name:<set-?> index:0 type:D of <root>.Test1.<set-x>?
|
||||||
BLOCK_BODY
|
BLOCK_BODY
|
||||||
CALL 'public abstract fun <set-x> <D> (<set-?>: D of <root>.IBase.<set-x>?): kotlin.Unit declared in <root>.IBase' type=kotlin.Unit origin=null
|
CALL 'public abstract fun <set-x> <D> (<set-?>: D of <root>.IBase.<set-x>?): kotlin.Unit declared in <root>.IBase' type=kotlin.Unit origin=null
|
||||||
<D>: D of <root>.Test1.<set-x>
|
<D>: D of <root>.Test1.<set-x>
|
||||||
$this: GET_FIELD 'FIELD DELEGATE name:$$delegate_0 type:<root>.IBase<E of <root>.Test1> visibility:private [final]' type=<root>.IBase<E of <root>.Test1> origin=null
|
$this: GET_FIELD 'FIELD DELEGATE name:$$delegate_0 type:<root>.IBase<E of <root>.Test1> visibility:private [final]' type=<root>.IBase<E of <root>.Test1> origin=null
|
||||||
receiver: GET_VAR '<this>: <root>.Test1<E of <root>.Test1> declared in <root>.Test1.<set-x>' type=<root>.Test1<E of <root>.Test1> origin=null
|
receiver: GET_VAR '<this>: <root>.Test1<E of <root>.Test1> declared in <root>.Test1.<set-x>' type=<root>.Test1<E of <root>.Test1> origin=null
|
||||||
$receiver: GET_VAR '<this>: kotlin.collections.List<D of <root>.Test1.<get-x>> declared in <root>.Test1.<set-x>' type=kotlin.collections.List<D of <root>.Test1.<get-x>> origin=null
|
$receiver: GET_VAR '<this>: kotlin.collections.List<D of <root>.Test1.<set-x>> declared in <root>.Test1.<set-x>' type=kotlin.collections.List<D of <root>.Test1.<set-x>> origin=null
|
||||||
<set-?>: GET_VAR '<set-?>: D of <root>.Test1.<set-x>? declared in <root>.Test1.<set-x>' type=D of <root>.Test1.<set-x>? origin=null
|
<set-?>: GET_VAR '<set-?>: D of <root>.Test1.<set-x>? declared in <root>.Test1.<set-x>' type=D of <root>.Test1.<set-x>? origin=null
|
||||||
FIELD DELEGATE name:$$delegate_0 type:<root>.IBase<E of <root>.Test1> visibility:private [final]
|
FIELD DELEGATE name:$$delegate_0 type:<root>.IBase<E of <root>.Test1> visibility:private [final]
|
||||||
EXPRESSION_BODY
|
EXPRESSION_BODY
|
||||||
@@ -180,20 +180,20 @@ FILE fqName:<root> fileName:/delegatedGenericImplementation.kt
|
|||||||
$this: GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:j type:<root>.IBase<kotlin.String> visibility:private' type=<root>.IBase<kotlin.String> origin=null
|
$this: GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:j type:<root>.IBase<kotlin.String> visibility:private' type=<root>.IBase<kotlin.String> origin=null
|
||||||
receiver: GET_VAR '<this>: <root>.Test2 declared in <root>.Test2.<get-x>' type=<root>.Test2 origin=null
|
receiver: GET_VAR '<this>: <root>.Test2 declared in <root>.Test2.<get-x>' type=<root>.Test2 origin=null
|
||||||
$receiver: GET_VAR '<this>: kotlin.collections.List<D of <root>.Test2.<get-x>> declared in <root>.Test2.<get-x>' type=kotlin.collections.List<D of <root>.Test2.<get-x>> origin=null
|
$receiver: GET_VAR '<this>: kotlin.collections.List<D of <root>.Test2.<get-x>> declared in <root>.Test2.<get-x>' type=kotlin.collections.List<D of <root>.Test2.<get-x>> origin=null
|
||||||
FUN DELEGATED_MEMBER name:<set-x> visibility:public modality:OPEN <D> ($this:<root>.Test2, $receiver:kotlin.collections.List<D of <root>.Test2.<get-x>>, <set-?>:D of <root>.Test2.<set-x>?) returnType:kotlin.Unit
|
FUN DELEGATED_MEMBER name:<set-x> visibility:public modality:OPEN <D> ($this:<root>.Test2, $receiver:kotlin.collections.List<D of <root>.Test2.<set-x>>, <set-?>:D of <root>.Test2.<set-x>?) returnType:kotlin.Unit
|
||||||
correspondingProperty: PROPERTY DELEGATED_MEMBER name:x visibility:public modality:OPEN [var]
|
correspondingProperty: PROPERTY DELEGATED_MEMBER name:x visibility:public modality:OPEN [var]
|
||||||
overridden:
|
overridden:
|
||||||
public abstract fun <set-x> <D> (<set-?>: D of <root>.IBase.<set-x>?): kotlin.Unit declared in <root>.IBase
|
public abstract fun <set-x> <D> (<set-?>: D of <root>.IBase.<set-x>?): kotlin.Unit declared in <root>.IBase
|
||||||
TYPE_PARAMETER name:D index:0 variance: superTypes:[kotlin.Any?] reified:false
|
TYPE_PARAMETER name:D index:0 variance: superTypes:[kotlin.Any?] reified:false
|
||||||
$this: VALUE_PARAMETER name:<this> type:<root>.Test2
|
$this: VALUE_PARAMETER name:<this> type:<root>.Test2
|
||||||
$receiver: VALUE_PARAMETER name:<this> type:kotlin.collections.List<D of <root>.Test2.<get-x>>
|
$receiver: VALUE_PARAMETER name:<this> type:kotlin.collections.List<D of <root>.Test2.<set-x>>
|
||||||
VALUE_PARAMETER name:<set-?> index:0 type:D of <root>.Test2.<set-x>?
|
VALUE_PARAMETER name:<set-?> index:0 type:D of <root>.Test2.<set-x>?
|
||||||
BLOCK_BODY
|
BLOCK_BODY
|
||||||
CALL 'public abstract fun <set-x> <D> (<set-?>: D of <root>.IBase.<set-x>?): kotlin.Unit declared in <root>.IBase' type=kotlin.Unit origin=null
|
CALL 'public abstract fun <set-x> <D> (<set-?>: D of <root>.IBase.<set-x>?): kotlin.Unit declared in <root>.IBase' type=kotlin.Unit origin=null
|
||||||
<D>: D of <root>.Test2.<set-x>
|
<D>: D of <root>.Test2.<set-x>
|
||||||
$this: GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:j type:<root>.IBase<kotlin.String> visibility:private' type=<root>.IBase<kotlin.String> origin=null
|
$this: GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:j type:<root>.IBase<kotlin.String> visibility:private' type=<root>.IBase<kotlin.String> origin=null
|
||||||
receiver: GET_VAR '<this>: <root>.Test2 declared in <root>.Test2.<set-x>' type=<root>.Test2 origin=null
|
receiver: GET_VAR '<this>: <root>.Test2 declared in <root>.Test2.<set-x>' type=<root>.Test2 origin=null
|
||||||
$receiver: GET_VAR '<this>: kotlin.collections.List<D of <root>.Test2.<get-x>> declared in <root>.Test2.<set-x>' type=kotlin.collections.List<D of <root>.Test2.<get-x>> origin=null
|
$receiver: GET_VAR '<this>: kotlin.collections.List<D of <root>.Test2.<set-x>> declared in <root>.Test2.<set-x>' type=kotlin.collections.List<D of <root>.Test2.<set-x>> origin=null
|
||||||
<set-?>: GET_VAR '<set-?>: D of <root>.Test2.<set-x>? declared in <root>.Test2.<set-x>' type=D of <root>.Test2.<set-x>? origin=null
|
<set-?>: GET_VAR '<set-?>: D of <root>.Test2.<set-x>? declared in <root>.Test2.<set-x>' type=D of <root>.Test2.<set-x>? origin=null
|
||||||
PROPERTY name:j visibility:public modality:FINAL [var]
|
PROPERTY name:j visibility:public modality:FINAL [var]
|
||||||
FIELD PROPERTY_BACKING_FIELD name:j type:<root>.IBase<kotlin.String> visibility:private
|
FIELD PROPERTY_BACKING_FIELD name:j type:<root>.IBase<kotlin.String> visibility:private
|
||||||
|
|||||||
@@ -7,7 +7,6 @@ CLASS IR_EXTERNAL_JAVA_DECLARATION_STUB ENUM_CLASS name:JEnum modality:FINAL vis
|
|||||||
FUN IR_EXTERNAL_JAVA_DECLARATION_STUB name:valueOf visibility:public modality:FINAL <> (value:kotlin.String) returnType:<root>.JEnum
|
FUN IR_EXTERNAL_JAVA_DECLARATION_STUB name:valueOf visibility:public modality:FINAL <> (value:kotlin.String) returnType:<root>.JEnum
|
||||||
VALUE_PARAMETER name:value index:0 type:kotlin.String
|
VALUE_PARAMETER name:value index:0 type:kotlin.String
|
||||||
PROPERTY IR_EXTERNAL_JAVA_DECLARATION_STUB name:entries visibility:public modality:FINAL [val]
|
PROPERTY IR_EXTERNAL_JAVA_DECLARATION_STUB name:entries visibility:public modality:FINAL [val]
|
||||||
FIELD PROPERTY_BACKING_FIELD name:entries type:kotlin.enums.EnumEntries<<root>.JEnum> visibility:public [final,static]
|
|
||||||
FUN DEFAULT_PROPERTY_ACCESSOR name:<get-entries> visibility:public modality:FINAL <> () returnType:kotlin.enums.EnumEntries<<root>.JEnum>
|
FUN DEFAULT_PROPERTY_ACCESSOR name:<get-entries> visibility:public modality:FINAL <> () returnType:kotlin.enums.EnumEntries<<root>.JEnum>
|
||||||
correspondingProperty: PROPERTY IR_EXTERNAL_JAVA_DECLARATION_STUB name:entries visibility:public modality:FINAL [val]
|
correspondingProperty: PROPERTY IR_EXTERNAL_JAVA_DECLARATION_STUB name:entries visibility:public modality:FINAL [val]
|
||||||
FUN FAKE_OVERRIDE name:clone visibility:protected modality:FINAL <> ($this:<root>.JEnum) returnType:kotlin.Any [fake_override]
|
FUN FAKE_OVERRIDE name:clone visibility:protected modality:FINAL <> ($this:<root>.JEnum) returnType:kotlin.Any [fake_override]
|
||||||
|
|||||||
+12
@@ -37,6 +37,18 @@ public class DiagnosticsTestWithJvmIrBackendGenerated extends AbstractDiagnostic
|
|||||||
runTest("compiler/testData/diagnostics/testsWithJvmBackend/inlineCycle_ir.kt");
|
runTest("compiler/testData/diagnostics/testsWithJvmBackend/inlineCycle_ir.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("kt57104.kt")
|
||||||
|
public void testKt57104() throws Exception {
|
||||||
|
runTest("compiler/testData/diagnostics/testsWithJvmBackend/kt57104.kt");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("kt57104_2.kt")
|
||||||
|
public void testKt57104_2() throws Exception {
|
||||||
|
runTest("compiler/testData/diagnostics/testsWithJvmBackend/kt57104_2.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@TestMetadata("multipleBigArityFunsImplemented_ir.kt")
|
@TestMetadata("multipleBigArityFunsImplemented_ir.kt")
|
||||||
public void testMultipleBigArityFunsImplemented_ir() throws Exception {
|
public void testMultipleBigArityFunsImplemented_ir() throws Exception {
|
||||||
|
|||||||
+12
@@ -37,6 +37,18 @@ public class DiagnosticsTestWithOldJvmBackendGenerated extends AbstractDiagnosti
|
|||||||
runTest("compiler/testData/diagnostics/testsWithJvmBackend/inlineCycle.kt");
|
runTest("compiler/testData/diagnostics/testsWithJvmBackend/inlineCycle.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("kt57104.kt")
|
||||||
|
public void testKt57104() throws Exception {
|
||||||
|
runTest("compiler/testData/diagnostics/testsWithJvmBackend/kt57104.kt");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("kt57104_2.kt")
|
||||||
|
public void testKt57104_2() throws Exception {
|
||||||
|
runTest("compiler/testData/diagnostics/testsWithJvmBackend/kt57104_2.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@TestMetadata("multipleBigArityFunsImplemented.kt")
|
@TestMetadata("multipleBigArityFunsImplemented.kt")
|
||||||
public void testMultipleBigArityFunsImplemented() throws Exception {
|
public void testMultipleBigArityFunsImplemented() throws Exception {
|
||||||
|
|||||||
Reference in New Issue
Block a user