[FIR] Update all required places according to changed overridden processing contract
This commit fixes all places that relied on the contract described in the previous commit and also updates corresponding tests ^KT-63738
This commit is contained in:
committed by
Space Team
parent
4272f2e156
commit
385bff3be1
Vendored
+6
-1
@@ -7,9 +7,14 @@ B:
|
|||||||
|
|
||||||
C:
|
C:
|
||||||
[Source]: public open override fun getFoo(): R|kotlin/String| from Java enhancement scope for /C [id: 0]
|
[Source]: public open override fun getFoo(): R|kotlin/String| from Java enhancement scope for /C [id: 0]
|
||||||
|
[Source]: public open override fun getFoo(): R|kotlin/String| from Use site scope of /B [id: 0]
|
||||||
|
[Enhancement]: public abstract fun getFoo(): R|kotlin/String!| from Java enhancement scope for /A [id: 1]
|
||||||
[Enhancement]: public abstract fun getFoo(): R|kotlin/String!| from Java enhancement scope for /A [id: 1]
|
[Enhancement]: public abstract fun getFoo(): R|kotlin/String!| from Java enhancement scope for /A [id: 1]
|
||||||
|
|
||||||
D:
|
D:
|
||||||
[Source]: public open override fun getFoo(): R|kotlin/String| from Use site scope of /D [id: 0]
|
[Source]: public open override fun getFoo(): R|kotlin/String| from Use site scope of /D [id: 0]
|
||||||
[Enhancement]: public abstract fun getFoo(): R|kotlin/String!| from Java enhancement scope for /A [id: 1]
|
[Source]: public open override fun getFoo(): R|kotlin/String| from Java enhancement scope for /C [id: 0]
|
||||||
|
[Source]: public open override fun getFoo(): R|kotlin/String| from Use site scope of /B [id: 0]
|
||||||
|
[Enhancement]: public abstract fun getFoo(): R|kotlin/String!| from Java enhancement scope for /A [id: 1]
|
||||||
|
[Enhancement]: public abstract fun getFoo(): R|kotlin/String!| from Java enhancement scope for /A [id: 1]
|
||||||
|
|
||||||
|
|||||||
compiler/fir/analysis-tests/testData/resolve/scopes/noIntersectionOverrideOfTwoMembers.overrides.txt
Vendored
+12
@@ -1,26 +1,38 @@
|
|||||||
C:
|
C:
|
||||||
[Source]: public abstract override fun foo(): R|kotlin/Any| from Use site scope of /C [id: 0]
|
[Source]: public abstract override fun foo(): R|kotlin/Any| from Use site scope of /C [id: 0]
|
||||||
[Source]: public abstract fun foo(): R|kotlin/Any| from Use site scope of /A [id: 1]
|
[Source]: public abstract fun foo(): R|kotlin/Any| from Use site scope of /A [id: 1]
|
||||||
|
[Source]: public abstract override fun foo(): R|kotlin/Any| from Use site scope of /B [id: 0]
|
||||||
|
[Source]: public abstract fun foo(): R|kotlin/Any| from Use site scope of /A [id: 1]
|
||||||
[Source]: public abstract override val x: R|kotlin/Any| from Use site scope of /C [id: 0]
|
[Source]: public abstract override val x: R|kotlin/Any| from Use site scope of /C [id: 0]
|
||||||
[Source]: public abstract val x: R|kotlin/Any| from Use site scope of /A [id: 1]
|
[Source]: public abstract val x: R|kotlin/Any| from Use site scope of /A [id: 1]
|
||||||
|
[Source]: public abstract override val x: R|kotlin/Any| from Use site scope of /B [id: 0]
|
||||||
|
[Source]: public abstract val x: R|kotlin/Any| from Use site scope of /A [id: 1]
|
||||||
|
|
||||||
Explicit:
|
Explicit:
|
||||||
[Source]: public abstract override fun foo(): R|kotlin/Int| from Use site scope of /Explicit [id: 0]
|
[Source]: public abstract override fun foo(): R|kotlin/Int| from Use site scope of /Explicit [id: 0]
|
||||||
[Source]: public abstract override fun foo(): R|kotlin/Any| from Use site scope of /C [id: 1]
|
[Source]: public abstract override fun foo(): R|kotlin/Any| from Use site scope of /C [id: 1]
|
||||||
[Source]: public abstract fun foo(): R|kotlin/Any| from Use site scope of /A [id: 2]
|
[Source]: public abstract fun foo(): R|kotlin/Any| from Use site scope of /A [id: 2]
|
||||||
|
[Source]: public abstract override fun foo(): R|kotlin/Any| from Use site scope of /B [id: 1]
|
||||||
|
[Source]: public abstract fun foo(): R|kotlin/Any| from Use site scope of /A [id: 2]
|
||||||
[Source]: public abstract fun foo(): R|kotlin/Int| from Use site scope of /D [id: 3]
|
[Source]: public abstract fun foo(): R|kotlin/Int| from Use site scope of /D [id: 3]
|
||||||
[Source]: public abstract override val x: R|kotlin/Any| from Use site scope of /Explicit [id: 0]
|
[Source]: public abstract override val x: R|kotlin/Any| from Use site scope of /Explicit [id: 0]
|
||||||
[Source]: public abstract override val x: R|kotlin/Any| from Use site scope of /C [id: 1]
|
[Source]: public abstract override val x: R|kotlin/Any| from Use site scope of /C [id: 1]
|
||||||
[Source]: public abstract val x: R|kotlin/Any| from Use site scope of /A [id: 2]
|
[Source]: public abstract val x: R|kotlin/Any| from Use site scope of /A [id: 2]
|
||||||
|
[Source]: public abstract override val x: R|kotlin/Any| from Use site scope of /B [id: 1]
|
||||||
|
[Source]: public abstract val x: R|kotlin/Any| from Use site scope of /A [id: 2]
|
||||||
[Source]: public abstract val x: R|kotlin/Any| from Use site scope of /D [id: 3]
|
[Source]: public abstract val x: R|kotlin/Any| from Use site scope of /D [id: 3]
|
||||||
|
|
||||||
Implicit:
|
Implicit:
|
||||||
[IntersectionOverride]: public abstract fun foo(): R|kotlin/Int| from Use site scope of /Implicit [id: 0]
|
[IntersectionOverride]: public abstract fun foo(): R|kotlin/Int| from Use site scope of /Implicit [id: 0]
|
||||||
[Source]: public abstract override fun foo(): R|kotlin/Any| from Use site scope of /C [id: 1]
|
[Source]: public abstract override fun foo(): R|kotlin/Any| from Use site scope of /C [id: 1]
|
||||||
[Source]: public abstract fun foo(): R|kotlin/Any| from Use site scope of /A [id: 2]
|
[Source]: public abstract fun foo(): R|kotlin/Any| from Use site scope of /A [id: 2]
|
||||||
|
[Source]: public abstract override fun foo(): R|kotlin/Any| from Use site scope of /B [id: 1]
|
||||||
|
[Source]: public abstract fun foo(): R|kotlin/Any| from Use site scope of /A [id: 2]
|
||||||
[Source]: public abstract fun foo(): R|kotlin/Int| from Use site scope of /D [id: 3]
|
[Source]: public abstract fun foo(): R|kotlin/Int| from Use site scope of /D [id: 3]
|
||||||
[IntersectionOverride]: public abstract override val x: R|kotlin/Any| from Use site scope of /Implicit [id: 0]
|
[IntersectionOverride]: public abstract override val x: R|kotlin/Any| from Use site scope of /Implicit [id: 0]
|
||||||
[Source]: public abstract override val x: R|kotlin/Any| from Use site scope of /C [id: 1]
|
[Source]: public abstract override val x: R|kotlin/Any| from Use site scope of /C [id: 1]
|
||||||
[Source]: public abstract val x: R|kotlin/Any| from Use site scope of /A [id: 2]
|
[Source]: public abstract val x: R|kotlin/Any| from Use site scope of /A [id: 2]
|
||||||
|
[Source]: public abstract override val x: R|kotlin/Any| from Use site scope of /B [id: 1]
|
||||||
|
[Source]: public abstract val x: R|kotlin/Any| from Use site scope of /A [id: 2]
|
||||||
[Source]: public abstract val x: R|kotlin/Any| from Use site scope of /D [id: 3]
|
[Source]: public abstract val x: R|kotlin/Any| from Use site scope of /D [id: 3]
|
||||||
|
|
||||||
|
|||||||
+13
@@ -1,25 +1,38 @@
|
|||||||
C:
|
C:
|
||||||
[Source]: public abstract override fun foo(): R|kotlin/Any| from Use site scope of /C [id: 0]
|
[Source]: public abstract override fun foo(): R|kotlin/Any| from Use site scope of /C [id: 0]
|
||||||
[Source]: public abstract fun foo(): R|kotlin/Any| from Use site scope of /A [id: 1]
|
[Source]: public abstract fun foo(): R|kotlin/Any| from Use site scope of /A [id: 1]
|
||||||
|
[Source]: public abstract override fun foo(): R|kotlin/Any| from Use site scope of /B [id: 0]
|
||||||
|
[Source]: public abstract fun foo(): R|kotlin/Any| from Use site scope of /A [id: 1]
|
||||||
[Source]: public abstract override val x: R|kotlin/Any| from Use site scope of /C [id: 0]
|
[Source]: public abstract override val x: R|kotlin/Any| from Use site scope of /C [id: 0]
|
||||||
[Source]: public abstract val x: R|kotlin/Any| from Use site scope of /A [id: 1]
|
[Source]: public abstract val x: R|kotlin/Any| from Use site scope of /A [id: 1]
|
||||||
|
[Source]: public abstract override val x: R|kotlin/Any| from Use site scope of /B [id: 0]
|
||||||
|
[Source]: public abstract val x: R|kotlin/Any| from Use site scope of /A [id: 1]
|
||||||
|
|
||||||
Explicit:
|
Explicit:
|
||||||
[Source]: public abstract override fun foo(): R|kotlin/Int| from Use site scope of /Explicit [id: 0]
|
[Source]: public abstract override fun foo(): R|kotlin/Int| from Use site scope of /Explicit [id: 0]
|
||||||
[Source]: public abstract override fun foo(): R|kotlin/Any| from Use site scope of /C [id: 1]
|
[Source]: public abstract override fun foo(): R|kotlin/Any| from Use site scope of /C [id: 1]
|
||||||
[Source]: public abstract fun foo(): R|kotlin/Any| from Use site scope of /A [id: 2]
|
[Source]: public abstract fun foo(): R|kotlin/Any| from Use site scope of /A [id: 2]
|
||||||
|
[Source]: public abstract override fun foo(): R|kotlin/Any| from Use site scope of /B [id: 1]
|
||||||
|
[Source]: public abstract fun foo(): R|kotlin/Any| from Use site scope of /A [id: 2]
|
||||||
[Source]: public abstract fun foo(): R|kotlin/Int| from Use site scope of /D [id: 3]
|
[Source]: public abstract fun foo(): R|kotlin/Int| from Use site scope of /D [id: 3]
|
||||||
[Source]: public abstract override val x: R|kotlin/Any| from Use site scope of /Explicit [id: 0]
|
[Source]: public abstract override val x: R|kotlin/Any| from Use site scope of /Explicit [id: 0]
|
||||||
[Source]: public abstract override val x: R|kotlin/Any| from Use site scope of /C [id: 1]
|
[Source]: public abstract override val x: R|kotlin/Any| from Use site scope of /C [id: 1]
|
||||||
[Source]: public abstract val x: R|kotlin/Any| from Use site scope of /A [id: 2]
|
[Source]: public abstract val x: R|kotlin/Any| from Use site scope of /A [id: 2]
|
||||||
|
[Source]: public abstract override val x: R|kotlin/Any| from Use site scope of /B [id: 1]
|
||||||
|
[Source]: public abstract val x: R|kotlin/Any| from Use site scope of /A [id: 2]
|
||||||
[Source]: public abstract val x: R|kotlin/Any| from Use site scope of /D [id: 3]
|
[Source]: public abstract val x: R|kotlin/Any| from Use site scope of /D [id: 3]
|
||||||
|
|
||||||
Implicit:
|
Implicit:
|
||||||
[IntersectionOverride]: public abstract fun foo(): R|kotlin/Int| from Use site scope of /Implicit [id: 0]
|
[IntersectionOverride]: public abstract fun foo(): R|kotlin/Int| from Use site scope of /Implicit [id: 0]
|
||||||
[Source]: public abstract override fun foo(): R|kotlin/Any| from Use site scope of /C [id: 1]
|
[Source]: public abstract override fun foo(): R|kotlin/Any| from Use site scope of /C [id: 1]
|
||||||
[Source]: public abstract fun foo(): R|kotlin/Any| from Use site scope of /A [id: 2]
|
[Source]: public abstract fun foo(): R|kotlin/Any| from Use site scope of /A [id: 2]
|
||||||
|
[Source]: public abstract override fun foo(): R|kotlin/Any| from Use site scope of /B [id: 1]
|
||||||
|
[Source]: public abstract fun foo(): R|kotlin/Any| from Use site scope of /A [id: 2]
|
||||||
[Source]: public abstract fun foo(): R|kotlin/Int| from Use site scope of /D [id: 3]
|
[Source]: public abstract fun foo(): R|kotlin/Int| from Use site scope of /D [id: 3]
|
||||||
[IntersectionOverride]: public abstract override val x: R|kotlin/Any| from Use site scope of /Implicit [id: 0]
|
[IntersectionOverride]: public abstract override val x: R|kotlin/Any| from Use site scope of /Implicit [id: 0]
|
||||||
[Source]: public abstract override val x: R|kotlin/Any| from Use site scope of /C [id: 1]
|
[Source]: public abstract override val x: R|kotlin/Any| from Use site scope of /C [id: 1]
|
||||||
[Source]: public abstract val x: R|kotlin/Any| from Use site scope of /A [id: 2]
|
[Source]: public abstract val x: R|kotlin/Any| from Use site scope of /A [id: 2]
|
||||||
|
[Source]: public abstract override val x: R|kotlin/Any| from Use site scope of /B [id: 1]
|
||||||
|
[Source]: public abstract val x: R|kotlin/Any| from Use site scope of /A [id: 2]
|
||||||
[Source]: public abstract val x: R|kotlin/Any| from Use site scope of /D [id: 3]
|
[Source]: public abstract val x: R|kotlin/Any| from Use site scope of /D [id: 3]
|
||||||
|
|
||||||
|
|||||||
Vendored
+7
-3
@@ -1,6 +1,7 @@
|
|||||||
C:
|
C:
|
||||||
[Source]: public open override fun getName(): R|kotlin/String| from Use site scope of /C [id: 0]
|
[Source]: public open override fun getName(): R|kotlin/String| from Use site scope of /C [id: 0]
|
||||||
[Enhancement]: public abstract fun getName(): R|kotlin/String!| from Substitution scope for [Java enhancement scope for /B] for type C [id: 1]
|
[Enhancement]: public abstract fun getName(): R|kotlin/String!| from Substitution scope for [Java enhancement scope for /B] for type C [id: 1]
|
||||||
|
[Enhancement]: public abstract fun getName(): R|kotlin/String!| from Java enhancement scope for /A [id: 1]
|
||||||
[Source]: public open override fun setName(newName: R|kotlin/String|): R|kotlin/Any?| from Use site scope of /C [id: 0]
|
[Source]: public open override fun setName(newName: R|kotlin/String|): R|kotlin/Any?| from Use site scope of /C [id: 0]
|
||||||
[SubstitutionOverride(DeclarationSite)]: public abstract fun setName(newName: R|kotlin/String!|): R|kotlin/Any!| from Substitution scope for [Java enhancement scope for /B] for type C [id: 1]
|
[SubstitutionOverride(DeclarationSite)]: public abstract fun setName(newName: R|kotlin/String!|): R|kotlin/Any!| from Substitution scope for [Java enhancement scope for /B] for type C [id: 1]
|
||||||
[Enhancement]: public abstract fun setName(newName: R|kotlin/String!|): R|ft<T & Any, T?>| from Java enhancement scope for /B [id: 2]
|
[Enhancement]: public abstract fun setName(newName: R|kotlin/String!|): R|ft<T & Any, T?>| from Java enhancement scope for /B [id: 2]
|
||||||
@@ -8,10 +9,13 @@ C:
|
|||||||
|
|
||||||
D:
|
D:
|
||||||
[Source]: public open override fun getName(): R|kotlin/String| from Java enhancement scope for /D [id: 0]
|
[Source]: public open override fun getName(): R|kotlin/String| from Java enhancement scope for /D [id: 0]
|
||||||
[Enhancement]: public abstract fun getName(): R|kotlin/String!| from Substitution scope for [Java enhancement scope for /B] for type C [id: 1]
|
[Source]: public open override fun getName(): R|kotlin/String| from Use site scope of /C [id: 0]
|
||||||
|
[Enhancement]: public abstract fun getName(): R|kotlin/String!| from Substitution scope for [Java enhancement scope for /B] for type C [id: 1]
|
||||||
|
[Enhancement]: public abstract fun getName(): R|kotlin/String!| from Java enhancement scope for /A [id: 1]
|
||||||
[Source]: public open override fun setName(newName: R|kotlin/String|): R|kotlin/Any?| from Java enhancement scope for /D [id: 0]
|
[Source]: public open override fun setName(newName: R|kotlin/String|): R|kotlin/Any?| from Java enhancement scope for /D [id: 0]
|
||||||
[SubstitutionOverride(DeclarationSite)]: public abstract fun setName(newName: R|kotlin/String!|): R|kotlin/Any!| from Substitution scope for [Java enhancement scope for /B] for type C [id: 1]
|
[Source]: public open override fun setName(newName: R|kotlin/String|): R|kotlin/Any?| from Use site scope of /C [id: 0]
|
||||||
[Enhancement]: public abstract fun setName(newName: R|kotlin/String!|): R|ft<T & Any, T?>| from Java enhancement scope for /B [id: 2]
|
[SubstitutionOverride(DeclarationSite)]: public abstract fun setName(newName: R|kotlin/String!|): R|kotlin/Any!| from Substitution scope for [Java enhancement scope for /B] for type C [id: 1]
|
||||||
|
[Enhancement]: public abstract fun setName(newName: R|kotlin/String!|): R|ft<T & Any, T?>| from Java enhancement scope for /B [id: 2]
|
||||||
[Source]: private final var name: R|kotlin/String| from Java enhancement scope for /D [id: 0]
|
[Source]: private final var name: R|kotlin/String| from Java enhancement scope for /D [id: 0]
|
||||||
[Source]: private final var name: R|kotlin/String| from Use site scope of /C [id: 0]
|
[Source]: private final var name: R|kotlin/String| from Use site scope of /C [id: 0]
|
||||||
|
|
||||||
|
|||||||
+8
-7
@@ -37,15 +37,16 @@ object FirJsNameClashClassMembersChecker : FirClassChecker() {
|
|||||||
private val allSymbols = mutableSetOf<FirCallableSymbol<*>>()
|
private val allSymbols = mutableSetOf<FirCallableSymbol<*>>()
|
||||||
|
|
||||||
private fun FirTypeScope.collectOverriddenLeaves(classMemberSymbol: FirCallableSymbol<*>): Set<FirCallableSymbol<*>> {
|
private fun FirTypeScope.collectOverriddenLeaves(classMemberSymbol: FirCallableSymbol<*>): Set<FirCallableSymbol<*>> {
|
||||||
val visitedSymbols = hashSetOf(classMemberSymbol)
|
val startMemberWithScope = MemberWithBaseScope(classMemberSymbol, this)
|
||||||
val symbolsToProcess = mutableListOf(classMemberSymbol)
|
val visitedSymbols = hashSetOf(startMemberWithScope)
|
||||||
|
val symbolsToProcess = mutableListOf(startMemberWithScope)
|
||||||
val leaves = mutableSetOf<FirCallableSymbol<*>>()
|
val leaves = mutableSetOf<FirCallableSymbol<*>>()
|
||||||
while (symbolsToProcess.isNotEmpty()) {
|
while (symbolsToProcess.isNotEmpty()) {
|
||||||
val processingSymbol = symbolsToProcess.popLast()
|
val (processingSymbol, scope) = symbolsToProcess.popLast()
|
||||||
val overriddenMembers = getDirectOverriddenMembers(processingSymbol, true)
|
val overriddenMembers = scope.getDirectOverriddenMembersWithBaseScope(processingSymbol)
|
||||||
for (overriddenMember in overriddenMembers) {
|
for (overriddenMemberWithScope in overriddenMembers) {
|
||||||
if (visitedSymbols.add(overriddenMember)) {
|
if (visitedSymbols.add(overriddenMemberWithScope)) {
|
||||||
symbolsToProcess.add(overriddenMember)
|
symbolsToProcess.add(overriddenMemberWithScope)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (overriddenMembers.isEmpty()) {
|
if (overriddenMembers.isEmpty()) {
|
||||||
|
|||||||
@@ -214,7 +214,7 @@ fun CheckerContext.findClosestClassOrObject(): FirClass? {
|
|||||||
fun FirNamedFunctionSymbol.overriddenFunctions(
|
fun FirNamedFunctionSymbol.overriddenFunctions(
|
||||||
containingClass: FirClassSymbol<*>,
|
containingClass: FirClassSymbol<*>,
|
||||||
context: CheckerContext,
|
context: CheckerContext,
|
||||||
): List<FirFunctionSymbol<*>> {
|
): Collection<FirFunctionSymbol<*>> {
|
||||||
return overriddenFunctions(containingClass, context.session, context.scopeSession)
|
return overriddenFunctions(containingClass, context.session, context.scopeSession)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+3
-3
@@ -64,9 +64,9 @@ object FirNotImplementedOverrideChecker : FirClassChecker() {
|
|||||||
fun collectSymbol(symbol: FirCallableSymbol<*>) {
|
fun collectSymbol(symbol: FirCallableSymbol<*>) {
|
||||||
val delegatedWrapperData = symbol.delegatedWrapperData
|
val delegatedWrapperData = symbol.delegatedWrapperData
|
||||||
if (delegatedWrapperData != null) {
|
if (delegatedWrapperData != null) {
|
||||||
val directOverriddenMembersWithBaseScope = classScope.getDirectOverriddenMembersWithBaseScope(
|
val directOverriddenMembersWithBaseScope = classScope
|
||||||
symbol
|
.getDirectOverriddenMembersWithBaseScope(symbol)
|
||||||
)
|
.filter { it.member != symbol }
|
||||||
|
|
||||||
@Suppress("UNCHECKED_CAST")
|
@Suppress("UNCHECKED_CAST")
|
||||||
val filteredOverriddenMembers = when (symbol) {
|
val filteredOverriddenMembers = when (symbol) {
|
||||||
|
|||||||
+4
-4
@@ -46,8 +46,8 @@ import org.jetbrains.kotlin.name.Name
|
|||||||
* TODO: generic super interface types and generic delegated members.
|
* TODO: generic super interface types and generic delegated members.
|
||||||
*/
|
*/
|
||||||
class DelegatedMemberGenerator(private val components: Fir2IrComponents) : Fir2IrComponents by components {
|
class DelegatedMemberGenerator(private val components: Fir2IrComponents) : Fir2IrComponents by components {
|
||||||
private val baseFunctionSymbols: MutableMap<IrFunction, List<FirNamedFunctionSymbol>> = mutableMapOf()
|
private val baseFunctionSymbols: MutableMap<IrFunction, Collection<FirNamedFunctionSymbol>> = mutableMapOf()
|
||||||
private val basePropertySymbols: MutableMap<IrProperty, List<FirPropertySymbol>> = mutableMapOf()
|
private val basePropertySymbols: MutableMap<IrProperty, Collection<FirPropertySymbol>> = mutableMapOf()
|
||||||
|
|
||||||
private data class DeclarationBodyInfo(
|
private data class DeclarationBodyInfo(
|
||||||
val declaration: IrDeclaration,
|
val declaration: IrDeclaration,
|
||||||
@@ -231,7 +231,7 @@ class DelegatedMemberGenerator(private val components: Fir2IrComponents) : Fir2I
|
|||||||
delegateOverride, subClass, predefinedOrigin = IrDeclarationOrigin.DELEGATED_MEMBER,
|
delegateOverride, subClass, predefinedOrigin = IrDeclarationOrigin.DELEGATED_MEMBER,
|
||||||
fakeOverrideOwnerLookupTag = firSubClass.symbol.toLookupTag()
|
fakeOverrideOwnerLookupTag = firSubClass.symbol.toLookupTag()
|
||||||
)
|
)
|
||||||
val baseSymbols = mutableListOf<FirNamedFunctionSymbol>()
|
val baseSymbols = mutableSetOf<FirNamedFunctionSymbol>()
|
||||||
// the overridden symbols should be collected only after all fake overrides for all superclases are created and bound to their
|
// the overridden symbols should be collected only after all fake overrides for all superclases are created and bound to their
|
||||||
// overridden symbols, otherwise in some cases they will be left in inconsistent state leading to the errors in IR
|
// overridden symbols, otherwise in some cases they will be left in inconsistent state leading to the errors in IR
|
||||||
delegateOverride.processOverriddenFunctionSymbols(firSubClass) {
|
delegateOverride.processOverriddenFunctionSymbols(firSubClass) {
|
||||||
@@ -364,7 +364,7 @@ class DelegatedMemberGenerator(private val components: Fir2IrComponents) : Fir2I
|
|||||||
)
|
)
|
||||||
// the overridden symbols should be collected only after all fake overrides for all superclases are created and bound to their
|
// the overridden symbols should be collected only after all fake overrides for all superclases are created and bound to their
|
||||||
// overridden symbols, otherwise in some cases they will be left in inconsistent state leading to the errors in IR
|
// overridden symbols, otherwise in some cases they will be left in inconsistent state leading to the errors in IR
|
||||||
val baseSymbols = mutableListOf<FirPropertySymbol>()
|
val baseSymbols = mutableSetOf<FirPropertySymbol>()
|
||||||
firDelegateProperty.processOverriddenPropertySymbols(firSubClass) {
|
firDelegateProperty.processOverriddenPropertySymbols(firSubClass) {
|
||||||
baseSymbols.add(it)
|
baseSymbols.add(it)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -61,7 +61,7 @@ fun FirNamedFunctionSymbol.overriddenFunctions(
|
|||||||
containingClass: FirClassSymbol<*>,
|
containingClass: FirClassSymbol<*>,
|
||||||
session: FirSession,
|
session: FirSession,
|
||||||
scopeSession: ScopeSession,
|
scopeSession: ScopeSession,
|
||||||
): List<FirFunctionSymbol<*>> {
|
): Collection<FirFunctionSymbol<*>> {
|
||||||
val firTypeScope = containingClass.unsubstitutedScope(
|
val firTypeScope = containingClass.unsubstitutedScope(
|
||||||
session,
|
session,
|
||||||
scopeSession,
|
scopeSession,
|
||||||
@@ -69,12 +69,20 @@ fun FirNamedFunctionSymbol.overriddenFunctions(
|
|||||||
memberRequiredPhase = FirResolvePhase.STATUS,
|
memberRequiredPhase = FirResolvePhase.STATUS,
|
||||||
)
|
)
|
||||||
|
|
||||||
val overriddenFunctions = mutableListOf<FirFunctionSymbol<*>>()
|
val overriddenFunctions = mutableSetOf<FirFunctionSymbol<*>>()
|
||||||
firTypeScope.processFunctionsByName(callableId.callableName) { }
|
firTypeScope.processFunctionsByName(callableId.callableName) { }
|
||||||
firTypeScope.processOverriddenFunctions(this) {
|
firTypeScope.processOverriddenFunctions(this) {
|
||||||
overriddenFunctions.add(it)
|
overriddenFunctions.add(it)
|
||||||
ProcessorAction.NEXT
|
ProcessorAction.NEXT
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* The original symbol may appear in `processOverriddenFunctions`, so it should be removed from the resulting
|
||||||
|
* list to not confuse the caller with a situation when the function directly overrides itself
|
||||||
|
*
|
||||||
|
* For details see FirTypeScope.processDirectOverriddenFunctionsWithBaseScope
|
||||||
|
*/
|
||||||
|
overriddenFunctions -= this
|
||||||
|
|
||||||
return overriddenFunctions
|
return overriddenFunctions
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -262,6 +262,14 @@ fun FirTypeScope.getDirectOverriddenFunctions(
|
|||||||
ProcessorAction.NEXT
|
ProcessorAction.NEXT
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* The original symbol may appear in `processOverriddenFunctions`, so it should be removed from the resulting
|
||||||
|
* list to not confuse the caller with a situation when the function directly overrides itself
|
||||||
|
*
|
||||||
|
* For details see FirTypeScope.processDirectOverriddenFunctionsWithBaseScope
|
||||||
|
*/
|
||||||
|
overriddenFunctions -= function
|
||||||
|
|
||||||
return overriddenFunctions.toList()
|
return overriddenFunctions.toList()
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -276,6 +284,11 @@ fun FirTypeScope.getDirectOverriddenProperties(
|
|||||||
ProcessorAction.NEXT
|
ProcessorAction.NEXT
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* See comment in `getDirectOverriddenFunctions` function above
|
||||||
|
*/
|
||||||
|
overriddenProperties -= property
|
||||||
|
|
||||||
return overriddenProperties.toList()
|
return overriddenProperties.toList()
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -295,7 +308,7 @@ fun FirTypeScope.retrieveDirectOverriddenOf(memberSymbol: FirCallableSymbol<*>):
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private inline fun <reified D : FirCallableSymbol<*>> MutableCollection<D>.addOverridden(
|
private inline fun <reified D : FirCallableSymbol<*>> MutableSet<D>.addOverridden(
|
||||||
symbol: D,
|
symbol: D,
|
||||||
unwrapIntersectionAndSubstitutionOverride: Boolean
|
unwrapIntersectionAndSubstitutionOverride: Boolean
|
||||||
) {
|
) {
|
||||||
|
|||||||
+20
-14
@@ -59,23 +59,29 @@ class FirUnstableSmartcastTypeScope(
|
|||||||
return processComposite(FirScope::processPropertiesByName, name, processor)
|
return processComposite(FirScope::processPropertiesByName, name, processor)
|
||||||
}
|
}
|
||||||
|
|
||||||
private inline fun <N, T : FirCallableSymbol<*>> processTypedComposite(
|
private inline fun <S : FirCallableSymbol<*>> processDirectOverriddenWithBaseScope(
|
||||||
process: FirTypeScope.(N, (T, FirTypeScope) -> ProcessorAction) -> ProcessorAction,
|
originalSymbol: S,
|
||||||
name: N,
|
processDirectOverriddenSymbolsWithBaseScope: FirTypeScope.(S, (S, FirTypeScope) -> ProcessorAction) -> ProcessorAction,
|
||||||
noinline processor: (T, FirTypeScope) -> ProcessorAction
|
noinline processor: (S, FirTypeScope) -> ProcessorAction
|
||||||
): ProcessorAction {
|
): ProcessorAction {
|
||||||
val unique = mutableSetOf<T>()
|
val unique = mutableSetOf<S>()
|
||||||
originalScope.process(name) { symbol, firTypeScope ->
|
originalScope.processDirectOverriddenSymbolsWithBaseScope(originalSymbol) { symbol, firTypeScope ->
|
||||||
unique += symbol
|
unique += symbol
|
||||||
processor(symbol, firTypeScope)
|
processor(symbol, firTypeScope)
|
||||||
}.let { if (it == ProcessorAction.STOP) return ProcessorAction.STOP }
|
}.let { if (it == ProcessorAction.STOP) return ProcessorAction.STOP }
|
||||||
|
|
||||||
smartcastScope.process(name) { symbol, firTypeScope ->
|
smartcastScope.processDirectOverriddenSymbolsWithBaseScope(originalSymbol) { symbol, firTypeScope ->
|
||||||
if (symbol !in unique) {
|
when (symbol) {
|
||||||
markSymbolFromUnstableSmartcast(symbol)
|
/**
|
||||||
processor(symbol, firTypeScope)
|
* `processDirectOverriddenSymbolsWithBaseScope` may return the same symbol from underlying scopes,
|
||||||
} else {
|
* so we need to skip them until we found real overridden
|
||||||
ProcessorAction.NEXT
|
*/
|
||||||
|
originalSymbol -> ProcessorAction.NEXT
|
||||||
|
!in unique -> {
|
||||||
|
markSymbolFromUnstableSmartcast(symbol)
|
||||||
|
processor(symbol, firTypeScope)
|
||||||
|
}
|
||||||
|
else -> ProcessorAction.NEXT
|
||||||
}
|
}
|
||||||
}.let { if (it == ProcessorAction.STOP) return ProcessorAction.STOP }
|
}.let { if (it == ProcessorAction.STOP) return ProcessorAction.STOP }
|
||||||
return ProcessorAction.NEXT
|
return ProcessorAction.NEXT
|
||||||
@@ -91,14 +97,14 @@ class FirUnstableSmartcastTypeScope(
|
|||||||
functionSymbol: FirNamedFunctionSymbol,
|
functionSymbol: FirNamedFunctionSymbol,
|
||||||
processor: (FirNamedFunctionSymbol, FirTypeScope) -> ProcessorAction
|
processor: (FirNamedFunctionSymbol, FirTypeScope) -> ProcessorAction
|
||||||
): ProcessorAction {
|
): ProcessorAction {
|
||||||
return processTypedComposite(FirTypeScope::processDirectOverriddenFunctionsWithBaseScope, functionSymbol, processor)
|
return processDirectOverriddenWithBaseScope(functionSymbol, FirTypeScope::processDirectOverriddenFunctionsWithBaseScope, processor)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun processDirectOverriddenPropertiesWithBaseScope(
|
override fun processDirectOverriddenPropertiesWithBaseScope(
|
||||||
propertySymbol: FirPropertySymbol,
|
propertySymbol: FirPropertySymbol,
|
||||||
processor: (FirPropertySymbol, FirTypeScope) -> ProcessorAction
|
processor: (FirPropertySymbol, FirTypeScope) -> ProcessorAction
|
||||||
): ProcessorAction {
|
): ProcessorAction {
|
||||||
return processTypedComposite(FirTypeScope::processDirectOverriddenPropertiesWithBaseScope, propertySymbol, processor)
|
return processDirectOverriddenWithBaseScope(propertySymbol, FirTypeScope::processDirectOverriddenPropertiesWithBaseScope, processor)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun getCallableNames(): Set<Name> {
|
override fun getCallableNames(): Set<Name> {
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
// IGNORE_BACKEND_K2: JVM_IR
|
|
||||||
open class SuperFoo {
|
open class SuperFoo {
|
||||||
public fun bar() {
|
public fun bar() {
|
||||||
if (this is Foo) {
|
if (this is Foo) {
|
||||||
@@ -13,4 +12,4 @@ class Foo : SuperFoo()
|
|||||||
|
|
||||||
// 1 INVOKEVIRTUAL SuperFoo.baz
|
// 1 INVOKEVIRTUAL SuperFoo.baz
|
||||||
// 0 CHECKCAST Foo
|
// 0 CHECKCAST Foo
|
||||||
// 0 INVOKEVIRTUAL Foo.baz
|
// 0 INVOKEVIRTUAL Foo.baz
|
||||||
|
|||||||
@@ -1,65 +0,0 @@
|
|||||||
FILE fqName:<root> fileName:/smartCastInValInitialization.kt
|
|
||||||
CLASS CLASS name:RootBus modality:FINAL visibility:public superTypes:[<root>.MessageBusImpl]
|
|
||||||
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.RootBus
|
|
||||||
CONSTRUCTOR visibility:public <> () returnType:<root>.RootBus [primary]
|
|
||||||
BLOCK_BODY
|
|
||||||
DELEGATING_CONSTRUCTOR_CALL 'public constructor <init> () declared in <root>.MessageBusImpl'
|
|
||||||
INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:RootBus modality:FINAL visibility:public superTypes:[<root>.MessageBusImpl]'
|
|
||||||
PROPERTY FAKE_OVERRIDE name:parentBus visibility:public modality:FINAL [fake_override,val]
|
|
||||||
overridden:
|
|
||||||
public final parentBus: kotlin.Any?
|
|
||||||
FUN FAKE_OVERRIDE name:<get-parentBus> visibility:public modality:FINAL <> ($this:<root>.MessageBusImpl) returnType:kotlin.Any? [fake_override]
|
|
||||||
correspondingProperty: PROPERTY FAKE_OVERRIDE name:parentBus visibility:public modality:FINAL [fake_override,val]
|
|
||||||
overridden:
|
|
||||||
public final fun <get-parentBus> (): kotlin.Any? declared in <root>.MessageBusImpl
|
|
||||||
$this: VALUE_PARAMETER name:<this> type:<root>.MessageBusImpl
|
|
||||||
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>.MessageBusImpl
|
|
||||||
$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>.MessageBusImpl
|
|
||||||
$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>.MessageBusImpl
|
|
||||||
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
|
|
||||||
CLASS CLASS name:MessageBusImpl modality:OPEN visibility:public superTypes:[kotlin.Any]
|
|
||||||
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.MessageBusImpl
|
|
||||||
CONSTRUCTOR visibility:public <> () returnType:<root>.MessageBusImpl [primary]
|
|
||||||
BLOCK_BODY
|
|
||||||
DELEGATING_CONSTRUCTOR_CALL 'public constructor <init> () declared in kotlin.Any'
|
|
||||||
INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:MessageBusImpl modality:OPEN visibility:public superTypes:[kotlin.Any]'
|
|
||||||
PROPERTY name:parentBus visibility:public modality:FINAL [val]
|
|
||||||
FIELD PROPERTY_BACKING_FIELD name:parentBus type:kotlin.Any? visibility:private [final]
|
|
||||||
FUN DEFAULT_PROPERTY_ACCESSOR name:<get-parentBus> visibility:public modality:FINAL <> ($this:<root>.MessageBusImpl) returnType:kotlin.Any?
|
|
||||||
correspondingProperty: PROPERTY name:parentBus visibility:public modality:FINAL [val]
|
|
||||||
$this: VALUE_PARAMETER name:<this> type:<root>.MessageBusImpl
|
|
||||||
BLOCK_BODY
|
|
||||||
RETURN type=kotlin.Nothing from='public final fun <get-parentBus> (): kotlin.Any? declared in <root>.MessageBusImpl'
|
|
||||||
GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:parentBus type:kotlin.Any? visibility:private [final]' type=kotlin.Any? origin=null
|
|
||||||
receiver: GET_VAR '<this>: <root>.MessageBusImpl declared in <root>.MessageBusImpl.<get-parentBus>' type=<root>.MessageBusImpl origin=null
|
|
||||||
ANONYMOUS_INITIALIZER isStatic=false
|
|
||||||
BLOCK_BODY
|
|
||||||
TYPE_OP type=kotlin.Unit origin=IMPLICIT_COERCION_TO_UNIT typeOperand=kotlin.Unit
|
|
||||||
TYPE_OP type=<root>.RootBus origin=CAST typeOperand=<root>.RootBus
|
|
||||||
GET_VAR '<this>: <root>.MessageBusImpl declared in <root>.MessageBusImpl' type=<root>.MessageBusImpl origin=null
|
|
||||||
SET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:parentBus type:kotlin.Any? visibility:private [final]' type=kotlin.Unit origin=null
|
|
||||||
receiver: TYPE_OP type=<root>.RootBus origin=IMPLICIT_CAST typeOperand=<root>.RootBus
|
|
||||||
GET_VAR '<this>: <root>.MessageBusImpl declared in <root>.MessageBusImpl' type=<root>.MessageBusImpl origin=null
|
|
||||||
value: CONST Null type=kotlin.Nothing? value=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 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
|
|
||||||
@@ -1,25 +0,0 @@
|
|||||||
class RootBus : MessageBusImpl {
|
|
||||||
constructor() /* primary */ {
|
|
||||||
super/*MessageBusImpl*/()
|
|
||||||
/* <init>() */
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
open class MessageBusImpl {
|
|
||||||
constructor() /* primary */ {
|
|
||||||
super/*Any*/()
|
|
||||||
/* <init>() */
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
val parentBus: Any?
|
|
||||||
get
|
|
||||||
|
|
||||||
init {
|
|
||||||
<this> as RootBus /*~> Unit */
|
|
||||||
<this> /*as RootBus */.#parentBus = null
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,3 +1,4 @@
|
|||||||
|
// FIR_IDENTICAL
|
||||||
class RootBus: MessageBusImpl()
|
class RootBus: MessageBusImpl()
|
||||||
|
|
||||||
open class MessageBusImpl {
|
open class MessageBusImpl {
|
||||||
|
|||||||
@@ -1,76 +0,0 @@
|
|||||||
FILE fqName:<root> fileName:/smartCastAside.kt
|
|
||||||
CLASS INTERFACE name:A modality:ABSTRACT visibility:public superTypes:[kotlin.Any]
|
|
||||||
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.A
|
|
||||||
FUN name:foo visibility:public modality:ABSTRACT <> ($this:<root>.A) returnType:kotlin.Unit
|
|
||||||
$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:[<root>.A]
|
|
||||||
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.B
|
|
||||||
FUN name:bar visibility:public modality:ABSTRACT <> ($this:<root>.B) returnType:kotlin.Unit
|
|
||||||
$this: VALUE_PARAMETER name:<this> type:<root>.B
|
|
||||||
FUN FAKE_OVERRIDE name:foo visibility:public modality:ABSTRACT <> ($this:<root>.A) returnType:kotlin.Unit [fake_override]
|
|
||||||
overridden:
|
|
||||||
public abstract fun foo (): kotlin.Unit declared in <root>.A
|
|
||||||
$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 <root>.A
|
|
||||||
$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
|
|
||||||
$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
|
|
||||||
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
|
|
||||||
CLASS INTERFACE name:C modality:ABSTRACT visibility:public superTypes:[<root>.A]
|
|
||||||
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.C
|
|
||||||
FUN name:baz visibility:public modality:ABSTRACT <> ($this:<root>.C) returnType:kotlin.Unit
|
|
||||||
$this: VALUE_PARAMETER name:<this> type:<root>.C
|
|
||||||
FUN FAKE_OVERRIDE name:foo visibility:public modality:ABSTRACT <> ($this:<root>.A) returnType:kotlin.Unit [fake_override]
|
|
||||||
overridden:
|
|
||||||
public abstract fun foo (): kotlin.Unit declared in <root>.A
|
|
||||||
$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 <root>.A
|
|
||||||
$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
|
|
||||||
$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
|
|
||||||
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
|
|
||||||
FUN name:test visibility:public modality:FINAL <> (param:<root>.B) returnType:kotlin.Unit
|
|
||||||
VALUE_PARAMETER name:param index:0 type:<root>.B
|
|
||||||
BLOCK_BODY
|
|
||||||
WHEN type=kotlin.Unit origin=IF
|
|
||||||
BRANCH
|
|
||||||
if: TYPE_OP type=kotlin.Boolean origin=INSTANCEOF typeOperand=<root>.C
|
|
||||||
GET_VAR 'param: <root>.B declared in <root>.test' type=<root>.B origin=null
|
|
||||||
then: BLOCK type=kotlin.Unit origin=null
|
|
||||||
CALL 'public abstract fun foo (): kotlin.Unit declared in <root>.A' type=kotlin.Unit origin=null
|
|
||||||
$this: TYPE_OP type=<root>.C origin=IMPLICIT_CAST typeOperand=<root>.C
|
|
||||||
GET_VAR 'param: <root>.B declared in <root>.test' type=<root>.B origin=null
|
|
||||||
CALL 'public abstract fun bar (): kotlin.Unit declared in <root>.B' type=kotlin.Unit origin=null
|
|
||||||
$this: GET_VAR 'param: <root>.B declared in <root>.test' type=<root>.B origin=null
|
|
||||||
CALL 'public abstract fun baz (): kotlin.Unit declared in <root>.C' type=kotlin.Unit origin=null
|
|
||||||
$this: TYPE_OP type=<root>.C origin=IMPLICIT_CAST typeOperand=<root>.C
|
|
||||||
GET_VAR 'param: <root>.B declared in <root>.test' type=<root>.B origin=null
|
|
||||||
@@ -1,24 +0,0 @@
|
|||||||
interface A {
|
|
||||||
abstract fun foo()
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
interface B : A {
|
|
||||||
abstract fun bar()
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
interface C : A {
|
|
||||||
abstract fun baz()
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
fun test(param: B) {
|
|
||||||
when {
|
|
||||||
param is C -> { // BLOCK
|
|
||||||
param /*as C */.foo()
|
|
||||||
param.bar()
|
|
||||||
param /*as C */.baz()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,3 +1,4 @@
|
|||||||
|
// FIR_IDENTICAL
|
||||||
interface A {
|
interface A {
|
||||||
fun foo()
|
fun foo()
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user