[FIR2IR] Provide remapped f/o symbols to declaration storage
After a generation of fake overrides some code may still to refer old symbols from declaration storage (like computation of overridden symbols for lazy functions), so we need to remap those symbols using information from IR f/o generator
This commit is contained in:
committed by
Space Team
parent
97cf62e291
commit
7813bb35cf
+6
@@ -19226,6 +19226,12 @@ public class LLFirBlackBoxCodegenBasedTestGenerated extends AbstractLLFirBlackBo
|
||||
runTest("compiler/testData/codegen/box/fakeOverride/intersectionInLocal.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("intersectionOverrideBetweenValAndVar.kt")
|
||||
public void testIntersectionOverrideBetweenValAndVar() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/fakeOverride/intersectionOverrideBetweenValAndVar.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kt49371.kt")
|
||||
public void testKt49371() throws Exception {
|
||||
|
||||
+6
@@ -19226,6 +19226,12 @@ public class LLFirReversedBlackBoxCodegenBasedTestGenerated extends AbstractLLFi
|
||||
runTest("compiler/testData/codegen/box/fakeOverride/intersectionInLocal.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("intersectionOverrideBetweenValAndVar.kt")
|
||||
public void testIntersectionOverrideBetweenValAndVar() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/fakeOverride/intersectionOverrideBetweenValAndVar.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kt49371.kt")
|
||||
public void testKt49371() throws Exception {
|
||||
|
||||
@@ -118,6 +118,8 @@ fun FirResult.convertToIrAndActualize(
|
||||
if (components.configuration.useIrFakeOverrideBuilder) {
|
||||
val fakeOverrideResolver = SpecialFakeOverrideSymbolsResolver(expectActualMap)
|
||||
irModuleFragment.acceptVoid(SpecialFakeOverrideSymbolsResolverVisitor(fakeOverrideResolver))
|
||||
@OptIn(Fir2IrSymbolsMappingForLazyClasses.SymbolRemapperInternals::class)
|
||||
components.symbolsMappingForLazyClasses.initializeSymbolMap(fakeOverrideResolver)
|
||||
}
|
||||
Fir2IrConverter.evaluateConstants(irModuleFragment, components)
|
||||
val actualizationResult = irActualizer?.runChecksAndFinalize(expectActualMap)
|
||||
|
||||
@@ -54,6 +54,7 @@ interface Fir2IrComponents {
|
||||
val fakeOverrideGenerator: FakeOverrideGenerator
|
||||
val delegatedMemberGenerator: DelegatedMemberGenerator
|
||||
val fakeOverrideBuilder: IrFakeOverrideBuilder
|
||||
val symbolsMappingForLazyClasses: Fir2IrSymbolsMappingForLazyClasses
|
||||
|
||||
val extensions: Fir2IrExtensions
|
||||
val configuration: Fir2IrConfiguration
|
||||
|
||||
@@ -63,6 +63,7 @@ class Fir2IrComponentsStorage(
|
||||
override val callGenerator: CallAndReferenceGenerator = CallAndReferenceGenerator(this, fir2IrVisitor, conversionScope)
|
||||
override val fakeOverrideGenerator: FakeOverrideGenerator = FakeOverrideGenerator(this, conversionScope)
|
||||
override val delegatedMemberGenerator: DelegatedMemberGenerator = DelegatedMemberGenerator(this)
|
||||
override val symbolsMappingForLazyClasses: Fir2IrSymbolsMappingForLazyClasses = Fir2IrSymbolsMappingForLazyClasses()
|
||||
|
||||
override val annotationsFromPluginRegistrar: Fir2IrIrGeneratedDeclarationsRegistrar = Fir2IrIrGeneratedDeclarationsRegistrar(this)
|
||||
|
||||
|
||||
+6
-5
@@ -286,7 +286,7 @@ class Fir2IrDeclarationStorage(
|
||||
) { signature ->
|
||||
symbolTable.referenceSimpleFunctionIfAny(signature)
|
||||
}
|
||||
return cachedIrCallable
|
||||
return cachedIrCallable?.let(symbolsMappingForLazyClasses::remapFunctionSymbol)
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -715,14 +715,15 @@ class Fir2IrDeclarationStorage(
|
||||
): IrPropertySymbol? {
|
||||
@Suppress("NAME_SHADOWING")
|
||||
val property = prepareProperty(property)
|
||||
return getCachedIrCallableSymbol(
|
||||
val symbol = getCachedIrCallableSymbol(
|
||||
property,
|
||||
fakeOverrideOwnerLookupTag,
|
||||
propertyCache,
|
||||
signatureCalculator
|
||||
) { signature ->
|
||||
symbolTable.referencePropertyIfAny(signature)
|
||||
}
|
||||
} ?: return null
|
||||
return symbolsMappingForLazyClasses.remapPropertySymbol(symbol)
|
||||
}
|
||||
|
||||
private fun getCachedIrPropertySymbols(
|
||||
@@ -740,11 +741,11 @@ class Fir2IrDeclarationStorage(
|
||||
}
|
||||
|
||||
fun findGetterOfProperty(propertySymbol: IrPropertySymbol): IrSimpleFunctionSymbol? {
|
||||
return getterForPropertyCache[propertySymbol]
|
||||
return getterForPropertyCache[propertySymbol]?.let(symbolsMappingForLazyClasses::remapFunctionSymbol)
|
||||
}
|
||||
|
||||
fun findSetterOfProperty(propertySymbol: IrPropertySymbol): IrSimpleFunctionSymbol? {
|
||||
return setterForPropertyCache[propertySymbol]
|
||||
return setterForPropertyCache[propertySymbol]?.let(symbolsMappingForLazyClasses::remapFunctionSymbol)
|
||||
}
|
||||
|
||||
fun findBackingFieldOfProperty(propertySymbol: IrPropertySymbol): IrFieldSymbol? {
|
||||
|
||||
+108
@@ -0,0 +1,108 @@
|
||||
/*
|
||||
* Copyright 2010-2023 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||
*/
|
||||
|
||||
package org.jetbrains.kotlin.fir.backend
|
||||
|
||||
import org.jetbrains.kotlin.ir.IrLock
|
||||
import org.jetbrains.kotlin.ir.declarations.lazy.lazyVar
|
||||
import org.jetbrains.kotlin.ir.symbols.IrPropertySymbol
|
||||
import org.jetbrains.kotlin.ir.symbols.IrSimpleFunctionSymbol
|
||||
import org.jetbrains.kotlin.ir.util.SymbolRemapper
|
||||
import kotlin.properties.ReadWriteProperty
|
||||
import kotlin.reflect.KProperty
|
||||
|
||||
/**
|
||||
* Some later stages of the Fir2Ir process (namely building fake overrides)
|
||||
* need to remap some symbols.
|
||||
*
|
||||
* This remapping should be back-propagated to storages, so they would return
|
||||
* remapped values. This is important for Lazy Classes and potentially important
|
||||
* for plugins.
|
||||
*
|
||||
* This class serves this purpose. These parts can register a remapping,
|
||||
* and corresponding symbols would be lazily updated in lazy declarations
|
||||
* and in return values of storages.
|
||||
*/
|
||||
class Fir2IrSymbolsMappingForLazyClasses {
|
||||
private var symbolMap = mutableListOf<SymbolRemapper>()
|
||||
|
||||
/**
|
||||
* This value can be used for fast check if something changed since last time.
|
||||
* It should have new unique values on each change of class' state.
|
||||
*
|
||||
* As for now, only adds are supported, so the size of the list works as this unique number.
|
||||
*
|
||||
* Typical usage should cache the mapping result, and invalidate cache if and only if this value has changed.
|
||||
*/
|
||||
val generation: Int get() = symbolMap.size
|
||||
|
||||
fun remapFunctionSymbol(symbol: IrSimpleFunctionSymbol): IrSimpleFunctionSymbol {
|
||||
return symbolMap.fold(symbol) { s, m -> m.getReferencedSimpleFunction(s) }
|
||||
}
|
||||
|
||||
fun remapPropertySymbol(symbol: IrPropertySymbol): IrPropertySymbol {
|
||||
return symbolMap.fold(symbol) { s, m -> m.getReferencedProperty(s) }
|
||||
}
|
||||
|
||||
@RequiresOptIn
|
||||
annotation class SymbolRemapperInternals
|
||||
|
||||
@SymbolRemapperInternals
|
||||
fun initializeSymbolMap(map: SymbolRemapper) {
|
||||
symbolMap.add(map)
|
||||
}
|
||||
}
|
||||
|
||||
internal class MappedLazyVar<T>(
|
||||
val lock: IrLock,
|
||||
initializer: () -> T,
|
||||
val map: Fir2IrSymbolsMappingForLazyClasses,
|
||||
val mapperFun: Fir2IrSymbolsMappingForLazyClasses.(T) -> T
|
||||
) : ReadWriteProperty<Any?, T> {
|
||||
private val lazy = lazyVar(lock, initializer)
|
||||
@Volatile private var lastSeenGeneration: Int = -1
|
||||
|
||||
override fun toString(): String = lazy.toString()
|
||||
|
||||
override fun getValue(thisRef: Any?, property: KProperty<*>): T {
|
||||
return synchronized(lock) {
|
||||
if (lastSeenGeneration != map.generation) {
|
||||
lazy.setValue(thisRef, property, map.mapperFun(lazy.getValue(thisRef, property)))
|
||||
lastSeenGeneration = map.generation
|
||||
}
|
||||
lastSeenGeneration = map.generation
|
||||
lazy.getValue(thisRef, property)
|
||||
}
|
||||
}
|
||||
|
||||
override fun setValue(thisRef: Any?, property: KProperty<*>, value: T) {
|
||||
synchronized(lock) {
|
||||
lazy.setValue(thisRef, property, value)
|
||||
lastSeenGeneration = map.generation
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fun <T> Fir2IrSymbolsMappingForLazyClasses.lazyMappedVar(
|
||||
lock: IrLock,
|
||||
initializer: () -> T,
|
||||
mapFunction: Fir2IrSymbolsMappingForLazyClasses.(T) -> T
|
||||
): ReadWriteProperty<Any?, T> {
|
||||
return MappedLazyVar(lock, initializer, this, mapFunction)
|
||||
}
|
||||
|
||||
fun Fir2IrSymbolsMappingForLazyClasses.lazyMappedFunctionListVar(
|
||||
lock: IrLock,
|
||||
initializer: () -> List<IrSimpleFunctionSymbol>
|
||||
): ReadWriteProperty<Any?, List<IrSimpleFunctionSymbol>> = lazyMappedVar(lock, initializer) { list ->
|
||||
list.map { remapFunctionSymbol(it) }
|
||||
}
|
||||
|
||||
fun Fir2IrSymbolsMappingForLazyClasses.lazyMappedPropertyListVar(
|
||||
lock: IrLock,
|
||||
initializer: () -> List<IrPropertySymbol>
|
||||
): ReadWriteProperty<Any?, List<IrPropertySymbol>> = lazyMappedVar(lock, initializer) { list ->
|
||||
list.map { remapPropertySymbol(it) }
|
||||
}
|
||||
@@ -22,7 +22,6 @@ import org.jetbrains.kotlin.fir.types.coneType
|
||||
import org.jetbrains.kotlin.fir.types.resolvedType
|
||||
import org.jetbrains.kotlin.ir.ObsoleteDescriptorBasedAPI
|
||||
import org.jetbrains.kotlin.ir.declarations.*
|
||||
import org.jetbrains.kotlin.ir.declarations.lazy.lazyVar
|
||||
import org.jetbrains.kotlin.ir.expressions.IrConstructorCall
|
||||
import org.jetbrains.kotlin.ir.expressions.IrExpressionBody
|
||||
import org.jetbrains.kotlin.ir.symbols.IrPropertySymbol
|
||||
@@ -213,7 +212,7 @@ class Fir2IrLazyProperty(
|
||||
}
|
||||
}
|
||||
|
||||
override var overriddenSymbols: List<IrPropertySymbol> by lazyVar(lock) {
|
||||
override var overriddenSymbols: List<IrPropertySymbol> by symbolsMappingForLazyClasses.lazyMappedPropertyListVar(lock) {
|
||||
when (configuration.useIrFakeOverrideBuilder) {
|
||||
true -> computeOverriddenSymbolsForIrFakeOverrideGenerator()
|
||||
false -> computeOverriddenUsingFir2IrFakeOverrideGenerator()
|
||||
|
||||
@@ -109,8 +109,8 @@ class Fir2IrLazyPropertyAccessor(
|
||||
}
|
||||
}
|
||||
|
||||
override var overriddenSymbols: List<IrSimpleFunctionSymbol> by lazyVar(lock) {
|
||||
if (firParentClass == null) return@lazyVar emptyList()
|
||||
override var overriddenSymbols: List<IrSimpleFunctionSymbol> by symbolsMappingForLazyClasses.lazyMappedFunctionListVar(lock) {
|
||||
if (firParentClass == null) return@lazyMappedFunctionListVar emptyList()
|
||||
// If property accessor is created then corresponding property is definitely created too
|
||||
@OptIn(UnsafeDuringIrConstructionAPI::class)
|
||||
val correspondingProperty = correspondingPropertySymbol!!.owner
|
||||
|
||||
@@ -9,6 +9,7 @@ import org.jetbrains.kotlin.fir.backend.Fir2IrComponents
|
||||
import org.jetbrains.kotlin.fir.backend.contextReceiversForFunctionOrContainingProperty
|
||||
import org.jetbrains.kotlin.fir.backend.generators.Fir2IrCallableDeclarationsGenerator
|
||||
import org.jetbrains.kotlin.fir.backend.generators.generateOverriddenFunctionSymbols
|
||||
import org.jetbrains.kotlin.fir.backend.lazyMappedFunctionListVar
|
||||
import org.jetbrains.kotlin.fir.backend.toIrType
|
||||
import org.jetbrains.kotlin.fir.declarations.FirFunction
|
||||
import org.jetbrains.kotlin.fir.declarations.FirRegularClass
|
||||
@@ -92,13 +93,14 @@ class Fir2IrLazySimpleFunction(
|
||||
}
|
||||
}
|
||||
|
||||
override var overriddenSymbols: List<IrSimpleFunctionSymbol> by lazyVar(lock) {
|
||||
override var overriddenSymbols: List<IrSimpleFunctionSymbol> by symbolsMappingForLazyClasses.lazyMappedFunctionListVar(lock) {
|
||||
when (configuration.useIrFakeOverrideBuilder) {
|
||||
true -> computeOverriddenSymbolsForIrFakeOverrideGenerator()
|
||||
false -> computeOverriddenUsingFir2IrFakeOverrideGenerator()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// TODO: drop this function after migration to IR f/o generator will be complete (KT-64202)
|
||||
private fun computeOverriddenUsingFir2IrFakeOverrideGenerator(): List<IrSimpleFunctionSymbol> {
|
||||
if (firParent == null) return emptyList()
|
||||
|
||||
+6
@@ -19155,6 +19155,12 @@ public class FirLightTreeBlackBoxCodegenTestGenerated extends AbstractFirLightTr
|
||||
runTest("compiler/testData/codegen/box/fakeOverride/intersectionInLocal.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("intersectionOverrideBetweenValAndVar.kt")
|
||||
public void testIntersectionOverrideBetweenValAndVar() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/fakeOverride/intersectionOverrideBetweenValAndVar.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kt49371.kt")
|
||||
public void testKt49371() throws Exception {
|
||||
|
||||
+6
@@ -19155,6 +19155,12 @@ public class FirLightTreeBlackBoxCodegenWithIrFakeOverrideGeneratorTestGenerated
|
||||
runTest("compiler/testData/codegen/box/fakeOverride/intersectionInLocal.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("intersectionOverrideBetweenValAndVar.kt")
|
||||
public void testIntersectionOverrideBetweenValAndVar() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/fakeOverride/intersectionOverrideBetweenValAndVar.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kt49371.kt")
|
||||
public void testKt49371() throws Exception {
|
||||
|
||||
+6
@@ -19155,6 +19155,12 @@ public class FirPsiBlackBoxCodegenTestGenerated extends AbstractFirPsiBlackBoxCo
|
||||
runTest("compiler/testData/codegen/box/fakeOverride/intersectionInLocal.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("intersectionOverrideBetweenValAndVar.kt")
|
||||
public void testIntersectionOverrideBetweenValAndVar() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/fakeOverride/intersectionOverrideBetweenValAndVar.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kt49371.kt")
|
||||
public void testKt49371() throws Exception {
|
||||
|
||||
+146
@@ -0,0 +1,146 @@
|
||||
FILE fqName:<root> fileName:/intersectionOverrideBetweenValAndVar.kt
|
||||
CLASS CLASS name:A modality:ABSTRACT visibility:public superTypes:[kotlin.Any]
|
||||
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.A
|
||||
CONSTRUCTOR visibility:public <> () returnType:<root>.A [primary]
|
||||
BLOCK_BODY
|
||||
DELEGATING_CONSTRUCTOR_CALL 'public constructor <init> () declared in kotlin.Any'
|
||||
INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:A modality:ABSTRACT visibility:public superTypes:[kotlin.Any]'
|
||||
PROPERTY name:x visibility:public modality:ABSTRACT [val]
|
||||
FUN DEFAULT_PROPERTY_ACCESSOR name:<get-x> visibility:public modality:ABSTRACT <> ($this:<root>.A) returnType:kotlin.String
|
||||
correspondingProperty: PROPERTY name:x visibility:public modality:ABSTRACT [val]
|
||||
$this: VALUE_PARAMETER name:<this> type:<root>.A
|
||||
FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator]
|
||||
overridden:
|
||||
public open fun equals (other: kotlin.Any?): kotlin.Boolean declared in kotlin.Any
|
||||
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
|
||||
VALUE_PARAMETER name:other index:0 type:kotlin.Any?
|
||||
FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.Int [fake_override]
|
||||
overridden:
|
||||
public open fun hashCode (): kotlin.Int declared in kotlin.Any
|
||||
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
|
||||
FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String [fake_override]
|
||||
overridden:
|
||||
public open fun toString (): kotlin.String declared in kotlin.Any
|
||||
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
|
||||
CLASS INTERFACE name:B modality:ABSTRACT visibility:public superTypes:[kotlin.Any]
|
||||
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.B
|
||||
PROPERTY name:x visibility:public modality:ABSTRACT [var]
|
||||
FUN DEFAULT_PROPERTY_ACCESSOR name:<get-x> visibility:public modality:ABSTRACT <> ($this:<root>.B) returnType:kotlin.String
|
||||
correspondingProperty: PROPERTY name:x visibility:public modality:ABSTRACT [var]
|
||||
$this: VALUE_PARAMETER name:<this> type:<root>.B
|
||||
FUN DEFAULT_PROPERTY_ACCESSOR name:<set-x> visibility:public modality:ABSTRACT <> ($this:<root>.B, <set-?>:kotlin.String) returnType:kotlin.Unit
|
||||
correspondingProperty: PROPERTY name:x visibility:public modality:ABSTRACT [var]
|
||||
$this: VALUE_PARAMETER name:<this> type:<root>.B
|
||||
VALUE_PARAMETER name:<set-?> index:0 type:kotlin.String
|
||||
FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator]
|
||||
overridden:
|
||||
public open fun equals (other: kotlin.Any?): kotlin.Boolean declared in kotlin.Any
|
||||
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
|
||||
VALUE_PARAMETER name:other index:0 type:kotlin.Any?
|
||||
FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.Int [fake_override]
|
||||
overridden:
|
||||
public open fun hashCode (): kotlin.Int declared in kotlin.Any
|
||||
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
|
||||
FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String [fake_override]
|
||||
overridden:
|
||||
public open fun toString (): kotlin.String declared in kotlin.Any
|
||||
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
|
||||
CLASS CLASS name:C modality:ABSTRACT visibility:public superTypes:[<root>.A; <root>.B]
|
||||
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.C
|
||||
CONSTRUCTOR visibility:public <> () returnType:<root>.C [primary]
|
||||
BLOCK_BODY
|
||||
DELEGATING_CONSTRUCTOR_CALL 'public constructor <init> () declared in <root>.A'
|
||||
INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:C modality:ABSTRACT visibility:public superTypes:[<root>.A; <root>.B]'
|
||||
PROPERTY FAKE_OVERRIDE name:x visibility:public modality:ABSTRACT [fake_override,var]
|
||||
overridden:
|
||||
public abstract x: kotlin.String
|
||||
public abstract x: kotlin.String
|
||||
FUN FAKE_OVERRIDE name:<get-x> visibility:public modality:ABSTRACT <> ($this:<root>.B) returnType:kotlin.String [fake_override]
|
||||
correspondingProperty: PROPERTY FAKE_OVERRIDE name:x visibility:public modality:ABSTRACT [fake_override,var]
|
||||
overridden:
|
||||
public abstract fun <get-x> (): kotlin.String declared in <root>.A
|
||||
public abstract fun <get-x> (): kotlin.String declared in <root>.B
|
||||
$this: VALUE_PARAMETER name:<this> type:<root>.B
|
||||
FUN FAKE_OVERRIDE name:<set-x> visibility:public modality:ABSTRACT <> ($this:<root>.B, <set-?>:kotlin.String) returnType:kotlin.Unit [fake_override]
|
||||
correspondingProperty: PROPERTY FAKE_OVERRIDE name:x visibility:public modality:ABSTRACT [fake_override,var]
|
||||
overridden:
|
||||
public abstract fun <set-x> (<set-?>: kotlin.String): kotlin.Unit declared in <root>.B
|
||||
$this: VALUE_PARAMETER name:<this> type:<root>.B
|
||||
VALUE_PARAMETER name:<set-?> index:0 type:kotlin.String
|
||||
FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator]
|
||||
overridden:
|
||||
public open fun equals (other: kotlin.Any?): kotlin.Boolean declared in <root>.A
|
||||
public open fun equals (other: kotlin.Any?): kotlin.Boolean declared in <root>.B
|
||||
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
|
||||
VALUE_PARAMETER name:other index:0 type:kotlin.Any?
|
||||
FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.Int [fake_override]
|
||||
overridden:
|
||||
public open fun hashCode (): kotlin.Int declared in <root>.A
|
||||
public open fun hashCode (): kotlin.Int declared in <root>.B
|
||||
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
|
||||
FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String [fake_override]
|
||||
overridden:
|
||||
public open fun toString (): kotlin.String declared in <root>.A
|
||||
public open fun toString (): kotlin.String declared in <root>.B
|
||||
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
|
||||
CLASS CLASS name:D modality:FINAL visibility:public superTypes:[<root>.C]
|
||||
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.D
|
||||
CONSTRUCTOR visibility:public <> (x:kotlin.String) returnType:<root>.D [primary]
|
||||
VALUE_PARAMETER name:x index:0 type:kotlin.String
|
||||
BLOCK_BODY
|
||||
DELEGATING_CONSTRUCTOR_CALL 'public constructor <init> () declared in <root>.C'
|
||||
INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:D modality:FINAL visibility:public superTypes:[<root>.C]'
|
||||
PROPERTY name:x visibility:public modality:OPEN [var]
|
||||
overridden:
|
||||
public abstract x: kotlin.String
|
||||
FIELD PROPERTY_BACKING_FIELD name:x type:kotlin.String visibility:private
|
||||
EXPRESSION_BODY
|
||||
GET_VAR 'x: kotlin.String declared in <root>.D.<init>' type=kotlin.String origin=INITIALIZE_PROPERTY_FROM_PARAMETER
|
||||
FUN DEFAULT_PROPERTY_ACCESSOR name:<get-x> visibility:public modality:OPEN <> ($this:<root>.D) returnType:kotlin.String
|
||||
correspondingProperty: PROPERTY name:x visibility:public modality:OPEN [var]
|
||||
overridden:
|
||||
public abstract fun <get-x> (): kotlin.String declared in <root>.C
|
||||
$this: VALUE_PARAMETER name:<this> type:<root>.D
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing from='public open fun <get-x> (): kotlin.String declared in <root>.D'
|
||||
GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:x type:kotlin.String visibility:private' type=kotlin.String origin=null
|
||||
receiver: GET_VAR '<this>: <root>.D declared in <root>.D.<get-x>' type=<root>.D origin=null
|
||||
FUN DEFAULT_PROPERTY_ACCESSOR name:<set-x> visibility:public modality:OPEN <> ($this:<root>.D, <set-?>:kotlin.String) returnType:kotlin.Unit
|
||||
correspondingProperty: PROPERTY name:x visibility:public modality:OPEN [var]
|
||||
overridden:
|
||||
public abstract fun <set-x> (<set-?>: kotlin.String): kotlin.Unit declared in <root>.C
|
||||
$this: VALUE_PARAMETER name:<this> type:<root>.D
|
||||
VALUE_PARAMETER name:<set-?> index:0 type:kotlin.String
|
||||
BLOCK_BODY
|
||||
SET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:x type:kotlin.String visibility:private' type=kotlin.Unit origin=null
|
||||
receiver: GET_VAR '<this>: <root>.D declared in <root>.D.<set-x>' type=<root>.D origin=null
|
||||
value: GET_VAR '<set-?>: kotlin.String declared in <root>.D.<set-x>' type=kotlin.String origin=null
|
||||
FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator]
|
||||
overridden:
|
||||
public open fun equals (other: kotlin.Any?): kotlin.Boolean declared in <root>.C
|
||||
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
|
||||
VALUE_PARAMETER name:other index:0 type:kotlin.Any?
|
||||
FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.Int [fake_override]
|
||||
overridden:
|
||||
public open fun hashCode (): kotlin.Int declared in <root>.C
|
||||
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
|
||||
FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String [fake_override]
|
||||
overridden:
|
||||
public open fun toString (): kotlin.String declared in <root>.C
|
||||
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
|
||||
FUN name:test visibility:public modality:FINAL <> (c:<root>.C) returnType:kotlin.Unit
|
||||
VALUE_PARAMETER name:c index:0 type:<root>.C
|
||||
BLOCK_BODY
|
||||
CALL 'public abstract fun <set-x> (<set-?>: kotlin.String): kotlin.Unit declared in <root>.C' type=kotlin.Unit origin=EQ
|
||||
$this: GET_VAR 'c: <root>.C declared in <root>.test' type=<root>.C origin=null
|
||||
<set-?>: CONST String type=kotlin.String value="OK"
|
||||
FUN name:box visibility:public modality:FINAL <> () returnType:kotlin.String
|
||||
BLOCK_BODY
|
||||
VAR name:d type:<root>.D [val]
|
||||
CONSTRUCTOR_CALL 'public constructor <init> (x: kotlin.String) declared in <root>.D' type=<root>.D origin=null
|
||||
x: CONST String type=kotlin.String value="Fail"
|
||||
CALL 'public final fun test (c: <root>.C): kotlin.Unit declared in <root>' type=kotlin.Unit origin=null
|
||||
c: GET_VAR 'val d: <root>.D declared in <root>.box' type=<root>.D origin=null
|
||||
RETURN type=kotlin.Nothing from='public final fun box (): kotlin.String declared in <root>'
|
||||
CALL 'public open fun <get-x> (): kotlin.String declared in <root>.D' type=kotlin.String origin=GET_PROPERTY
|
||||
$this: GET_VAR 'val d: <root>.D declared in <root>.box' type=<root>.D origin=null
|
||||
+24
@@ -0,0 +1,24 @@
|
||||
// DUMP_IR
|
||||
// FIR_IDENTICAL
|
||||
|
||||
abstract class A {
|
||||
abstract val x: String
|
||||
}
|
||||
|
||||
interface B {
|
||||
var x: String
|
||||
}
|
||||
|
||||
abstract class C : A(), B
|
||||
|
||||
class D(override var x: String) : C()
|
||||
|
||||
fun test(c: C) {
|
||||
c.x = "OK"
|
||||
}
|
||||
|
||||
fun box(): String {
|
||||
val d = D("Fail")
|
||||
test(d)
|
||||
return d.x
|
||||
}
|
||||
@@ -1,4 +1,5 @@
|
||||
// TARGET_BACKEND: JVM_IR
|
||||
// IGNORE_CODEGEN_WITH_IR_FAKE_OVERRIDE_GENERATION: KT-64150
|
||||
// FILE: AbstractBlackBoxCodegenTest.java
|
||||
|
||||
public abstract class AbstractBlackBoxCodegenTest extends CodegenTestCase {}
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
// TARGET_BACKEND: JVM
|
||||
// IGNORE_CODEGEN_WITH_IR_FAKE_OVERRIDE_GENERATION: KT-63489
|
||||
// MODULE: lib
|
||||
// FILE: CharBuffer.java
|
||||
|
||||
|
||||
+6
@@ -18321,6 +18321,12 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest {
|
||||
runTest("compiler/testData/codegen/box/fakeOverride/intersectionInLocal.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("intersectionOverrideBetweenValAndVar.kt")
|
||||
public void testIntersectionOverrideBetweenValAndVar() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/fakeOverride/intersectionOverrideBetweenValAndVar.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kt49371.kt")
|
||||
public void testKt49371() throws Exception {
|
||||
|
||||
+6
@@ -19155,6 +19155,12 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes
|
||||
runTest("compiler/testData/codegen/box/fakeOverride/intersectionInLocal.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("intersectionOverrideBetweenValAndVar.kt")
|
||||
public void testIntersectionOverrideBetweenValAndVar() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/fakeOverride/intersectionOverrideBetweenValAndVar.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kt49371.kt")
|
||||
public void testKt49371() throws Exception {
|
||||
|
||||
+6
@@ -19155,6 +19155,12 @@ public class IrBlackBoxCodegenWithIrInlinerTestGenerated extends AbstractIrBlack
|
||||
runTest("compiler/testData/codegen/box/fakeOverride/intersectionInLocal.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("intersectionOverrideBetweenValAndVar.kt")
|
||||
public void testIntersectionOverrideBetweenValAndVar() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/fakeOverride/intersectionOverrideBetweenValAndVar.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kt49371.kt")
|
||||
public void testKt49371() throws Exception {
|
||||
|
||||
+5
@@ -15931,6 +15931,11 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes
|
||||
runTest("compiler/testData/codegen/box/fakeOverride/intersectionInLocal.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("intersectionOverrideBetweenValAndVar.kt")
|
||||
public void testIntersectionOverrideBetweenValAndVar() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/fakeOverride/intersectionOverrideBetweenValAndVar.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("kt49371.kt")
|
||||
public void testKt49371() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/fakeOverride/kt49371.kt");
|
||||
|
||||
+6
@@ -14337,6 +14337,12 @@ public class FirJsCodegenBoxTestGenerated extends AbstractFirJsCodegenBoxTest {
|
||||
runTest("compiler/testData/codegen/box/fakeOverride/intersectionInLocal.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("intersectionOverrideBetweenValAndVar.kt")
|
||||
public void testIntersectionOverrideBetweenValAndVar() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/fakeOverride/intersectionOverrideBetweenValAndVar.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kt49371.kt")
|
||||
public void testKt49371() throws Exception {
|
||||
|
||||
Generated
+6
@@ -14337,6 +14337,12 @@ public class FirJsES6CodegenBoxTestGenerated extends AbstractFirJsES6CodegenBoxT
|
||||
runTest("compiler/testData/codegen/box/fakeOverride/intersectionInLocal.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("intersectionOverrideBetweenValAndVar.kt")
|
||||
public void testIntersectionOverrideBetweenValAndVar() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/fakeOverride/intersectionOverrideBetweenValAndVar.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kt49371.kt")
|
||||
public void testKt49371() throws Exception {
|
||||
|
||||
+6
@@ -14337,6 +14337,12 @@ public class IrJsCodegenBoxTestGenerated extends AbstractIrJsCodegenBoxTest {
|
||||
runTest("compiler/testData/codegen/box/fakeOverride/intersectionInLocal.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("intersectionOverrideBetweenValAndVar.kt")
|
||||
public void testIntersectionOverrideBetweenValAndVar() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/fakeOverride/intersectionOverrideBetweenValAndVar.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kt49371.kt")
|
||||
public void testKt49371() throws Exception {
|
||||
|
||||
+6
@@ -14337,6 +14337,12 @@ public class IrJsES6CodegenBoxTestGenerated extends AbstractIrJsES6CodegenBoxTes
|
||||
runTest("compiler/testData/codegen/box/fakeOverride/intersectionInLocal.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("intersectionOverrideBetweenValAndVar.kt")
|
||||
public void testIntersectionOverrideBetweenValAndVar() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/fakeOverride/intersectionOverrideBetweenValAndVar.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kt49371.kt")
|
||||
public void testKt49371() throws Exception {
|
||||
|
||||
+6
@@ -15464,6 +15464,12 @@ public class FirNativeCodegenBoxTestGenerated extends AbstractNativeCodegenBoxTe
|
||||
runTest("compiler/testData/codegen/box/fakeOverride/intersectionInLocal.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("intersectionOverrideBetweenValAndVar.kt")
|
||||
public void testIntersectionOverrideBetweenValAndVar() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/fakeOverride/intersectionOverrideBetweenValAndVar.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kt49371.kt")
|
||||
public void testKt49371() throws Exception {
|
||||
|
||||
+6
@@ -15826,6 +15826,12 @@ public class FirNativeCodegenBoxTestNoPLGenerated extends AbstractNativeCodegenB
|
||||
runTest("compiler/testData/codegen/box/fakeOverride/intersectionInLocal.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("intersectionOverrideBetweenValAndVar.kt")
|
||||
public void testIntersectionOverrideBetweenValAndVar() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/fakeOverride/intersectionOverrideBetweenValAndVar.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kt49371.kt")
|
||||
public void testKt49371() throws Exception {
|
||||
|
||||
+6
@@ -15102,6 +15102,12 @@ public class NativeCodegenBoxTestGenerated extends AbstractNativeCodegenBoxTest
|
||||
runTest("compiler/testData/codegen/box/fakeOverride/intersectionInLocal.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("intersectionOverrideBetweenValAndVar.kt")
|
||||
public void testIntersectionOverrideBetweenValAndVar() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/fakeOverride/intersectionOverrideBetweenValAndVar.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kt49371.kt")
|
||||
public void testKt49371() throws Exception {
|
||||
|
||||
+6
@@ -15465,6 +15465,12 @@ public class NativeCodegenBoxTestNoPLGenerated extends AbstractNativeCodegenBoxT
|
||||
runTest("compiler/testData/codegen/box/fakeOverride/intersectionInLocal.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("intersectionOverrideBetweenValAndVar.kt")
|
||||
public void testIntersectionOverrideBetweenValAndVar() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/fakeOverride/intersectionOverrideBetweenValAndVar.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kt49371.kt")
|
||||
public void testKt49371() throws Exception {
|
||||
|
||||
Generated
+6
@@ -14313,6 +14313,12 @@ public class FirWasmCodegenBoxTestGenerated extends AbstractFirWasmCodegenBoxTes
|
||||
runTest("compiler/testData/codegen/box/fakeOverride/intersectionInLocal.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("intersectionOverrideBetweenValAndVar.kt")
|
||||
public void testIntersectionOverrideBetweenValAndVar() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/fakeOverride/intersectionOverrideBetweenValAndVar.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kt49371.kt")
|
||||
public void testKt49371() throws Exception {
|
||||
|
||||
Generated
+6
@@ -14313,6 +14313,12 @@ public class K1WasmCodegenBoxTestGenerated extends AbstractK1WasmCodegenBoxTest
|
||||
runTest("compiler/testData/codegen/box/fakeOverride/intersectionInLocal.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("intersectionOverrideBetweenValAndVar.kt")
|
||||
public void testIntersectionOverrideBetweenValAndVar() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/fakeOverride/intersectionOverrideBetweenValAndVar.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kt49371.kt")
|
||||
public void testKt49371() throws Exception {
|
||||
|
||||
Reference in New Issue
Block a user