diff --git a/compiler/fir/fir2ir/tests/org/jetbrains/kotlin/fir/Fir2IrTextTestGenerated.java b/compiler/fir/fir2ir/tests/org/jetbrains/kotlin/fir/Fir2IrTextTestGenerated.java index 5083f864fde..d063e15a6b1 100644 --- a/compiler/fir/fir2ir/tests/org/jetbrains/kotlin/fir/Fir2IrTextTestGenerated.java +++ b/compiler/fir/fir2ir/tests/org/jetbrains/kotlin/fir/Fir2IrTextTestGenerated.java @@ -1762,6 +1762,11 @@ public class Fir2IrTextTestGenerated extends AbstractFir2IrTextTest { runTest("compiler/testData/ir/irText/firProblems/DeepCopyIrTree.kt"); } + @TestMetadata("DelegationAndInheritanceFromJava.kt") + public void testDelegationAndInheritanceFromJava() throws Exception { + runTest("compiler/testData/ir/irText/firProblems/DelegationAndInheritanceFromJava.kt"); + } + @TestMetadata("deprecated.kt") public void testDeprecated() throws Exception { runTest("compiler/testData/ir/irText/firProblems/deprecated.kt"); diff --git a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/SupertypeUtils.kt b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/SupertypeUtils.kt index 4ef186f110e..50098901189 100644 --- a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/SupertypeUtils.kt +++ b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/SupertypeUtils.kt @@ -16,6 +16,7 @@ import org.jetbrains.kotlin.fir.scopes.impl.FirClassSubstitutionScope import org.jetbrains.kotlin.fir.symbols.impl.* import org.jetbrains.kotlin.fir.typeContext import org.jetbrains.kotlin.fir.types.* +import org.jetbrains.kotlin.name.ClassId import org.jetbrains.kotlin.types.model.CaptureStatus abstract class SupertypeSupplier { @@ -59,7 +60,11 @@ inline fun scopeSessionKey(): ScopeSes val USE_SITE = scopeSessionKey, FirTypeScope>() -data class SubstitutionScopeKey(val type: ConeClassLikeType) : ScopeSessionKey, FirClassSubstitutionScope>() +data class SubstitutionScopeKey( + val type: ConeClassLikeType, + // This property is necessary. Otherwise we may have accidental matching when two classes have the same supertype + val derivedClassId: ClassId +) : ScopeSessionKey, FirClassSubstitutionScope>() /* TODO REMOVE */ fun createSubstitution( @@ -93,7 +98,7 @@ fun ConeClassLikeType.wrapSubstitutionScopeIfNeed( derivedClass: FirRegularClass ): FirTypeScope { if (this.typeArguments.isEmpty()) return useSiteMemberScope - return builder.getOrBuild(declaration.symbol, SubstitutionScopeKey(this)) { + return builder.getOrBuild(declaration.symbol, SubstitutionScopeKey(this, derivedClass.symbol.classId)) { val typeParameters = (declaration as? FirTypeParameterRefsOwner)?.typeParameters.orEmpty() val originalSubstitution = createSubstitution(typeParameters, this, session) val platformClass = session.platformClassMapper.getCorrespondingPlatformClass(declaration) diff --git a/compiler/testData/ir/irText/firProblems/DelegationAndInheritanceFromJava.fir.txt b/compiler/testData/ir/irText/firProblems/DelegationAndInheritanceFromJava.fir.txt new file mode 100644 index 00000000000..62dfe155ea2 --- /dev/null +++ b/compiler/testData/ir/irText/firProblems/DelegationAndInheritanceFromJava.fir.txt @@ -0,0 +1,171 @@ +FILE fqName: fileName:/DelegationAndInheritanceFromJava.kt + CLASS CLASS name:Impl modality:FINAL visibility:public superTypes:[.Foo.A; .Foo.B] + $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.Impl + CONSTRUCTOR visibility:public <> (b:.Foo.B) returnType:.Impl [primary] + VALUE_PARAMETER name:b index:0 type:.Foo.B + BLOCK_BODY + DELEGATING_CONSTRUCTOR_CALL 'public constructor () [primary] declared in kotlin.Any' + INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:Impl modality:FINAL visibility:public superTypes:[.Foo.A; .Foo.B]' + SET_FIELD 'FIELD DELEGATE name:<$$delegate_0> type:.Foo.B visibility:local [final]' type=kotlin.Unit origin=EQ + receiver: GET_VAR ': .Impl declared in .Impl' type=.Impl origin=null + value: GET_VAR 'b: .Foo.B declared in .Impl.' type=.Foo.B origin=null + FUN DELEGATED_MEMBER name:add visibility:public modality:OPEN <> ($this:.Impl, element:kotlin.String?) returnType:kotlin.Boolean + overridden: + public abstract fun add (element: E of kotlin.collections.MutableSet): kotlin.Boolean declared in kotlin.collections.MutableSet + public abstract fun add (element: kotlin.String?): kotlin.Boolean [fake_override] declared in .Foo.B + $this: VALUE_PARAMETER name: type:.Impl + VALUE_PARAMETER name:element index:0 type:kotlin.String? + BLOCK_BODY + RETURN type=kotlin.Nothing from='public open fun add (element: kotlin.String?): kotlin.Boolean declared in .Impl' + CALL 'public abstract fun add (element: kotlin.String?): kotlin.Boolean [fake_override] declared in .Foo.B' type=kotlin.Boolean origin=null + $this: GET_FIELD 'FIELD DELEGATE name:<$$delegate_0> type:.Foo.B visibility:local [final]' type=.Foo.B origin=null + receiver: GET_VAR ': .Impl declared in .Impl.add' type=.Impl origin=null + element: GET_VAR 'element: kotlin.String? declared in .Impl.add' type=kotlin.String? origin=null + FUN DELEGATED_MEMBER name:addAll visibility:public modality:OPEN <> ($this:.Impl, elements:kotlin.collections.Collection) returnType:kotlin.Boolean + overridden: + public abstract fun addAll (elements: kotlin.collections.Collection): kotlin.Boolean declared in kotlin.collections.MutableSet + public abstract fun addAll (elements: kotlin.collections.Collection): kotlin.Boolean [fake_override] declared in .Foo.B + $this: VALUE_PARAMETER name: type:.Impl + VALUE_PARAMETER name:elements index:0 type:kotlin.collections.Collection + BLOCK_BODY + RETURN type=kotlin.Nothing from='public open fun addAll (elements: kotlin.collections.Collection): kotlin.Boolean declared in .Impl' + CALL 'public abstract fun addAll (elements: kotlin.collections.Collection): kotlin.Boolean [fake_override] declared in .Foo.B' type=kotlin.Boolean origin=null + $this: GET_FIELD 'FIELD DELEGATE name:<$$delegate_0> type:.Foo.B visibility:local [final]' type=.Foo.B origin=null + receiver: GET_VAR ': .Impl declared in .Impl.addAll' type=.Impl origin=null + elements: GET_VAR 'elements: kotlin.collections.Collection declared in .Impl.addAll' type=kotlin.collections.Collection origin=null + FUN DELEGATED_MEMBER name:clear visibility:public modality:OPEN <> ($this:.Impl) returnType:kotlin.Unit + overridden: + public abstract fun clear (): kotlin.Unit declared in kotlin.collections.MutableSet + $this: VALUE_PARAMETER name: type:.Impl + BLOCK_BODY + CALL 'public abstract fun clear (): kotlin.Unit declared in kotlin.collections.MutableSet' type=kotlin.Unit origin=null + $this: GET_FIELD 'FIELD DELEGATE name:<$$delegate_0> type:.Foo.B visibility:local [final]' type=.Foo.B origin=null + receiver: GET_VAR ': .Impl declared in .Impl.clear' type=.Impl origin=null + FUN DELEGATED_MEMBER name:iterator visibility:public modality:OPEN <> ($this:.Impl) returnType:kotlin.collections.MutableIterator [operator] + overridden: + public abstract fun iterator (): kotlin.collections.MutableIterator [operator] declared in kotlin.collections.MutableSet + public abstract fun iterator (): kotlin.collections.MutableIterator [fake_override,operator] declared in .Foo.B + $this: VALUE_PARAMETER name: type:.Impl + BLOCK_BODY + RETURN type=kotlin.Nothing from='public open fun iterator (): kotlin.collections.MutableIterator [operator] declared in .Impl' + CALL 'public abstract fun iterator (): kotlin.collections.MutableIterator [fake_override,operator] declared in .Foo.B' type=kotlin.collections.MutableIterator origin=null + $this: GET_FIELD 'FIELD DELEGATE name:<$$delegate_0> type:.Foo.B visibility:local [final]' type=.Foo.B origin=null + receiver: GET_VAR ': .Impl declared in .Impl.iterator' type=.Impl origin=null + FUN DELEGATED_MEMBER name:remove visibility:public modality:OPEN <> ($this:.Impl, element:kotlin.String?) returnType:kotlin.Boolean + overridden: + public abstract fun remove (element: E of kotlin.collections.MutableSet): kotlin.Boolean declared in kotlin.collections.MutableSet + public abstract fun remove (element: kotlin.String?): kotlin.Boolean [fake_override] declared in .Foo.B + $this: VALUE_PARAMETER name: type:.Impl + VALUE_PARAMETER name:element index:0 type:kotlin.String? + BLOCK_BODY + RETURN type=kotlin.Nothing from='public open fun remove (element: kotlin.String?): kotlin.Boolean declared in .Impl' + CALL 'public abstract fun remove (element: kotlin.String?): kotlin.Boolean [fake_override] declared in .Foo.B' type=kotlin.Boolean origin=null + $this: GET_FIELD 'FIELD DELEGATE name:<$$delegate_0> type:.Foo.B visibility:local [final]' type=.Foo.B origin=null + receiver: GET_VAR ': .Impl declared in .Impl.remove' type=.Impl origin=null + element: GET_VAR 'element: kotlin.String? declared in .Impl.remove' type=kotlin.String? origin=null + FUN DELEGATED_MEMBER name:removeAll visibility:public modality:OPEN <> ($this:.Impl, elements:kotlin.collections.Collection) returnType:kotlin.Boolean + overridden: + public abstract fun removeAll (elements: kotlin.collections.Collection): kotlin.Boolean declared in kotlin.collections.MutableSet + public abstract fun removeAll (elements: kotlin.collections.Collection): kotlin.Boolean [fake_override] declared in .Foo.B + $this: VALUE_PARAMETER name: type:.Impl + VALUE_PARAMETER name:elements index:0 type:kotlin.collections.Collection + BLOCK_BODY + RETURN type=kotlin.Nothing from='public open fun removeAll (elements: kotlin.collections.Collection): kotlin.Boolean declared in .Impl' + CALL 'public abstract fun removeAll (elements: kotlin.collections.Collection): kotlin.Boolean [fake_override] declared in .Foo.B' type=kotlin.Boolean origin=null + $this: GET_FIELD 'FIELD DELEGATE name:<$$delegate_0> type:.Foo.B visibility:local [final]' type=.Foo.B origin=null + receiver: GET_VAR ': .Impl declared in .Impl.removeAll' type=.Impl origin=null + elements: GET_VAR 'elements: kotlin.collections.Collection declared in .Impl.removeAll' type=kotlin.collections.Collection origin=null + FUN DELEGATED_MEMBER name:retainAll visibility:public modality:OPEN <> ($this:.Impl, elements:kotlin.collections.Collection) returnType:kotlin.Boolean + overridden: + public abstract fun retainAll (elements: kotlin.collections.Collection): kotlin.Boolean declared in kotlin.collections.MutableSet + public abstract fun retainAll (elements: kotlin.collections.Collection): kotlin.Boolean [fake_override] declared in .Foo.B + $this: VALUE_PARAMETER name: type:.Impl + VALUE_PARAMETER name:elements index:0 type:kotlin.collections.Collection + BLOCK_BODY + RETURN type=kotlin.Nothing from='public open fun retainAll (elements: kotlin.collections.Collection): kotlin.Boolean declared in .Impl' + CALL 'public abstract fun retainAll (elements: kotlin.collections.Collection): kotlin.Boolean [fake_override] declared in .Foo.B' type=kotlin.Boolean origin=null + $this: GET_FIELD 'FIELD DELEGATE name:<$$delegate_0> type:.Foo.B visibility:local [final]' type=.Foo.B origin=null + receiver: GET_VAR ': .Impl declared in .Impl.retainAll' type=.Impl origin=null + elements: GET_VAR 'elements: kotlin.collections.Collection declared in .Impl.retainAll' type=kotlin.collections.Collection origin=null + FUN DELEGATED_MEMBER name:contains visibility:public modality:OPEN <> ($this:.Impl, element:kotlin.String?) returnType:kotlin.Boolean [operator] + overridden: + public abstract fun contains (element: E of kotlin.collections.Set): kotlin.Boolean [operator] declared in kotlin.collections.Set + public abstract fun contains (element: kotlin.String?): kotlin.Boolean [fake_override,operator] declared in .Foo.B + $this: VALUE_PARAMETER name: type:.Impl + VALUE_PARAMETER name:element index:0 type:kotlin.String? + BLOCK_BODY + RETURN type=kotlin.Nothing from='public open fun contains (element: kotlin.String?): kotlin.Boolean [operator] declared in .Impl' + CALL 'public abstract fun contains (element: kotlin.String?): kotlin.Boolean [fake_override,operator] declared in .Foo.B' type=kotlin.Boolean origin=null + $this: GET_FIELD 'FIELD DELEGATE name:<$$delegate_0> type:.Foo.B visibility:local [final]' type=.Foo.B origin=null + receiver: GET_VAR ': .Impl declared in .Impl.contains' type=.Impl origin=null + element: GET_VAR 'element: kotlin.String? declared in .Impl.contains' type=kotlin.String? origin=null + FUN DELEGATED_MEMBER name:containsAll visibility:public modality:OPEN <> ($this:.Impl, elements:kotlin.collections.Collection) returnType:kotlin.Boolean + overridden: + public abstract fun containsAll (elements: kotlin.collections.Collection): kotlin.Boolean [fake_override] declared in kotlin.collections.MutableSet + public abstract fun containsAll (elements: kotlin.collections.Collection): kotlin.Boolean [fake_override] declared in .Foo.B + $this: VALUE_PARAMETER name: type:.Impl + VALUE_PARAMETER name:elements index:0 type:kotlin.collections.Collection + BLOCK_BODY + RETURN type=kotlin.Nothing from='public open fun containsAll (elements: kotlin.collections.Collection): kotlin.Boolean declared in .Impl' + CALL 'public abstract fun containsAll (elements: kotlin.collections.Collection): kotlin.Boolean [fake_override] declared in .Foo.B' type=kotlin.Boolean origin=null + $this: GET_FIELD 'FIELD DELEGATE name:<$$delegate_0> type:.Foo.B visibility:local [final]' type=.Foo.B origin=null + receiver: GET_VAR ': .Impl declared in .Impl.containsAll' type=.Impl origin=null + elements: GET_VAR 'elements: kotlin.collections.Collection declared in .Impl.containsAll' type=kotlin.collections.Collection origin=null + FUN DELEGATED_MEMBER name:isEmpty visibility:public modality:OPEN <> ($this:.Impl) returnType:kotlin.Boolean + overridden: + public abstract fun isEmpty (): kotlin.Boolean declared in kotlin.collections.Set + public abstract fun isEmpty (): kotlin.Boolean [fake_override] declared in kotlin.collections.MutableSet + $this: VALUE_PARAMETER name: type:.Impl + BLOCK_BODY + RETURN type=kotlin.Nothing from='public open fun isEmpty (): kotlin.Boolean declared in .Impl' + CALL 'public abstract fun isEmpty (): kotlin.Boolean [fake_override] declared in kotlin.collections.MutableSet' type=kotlin.Boolean origin=null + $this: GET_FIELD 'FIELD DELEGATE name:<$$delegate_0> type:.Foo.B visibility:local [final]' type=.Foo.B origin=null + receiver: GET_VAR ': .Impl declared in .Impl.isEmpty' type=.Impl origin=null + FUN DELEGATED_MEMBER name:equals visibility:public modality:OPEN <> ($this:.Impl, other:kotlin.Any?) returnType:kotlin.Boolean [operator] + overridden: + public open fun equals (other: kotlin.Any?): kotlin.Boolean [operator] declared in kotlin.Any + public open fun equals (other: kotlin.Any?): kotlin.Boolean [fake_override,operator] declared in kotlin.collections.MutableSet + $this: VALUE_PARAMETER name: type:.Impl + VALUE_PARAMETER name:other index:0 type:kotlin.Any? + BLOCK_BODY + RETURN type=kotlin.Nothing from='public open fun equals (other: kotlin.Any?): kotlin.Boolean [operator] declared in .Impl' + CALL 'public open fun equals (other: kotlin.Any?): kotlin.Boolean [fake_override,operator] declared in kotlin.collections.MutableSet' type=kotlin.Boolean origin=null + $this: GET_FIELD 'FIELD DELEGATE name:<$$delegate_0> type:.Foo.B visibility:local [final]' type=.Foo.B origin=null + receiver: GET_VAR ': .Impl declared in .Impl.equals' type=.Impl origin=null + other: GET_VAR 'other: kotlin.Any? declared in .Impl.equals' type=kotlin.Any? origin=null + FUN DELEGATED_MEMBER name:hashCode visibility:public modality:OPEN <> ($this:.Impl) returnType:kotlin.Int + overridden: + public open fun hashCode (): kotlin.Int declared in kotlin.Any + public open fun hashCode (): kotlin.Int [fake_override] declared in kotlin.collections.MutableSet + $this: VALUE_PARAMETER name: type:.Impl + BLOCK_BODY + RETURN type=kotlin.Nothing from='public open fun hashCode (): kotlin.Int declared in .Impl' + CALL 'public open fun hashCode (): kotlin.Int [fake_override] declared in kotlin.collections.MutableSet' type=kotlin.Int origin=null + $this: GET_FIELD 'FIELD DELEGATE name:<$$delegate_0> type:.Foo.B visibility:local [final]' type=.Foo.B origin=null + receiver: GET_VAR ': .Impl declared in .Impl.hashCode' type=.Impl origin=null + FUN DELEGATED_MEMBER name:toString visibility:public modality:OPEN <> ($this:.Impl) returnType:kotlin.String + overridden: + public open fun toString (): kotlin.String declared in kotlin.Any + public open fun toString (): kotlin.String [fake_override] declared in kotlin.collections.MutableSet + $this: VALUE_PARAMETER name: type:.Impl + BLOCK_BODY + RETURN type=kotlin.Nothing from='public open fun toString (): kotlin.String declared in .Impl' + CALL 'public open fun toString (): kotlin.String [fake_override] declared in kotlin.collections.MutableSet' type=kotlin.String origin=null + $this: GET_FIELD 'FIELD DELEGATE name:<$$delegate_0> type:.Foo.B visibility:local [final]' type=.Foo.B origin=null + receiver: GET_VAR ': .Impl declared in .Impl.toString' type=.Impl origin=null + PROPERTY DELEGATED_MEMBER name:size visibility:public modality:OPEN [val] + FUN DELEGATED_MEMBER name: visibility:public modality:OPEN <> ($this:.Impl) returnType:kotlin.Int + correspondingProperty: PROPERTY DELEGATED_MEMBER name:size visibility:public modality:OPEN [val] + overridden: + public abstract fun (): kotlin.Int declared in kotlin.collections.Set + $this: VALUE_PARAMETER name: type:.Impl + BLOCK_BODY + RETURN type=kotlin.Nothing from='public open fun (): kotlin.Int declared in .Impl' + CALL 'public abstract fun (): kotlin.Int declared in kotlin.collections.Set' type=kotlin.Int origin=null + $this: GET_FIELD 'FIELD DELEGATE name:<$$delegate_0> type:.Foo.B visibility:local [final]' type=.Foo.B origin=null + receiver: GET_VAR ': .Impl declared in .Impl.' type=.Impl origin=null + FIELD DELEGATE name:<$$delegate_0> type:.Foo.B visibility:local [final] + FUN name:box visibility:public modality:FINAL <> () returnType:kotlin.String + BLOCK_BODY + RETURN type=kotlin.Nothing from='public final fun box (): kotlin.String declared in ' + CONST String type=kotlin.String value="OK" diff --git a/compiler/testData/ir/irText/firProblems/DelegationAndInheritanceFromJava.kt b/compiler/testData/ir/irText/firProblems/DelegationAndInheritanceFromJava.kt new file mode 100644 index 00000000000..a7fb7c1c24f --- /dev/null +++ b/compiler/testData/ir/irText/firProblems/DelegationAndInheritanceFromJava.kt @@ -0,0 +1,18 @@ +// FILE: Foo.java + +import java.util.Set; + +public class Foo { + public interface A extends Set {} + + public interface B extends Set {} +} + +// FILE: DelegationAndInheritanceFromJava.kt + +import Foo.* +import java.util.HashSet + +class Impl(b: B): A, B by b + +fun box() = "OK" diff --git a/compiler/testData/ir/irText/firProblems/DelegationAndInheritanceFromJava.txt b/compiler/testData/ir/irText/firProblems/DelegationAndInheritanceFromJava.txt new file mode 100644 index 00000000000..fd4b1eee2d3 --- /dev/null +++ b/compiler/testData/ir/irText/firProblems/DelegationAndInheritanceFromJava.txt @@ -0,0 +1,156 @@ +FILE fqName: fileName:/DelegationAndInheritanceFromJava.kt + CLASS CLASS name:Impl modality:FINAL visibility:public superTypes:[.Foo.A; .Foo.B] + $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.Impl + CONSTRUCTOR visibility:public <> (b:.Foo.B) returnType:.Impl [primary] + VALUE_PARAMETER name:b index:0 type:.Foo.B + BLOCK_BODY + DELEGATING_CONSTRUCTOR_CALL 'public constructor () [primary] declared in kotlin.Any' + INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:Impl modality:FINAL visibility:public superTypes:[.Foo.A; .Foo.B]' + FIELD DELEGATE name:$$delegate_0 type:.Foo.B visibility:private [final] + EXPRESSION_BODY + GET_VAR 'b: .Foo.B declared in .Impl.' type=.Foo.B origin=null + FUN DELEGATED_MEMBER name:add visibility:public modality:OPEN <> ($this:.Impl, element:@[FlexibleNullability] kotlin.String?) returnType:kotlin.Boolean + overridden: + public abstract fun add (element: @[FlexibleNullability] kotlin.String?): kotlin.Boolean [fake_override] declared in .Foo.A + public abstract fun add (element: @[FlexibleNullability] kotlin.String?): kotlin.Boolean [fake_override] declared in .Foo.B + $this: VALUE_PARAMETER name: type:.Impl + VALUE_PARAMETER name:element index:0 type:@[FlexibleNullability] kotlin.String? + BLOCK_BODY + RETURN type=kotlin.Nothing from='public open fun add (element: @[FlexibleNullability] kotlin.String?): kotlin.Boolean declared in .Impl' + CALL 'public abstract fun add (element: @[FlexibleNullability] kotlin.String?): kotlin.Boolean [fake_override] declared in .Foo.B' type=kotlin.Boolean origin=null + $this: GET_FIELD 'FIELD DELEGATE name:$$delegate_0 type:.Foo.B visibility:private [final]' type=.Foo.B origin=null + receiver: GET_VAR ': .Impl declared in .Impl.add' type=.Impl origin=null + element: GET_VAR 'element: @[FlexibleNullability] kotlin.String? declared in .Impl.add' type=@[FlexibleNullability] kotlin.String? origin=null + FUN DELEGATED_MEMBER name:addAll visibility:public modality:OPEN <> ($this:.Impl, elements:kotlin.collections.Collection<@[FlexibleNullability] kotlin.String?>) returnType:kotlin.Boolean + overridden: + public abstract fun addAll (elements: kotlin.collections.Collection<@[FlexibleNullability] kotlin.String?>): kotlin.Boolean [fake_override] declared in .Foo.A + public abstract fun addAll (elements: kotlin.collections.Collection<@[FlexibleNullability] kotlin.String?>): kotlin.Boolean [fake_override] declared in .Foo.B + $this: VALUE_PARAMETER name: type:.Impl + VALUE_PARAMETER name:elements index:0 type:kotlin.collections.Collection<@[FlexibleNullability] kotlin.String?> + BLOCK_BODY + RETURN type=kotlin.Nothing from='public open fun addAll (elements: kotlin.collections.Collection<@[FlexibleNullability] kotlin.String?>): kotlin.Boolean declared in .Impl' + CALL 'public abstract fun addAll (elements: kotlin.collections.Collection<@[FlexibleNullability] kotlin.String?>): kotlin.Boolean [fake_override] declared in .Foo.B' type=kotlin.Boolean origin=null + $this: GET_FIELD 'FIELD DELEGATE name:$$delegate_0 type:.Foo.B visibility:private [final]' type=.Foo.B origin=null + receiver: GET_VAR ': .Impl declared in .Impl.addAll' type=.Impl origin=null + elements: GET_VAR 'elements: kotlin.collections.Collection<@[FlexibleNullability] kotlin.String?> declared in .Impl.addAll' type=kotlin.collections.Collection<@[FlexibleNullability] kotlin.String?> origin=null + FUN DELEGATED_MEMBER name:clear visibility:public modality:OPEN <> ($this:.Impl) returnType:kotlin.Unit + overridden: + public abstract fun clear (): kotlin.Unit [fake_override] declared in .Foo.A + public abstract fun clear (): kotlin.Unit [fake_override] declared in .Foo.B + $this: VALUE_PARAMETER name: type:.Impl + BLOCK_BODY + CALL 'public abstract fun clear (): kotlin.Unit [fake_override] declared in .Foo.B' type=kotlin.Unit origin=null + $this: GET_FIELD 'FIELD DELEGATE name:$$delegate_0 type:.Foo.B visibility:private [final]' type=.Foo.B origin=null + receiver: GET_VAR ': .Impl declared in .Impl.clear' type=.Impl origin=null + FUN DELEGATED_MEMBER name:contains visibility:public modality:OPEN <> ($this:.Impl, element:@[FlexibleNullability] kotlin.String?) returnType:kotlin.Boolean [operator] + overridden: + public abstract fun contains (element: @[FlexibleNullability] kotlin.String?): kotlin.Boolean [fake_override,operator] declared in .Foo.A + public abstract fun contains (element: @[FlexibleNullability] kotlin.String?): kotlin.Boolean [fake_override,operator] declared in .Foo.B + $this: VALUE_PARAMETER name: type:.Impl + VALUE_PARAMETER name:element index:0 type:@[FlexibleNullability] kotlin.String? + BLOCK_BODY + RETURN type=kotlin.Nothing from='public open fun contains (element: @[FlexibleNullability] kotlin.String?): kotlin.Boolean [operator] declared in .Impl' + CALL 'public abstract fun contains (element: @[FlexibleNullability] kotlin.String?): kotlin.Boolean [fake_override,operator] declared in .Foo.B' type=kotlin.Boolean origin=null + $this: GET_FIELD 'FIELD DELEGATE name:$$delegate_0 type:.Foo.B visibility:private [final]' type=.Foo.B origin=null + receiver: GET_VAR ': .Impl declared in .Impl.contains' type=.Impl origin=null + element: GET_VAR 'element: @[FlexibleNullability] kotlin.String? declared in .Impl.contains' type=@[FlexibleNullability] kotlin.String? origin=null + FUN DELEGATED_MEMBER name:containsAll visibility:public modality:OPEN <> ($this:.Impl, elements:kotlin.collections.Collection<@[FlexibleNullability] kotlin.String?>) returnType:kotlin.Boolean + overridden: + public abstract fun containsAll (elements: kotlin.collections.Collection<@[FlexibleNullability] kotlin.String?>): kotlin.Boolean [fake_override] declared in .Foo.A + public abstract fun containsAll (elements: kotlin.collections.Collection<@[FlexibleNullability] kotlin.String?>): kotlin.Boolean [fake_override] declared in .Foo.B + $this: VALUE_PARAMETER name: type:.Impl + VALUE_PARAMETER name:elements index:0 type:kotlin.collections.Collection<@[FlexibleNullability] kotlin.String?> + BLOCK_BODY + RETURN type=kotlin.Nothing from='public open fun containsAll (elements: kotlin.collections.Collection<@[FlexibleNullability] kotlin.String?>): kotlin.Boolean declared in .Impl' + CALL 'public abstract fun containsAll (elements: kotlin.collections.Collection<@[FlexibleNullability] kotlin.String?>): kotlin.Boolean [fake_override] declared in .Foo.B' type=kotlin.Boolean origin=null + $this: GET_FIELD 'FIELD DELEGATE name:$$delegate_0 type:.Foo.B visibility:private [final]' type=.Foo.B origin=null + receiver: GET_VAR ': .Impl declared in .Impl.containsAll' type=.Impl origin=null + elements: GET_VAR 'elements: kotlin.collections.Collection<@[FlexibleNullability] kotlin.String?> declared in .Impl.containsAll' type=kotlin.collections.Collection<@[FlexibleNullability] kotlin.String?> origin=null + FUN DELEGATED_MEMBER name:isEmpty visibility:public modality:OPEN <> ($this:.Impl) returnType:kotlin.Boolean + overridden: + public abstract fun isEmpty (): kotlin.Boolean [fake_override] declared in .Foo.A + public abstract fun isEmpty (): kotlin.Boolean [fake_override] declared in .Foo.B + $this: VALUE_PARAMETER name: type:.Impl + BLOCK_BODY + RETURN type=kotlin.Nothing from='public open fun isEmpty (): kotlin.Boolean declared in .Impl' + CALL 'public abstract fun isEmpty (): kotlin.Boolean [fake_override] declared in .Foo.B' type=kotlin.Boolean origin=null + $this: GET_FIELD 'FIELD DELEGATE name:$$delegate_0 type:.Foo.B visibility:private [final]' type=.Foo.B origin=null + receiver: GET_VAR ': .Impl declared in .Impl.isEmpty' type=.Impl origin=null + FUN DELEGATED_MEMBER name:iterator visibility:public modality:OPEN <> ($this:.Impl) returnType:kotlin.collections.MutableIterator<@[FlexibleNullability] kotlin.String?> [operator] + overridden: + public abstract fun iterator (): kotlin.collections.MutableIterator<@[FlexibleNullability] kotlin.String?> [fake_override,operator] declared in .Foo.A + public abstract fun iterator (): kotlin.collections.MutableIterator<@[FlexibleNullability] kotlin.String?> [fake_override,operator] declared in .Foo.B + $this: VALUE_PARAMETER name: type:.Impl + BLOCK_BODY + RETURN type=kotlin.Nothing from='public open fun iterator (): kotlin.collections.MutableIterator<@[FlexibleNullability] kotlin.String?> [operator] declared in .Impl' + CALL 'public abstract fun iterator (): kotlin.collections.MutableIterator<@[FlexibleNullability] kotlin.String?> [fake_override,operator] declared in .Foo.B' type=kotlin.collections.MutableIterator<@[FlexibleNullability] kotlin.String?> origin=null + $this: GET_FIELD 'FIELD DELEGATE name:$$delegate_0 type:.Foo.B visibility:private [final]' type=.Foo.B origin=null + receiver: GET_VAR ': .Impl declared in .Impl.iterator' type=.Impl origin=null + FUN DELEGATED_MEMBER name:remove visibility:public modality:OPEN <> ($this:.Impl, element:@[FlexibleNullability] kotlin.String?) returnType:kotlin.Boolean + overridden: + public abstract fun remove (element: @[FlexibleNullability] kotlin.String?): kotlin.Boolean [fake_override] declared in .Foo.A + public abstract fun remove (element: @[FlexibleNullability] kotlin.String?): kotlin.Boolean [fake_override] declared in .Foo.B + $this: VALUE_PARAMETER name: type:.Impl + VALUE_PARAMETER name:element index:0 type:@[FlexibleNullability] kotlin.String? + BLOCK_BODY + RETURN type=kotlin.Nothing from='public open fun remove (element: @[FlexibleNullability] kotlin.String?): kotlin.Boolean declared in .Impl' + CALL 'public abstract fun remove (element: @[FlexibleNullability] kotlin.String?): kotlin.Boolean [fake_override] declared in .Foo.B' type=kotlin.Boolean origin=null + $this: GET_FIELD 'FIELD DELEGATE name:$$delegate_0 type:.Foo.B visibility:private [final]' type=.Foo.B origin=null + receiver: GET_VAR ': .Impl declared in .Impl.remove' type=.Impl origin=null + element: GET_VAR 'element: @[FlexibleNullability] kotlin.String? declared in .Impl.remove' type=@[FlexibleNullability] kotlin.String? origin=null + FUN DELEGATED_MEMBER name:removeAll visibility:public modality:OPEN <> ($this:.Impl, elements:kotlin.collections.Collection<@[FlexibleNullability] kotlin.String?>) returnType:kotlin.Boolean + overridden: + public abstract fun removeAll (elements: kotlin.collections.Collection<@[FlexibleNullability] kotlin.String?>): kotlin.Boolean [fake_override] declared in .Foo.A + public abstract fun removeAll (elements: kotlin.collections.Collection<@[FlexibleNullability] kotlin.String?>): kotlin.Boolean [fake_override] declared in .Foo.B + $this: VALUE_PARAMETER name: type:.Impl + VALUE_PARAMETER name:elements index:0 type:kotlin.collections.Collection<@[FlexibleNullability] kotlin.String?> + BLOCK_BODY + RETURN type=kotlin.Nothing from='public open fun removeAll (elements: kotlin.collections.Collection<@[FlexibleNullability] kotlin.String?>): kotlin.Boolean declared in .Impl' + CALL 'public abstract fun removeAll (elements: kotlin.collections.Collection<@[FlexibleNullability] kotlin.String?>): kotlin.Boolean [fake_override] declared in .Foo.B' type=kotlin.Boolean origin=null + $this: GET_FIELD 'FIELD DELEGATE name:$$delegate_0 type:.Foo.B visibility:private [final]' type=.Foo.B origin=null + receiver: GET_VAR ': .Impl declared in .Impl.removeAll' type=.Impl origin=null + elements: GET_VAR 'elements: kotlin.collections.Collection<@[FlexibleNullability] kotlin.String?> declared in .Impl.removeAll' type=kotlin.collections.Collection<@[FlexibleNullability] kotlin.String?> origin=null + FUN DELEGATED_MEMBER name:retainAll visibility:public modality:OPEN <> ($this:.Impl, elements:kotlin.collections.Collection<@[FlexibleNullability] kotlin.String?>) returnType:kotlin.Boolean + overridden: + public abstract fun retainAll (elements: kotlin.collections.Collection<@[FlexibleNullability] kotlin.String?>): kotlin.Boolean [fake_override] declared in .Foo.A + public abstract fun retainAll (elements: kotlin.collections.Collection<@[FlexibleNullability] kotlin.String?>): kotlin.Boolean [fake_override] declared in .Foo.B + $this: VALUE_PARAMETER name: type:.Impl + VALUE_PARAMETER name:elements index:0 type:kotlin.collections.Collection<@[FlexibleNullability] kotlin.String?> + BLOCK_BODY + RETURN type=kotlin.Nothing from='public open fun retainAll (elements: kotlin.collections.Collection<@[FlexibleNullability] kotlin.String?>): kotlin.Boolean declared in .Impl' + CALL 'public abstract fun retainAll (elements: kotlin.collections.Collection<@[FlexibleNullability] kotlin.String?>): kotlin.Boolean [fake_override] declared in .Foo.B' type=kotlin.Boolean origin=null + $this: GET_FIELD 'FIELD DELEGATE name:$$delegate_0 type:.Foo.B visibility:private [final]' type=.Foo.B origin=null + receiver: GET_VAR ': .Impl declared in .Impl.retainAll' type=.Impl origin=null + elements: GET_VAR 'elements: kotlin.collections.Collection<@[FlexibleNullability] kotlin.String?> declared in .Impl.retainAll' type=kotlin.collections.Collection<@[FlexibleNullability] kotlin.String?> origin=null + PROPERTY DELEGATED_MEMBER name:size visibility:public modality:OPEN [val] + FUN DELEGATED_MEMBER name: visibility:public modality:OPEN <> ($this:.Impl) returnType:kotlin.Int + correspondingProperty: PROPERTY DELEGATED_MEMBER name:size visibility:public modality:OPEN [val] + overridden: + public abstract fun (): kotlin.Int [fake_override] declared in .Foo.A + public abstract fun (): kotlin.Int [fake_override] declared in .Foo.B + $this: VALUE_PARAMETER name: type:.Impl + BLOCK_BODY + RETURN type=kotlin.Nothing from='public open fun (): kotlin.Int declared in .Impl' + CALL 'public abstract fun (): kotlin.Int [fake_override] declared in .Foo.B' type=kotlin.Int origin=null + $this: GET_FIELD 'FIELD DELEGATE name:$$delegate_0 type:.Foo.B visibility:private [final]' type=.Foo.B origin=null + receiver: GET_VAR ': .Impl declared in .Impl.' type=.Impl 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 [fake_override,operator] declared in .Foo.A + public open fun equals (other: kotlin.Any?): kotlin.Boolean [fake_override,operator] declared in .Foo.B + $this: VALUE_PARAMETER name: 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 [fake_override] declared in .Foo.A + public open fun hashCode (): kotlin.Int [fake_override] declared in .Foo.B + $this: VALUE_PARAMETER name: 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 [fake_override] declared in .Foo.A + public open fun toString (): kotlin.String [fake_override] declared in .Foo.B + $this: VALUE_PARAMETER name: type:kotlin.Any + FUN name:box visibility:public modality:FINAL <> () returnType:kotlin.String + BLOCK_BODY + RETURN type=kotlin.Nothing from='public final fun box (): kotlin.String declared in ' + CONST String type=kotlin.String value="OK" diff --git a/compiler/tests/org/jetbrains/kotlin/ir/IrTextTestCaseGenerated.java b/compiler/tests/org/jetbrains/kotlin/ir/IrTextTestCaseGenerated.java index aa61fda0983..6888e08b8a0 100644 --- a/compiler/tests/org/jetbrains/kotlin/ir/IrTextTestCaseGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/ir/IrTextTestCaseGenerated.java @@ -1761,6 +1761,11 @@ public class IrTextTestCaseGenerated extends AbstractIrTextTestCase { runTest("compiler/testData/ir/irText/firProblems/DeepCopyIrTree.kt"); } + @TestMetadata("DelegationAndInheritanceFromJava.kt") + public void testDelegationAndInheritanceFromJava() throws Exception { + runTest("compiler/testData/ir/irText/firProblems/DelegationAndInheritanceFromJava.kt"); + } + @TestMetadata("deprecated.kt") public void testDeprecated() throws Exception { runTest("compiler/testData/ir/irText/firProblems/deprecated.kt");