[FIR2IR] Lookup for nested classes in scope in Fir2IrLazyClass

^KT-55269 Fixed
This commit is contained in:
Dmitriy Novozhilov
2022-12-05 17:41:15 +02:00
committed by Space Team
parent 866150a2e0
commit a86bc425e5
16 changed files with 335 additions and 10 deletions
@@ -14,6 +14,7 @@ import org.jetbrains.kotlin.fir.dispatchReceiverClassLookupTagOrNull
import org.jetbrains.kotlin.fir.isNewPlaceForBodyGeneration
import org.jetbrains.kotlin.fir.isSubstitutionOrIntersectionOverride
import org.jetbrains.kotlin.fir.scopes.FirContainingNamesAwareScope
import org.jetbrains.kotlin.fir.scopes.processClassifiersByName
import org.jetbrains.kotlin.fir.scopes.unsubstitutedScope
import org.jetbrains.kotlin.fir.symbols.impl.FirNamedFunctionSymbol
import org.jetbrains.kotlin.fir.symbols.impl.FirPropertySymbol
@@ -159,10 +160,13 @@ class Fir2IrLazyClass(
}
}
for (declaration in fir.declarations) {
if (declaration is FirRegularClass && shouldBuildStub(declaration)) {
val nestedSymbol = classifierStorage.getIrClassSymbol(declaration.symbol, forceTopLevelPrivate = isTopLevelPrivate)
result += nestedSymbol.owner
for (name in scope.getClassifierNames()) {
scope.processClassifiersByName(name) {
val declaration = it.fir as? FirRegularClass ?: return@processClassifiersByName
if (declaration.classId.outerClassId == fir.classId && shouldBuildStub(declaration)) {
val nestedSymbol = classifierStorage.getIrClassSymbol(declaration.symbol, forceTopLevelPrivate = isTopLevelPrivate)
result += nestedSymbol.owner
}
}
}
@@ -3006,6 +3006,12 @@ public class Fir2IrTextTestGenerated extends AbstractFir2IrTextTest {
runTest("compiler/testData/ir/irText/stubs/javaNestedClass.kt");
}
@Test
@TestMetadata("javaNestedClassesInHierarchy.kt")
public void testJavaNestedClassesInHierarchy() throws Exception {
runTest("compiler/testData/ir/irText/stubs/javaNestedClassesInHierarchy.kt");
}
@Test
@TestMetadata("javaStaticMethod.kt")
public void testJavaStaticMethod() throws Exception {
@@ -3006,6 +3006,12 @@ public class LightTreeFir2IrTextTestGenerated extends AbstractLightTreeFir2IrTex
runTest("compiler/testData/ir/irText/stubs/javaNestedClass.kt");
}
@Test
@TestMetadata("javaNestedClassesInHierarchy.kt")
public void testJavaNestedClassesInHierarchy() throws Exception {
runTest("compiler/testData/ir/irText/stubs/javaNestedClassesInHierarchy.kt");
}
@Test
@TestMetadata("javaStaticMethod.kt")
public void testJavaStaticMethod() throws Exception {
@@ -3,6 +3,25 @@ CLASS IR_EXTERNAL_JAVA_DECLARATION_STUB CLASS name:J1 modality:OPEN visibility:p
TYPE_PARAMETER name:X1 index:0 variance: superTypes:[@[FlexibleNullability] kotlin.Number?] reified:false
CONSTRUCTOR IR_EXTERNAL_JAVA_DECLARATION_STUB visibility:public <Y1> () returnType:<root>.J1<X1 of <root>.J1>
TYPE_PARAMETER name:Y1 index:1 variance: superTypes:[@[FlexibleNullability] kotlin.CharSequence?] reified:false
CLASS IR_EXTERNAL_JAVA_DECLARATION_STUB CLASS name:J2 modality:OPEN visibility:public [inner] superTypes:[kotlin.Any]
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.J1.J2<X2 of <root>.J1.J2, X1 of <root>.J1>
TYPE_PARAMETER name:X2 index:0 variance: superTypes:[@[FlexibleNullability] kotlin.Number?] reified:false
CONSTRUCTOR IR_EXTERNAL_JAVA_DECLARATION_STUB visibility:public <Y2> ($this:<root>.J1<X1 of <root>.J1>) returnType:<root>.J1.J2<X2 of <root>.J1.J2, X1 of <root>.J1>
TYPE_PARAMETER name:Y2 index:1 variance: superTypes:[@[FlexibleNullability] kotlin.CharSequence?] reified:false
$outer: VALUE_PARAMETER IR_EXTERNAL_JAVA_DECLARATION_STUB name:<this> type:<root>.J1<X1 of <root>.J1>
FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:<root>.J1.J2<X2 of <root>.J1.J2, X1 of <root>.J1>, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator]
overridden:
public open fun equals (other: kotlin.Any?): kotlin.Boolean [operator] declared in kotlin.Any
$this: VALUE_PARAMETER FAKE_OVERRIDE name:<this> type:<root>.J1.J2<X2 of <root>.J1.J2, X1 of <root>.J1>
VALUE_PARAMETER name:other index:0 type:kotlin.Any?
FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:<root>.J1.J2<X2 of <root>.J1.J2, X1 of <root>.J1>) returnType:kotlin.Int [fake_override]
overridden:
public open fun hashCode (): kotlin.Int declared in kotlin.Any
$this: VALUE_PARAMETER FAKE_OVERRIDE name:<this> type:<root>.J1.J2<X2 of <root>.J1.J2, X1 of <root>.J1>
FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:<root>.J1.J2<X2 of <root>.J1.J2, X1 of <root>.J1>) returnType:kotlin.String [fake_override]
overridden:
public open fun toString (): kotlin.String declared in kotlin.Any
$this: VALUE_PARAMETER FAKE_OVERRIDE name:<this> type:<root>.J1.J2<X2 of <root>.J1.J2, X1 of <root>.J1>
FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:<root>.J1<X1 of <root>.J1>, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator]
overridden:
public open fun equals (other: kotlin.Any?): kotlin.Boolean [operator] declared in kotlin.Any
@@ -5,6 +5,28 @@ CLASS IR_EXTERNAL_JAVA_DECLARATION_STUB CLASS name:J1 modality:OPEN visibility:p
CONSTRUCTOR IR_EXTERNAL_JAVA_DECLARATION_STUB visibility:public <X1> (x1:@[FlexibleNullability] X1 of <root>.J1.<init>?) returnType:<root>.J1<T1 of <root>.J1>
TYPE_PARAMETER name:X1 index:1 variance: superTypes:[@[FlexibleNullability] kotlin.Any?] reified:false
VALUE_PARAMETER name:x1 index:0 type:@[FlexibleNullability] X1 of <root>.J1.<init>?
CLASS IR_EXTERNAL_JAVA_DECLARATION_STUB CLASS name:J2 modality:OPEN visibility:public [inner] superTypes:[kotlin.Any]
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.J1.J2<T2 of <root>.J1.J2, T1 of <root>.J1>
TYPE_PARAMETER name:T2 index:0 variance: superTypes:[@[FlexibleNullability] kotlin.Any?] reified:false
CONSTRUCTOR IR_EXTERNAL_JAVA_DECLARATION_STUB visibility:public <> ($this:<root>.J1<T1 of <root>.J1>) returnType:<root>.J1.J2<T2 of <root>.J1.J2, T1 of <root>.J1>
$outer: VALUE_PARAMETER IR_EXTERNAL_JAVA_DECLARATION_STUB name:<this> type:<root>.J1<T1 of <root>.J1>
CONSTRUCTOR IR_EXTERNAL_JAVA_DECLARATION_STUB visibility:public <X2> ($this:<root>.J1<T1 of <root>.J1>, x2:@[FlexibleNullability] X2 of <root>.J1.J2.<init>?) returnType:<root>.J1.J2<T2 of <root>.J1.J2, T1 of <root>.J1>
TYPE_PARAMETER name:X2 index:1 variance: superTypes:[@[FlexibleNullability] kotlin.Any?] reified:false
$outer: VALUE_PARAMETER IR_EXTERNAL_JAVA_DECLARATION_STUB name:<this> type:<root>.J1<T1 of <root>.J1>
VALUE_PARAMETER name:x2 index:0 type:@[FlexibleNullability] X2 of <root>.J1.J2.<init>?
FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:<root>.J1.J2<T2 of <root>.J1.J2, T1 of <root>.J1>, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator]
overridden:
public open fun equals (other: kotlin.Any?): kotlin.Boolean [operator] declared in kotlin.Any
$this: VALUE_PARAMETER FAKE_OVERRIDE name:<this> type:<root>.J1.J2<T2 of <root>.J1.J2, T1 of <root>.J1>
VALUE_PARAMETER name:other index:0 type:kotlin.Any?
FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:<root>.J1.J2<T2 of <root>.J1.J2, T1 of <root>.J1>) returnType:kotlin.Int [fake_override]
overridden:
public open fun hashCode (): kotlin.Int declared in kotlin.Any
$this: VALUE_PARAMETER FAKE_OVERRIDE name:<this> type:<root>.J1.J2<T2 of <root>.J1.J2, T1 of <root>.J1>
FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:<root>.J1.J2<T2 of <root>.J1.J2, T1 of <root>.J1>) returnType:kotlin.String [fake_override]
overridden:
public open fun toString (): kotlin.String declared in kotlin.Any
$this: VALUE_PARAMETER FAKE_OVERRIDE name:<this> type:<root>.J1.J2<T2 of <root>.J1.J2, T1 of <root>.J1>
FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:<root>.J1<T1 of <root>.J1>, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator]
overridden:
public open fun equals (other: kotlin.Any?): kotlin.Boolean [operator] declared in kotlin.Any
@@ -1,6 +1,25 @@
CLASS IR_EXTERNAL_JAVA_DECLARATION_STUB CLASS name:J modality:OPEN visibility:public superTypes:[kotlin.Any]
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.J
CONSTRUCTOR IR_EXTERNAL_JAVA_DECLARATION_STUB visibility:public <> () returnType:<root>.J [primary]
CLASS IR_EXTERNAL_JAVA_DECLARATION_STUB CLASS name:JInner modality:OPEN visibility:public [inner] superTypes:[kotlin.Any]
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.J.JInner
CONSTRUCTOR IR_EXTERNAL_JAVA_DECLARATION_STUB visibility:public <> ($this:<root>.J) returnType:<root>.J.JInner [primary]
$outer: VALUE_PARAMETER IR_EXTERNAL_JAVA_DECLARATION_STUB name:<this> type:<root>.J
FUN IR_EXTERNAL_JAVA_DECLARATION_STUB name:foo visibility:public modality:OPEN <> ($this:<root>.J.JInner) returnType:kotlin.Unit
$this: VALUE_PARAMETER IR_EXTERNAL_JAVA_DECLARATION_STUB name:<this> type:<root>.J.JInner
FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:<root>.J.JInner, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator]
overridden:
public open fun equals (other: kotlin.Any?): kotlin.Boolean [operator] declared in kotlin.Any
$this: VALUE_PARAMETER FAKE_OVERRIDE name:<this> type:<root>.J.JInner
VALUE_PARAMETER name:other index:0 type:kotlin.Any?
FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:<root>.J.JInner) returnType:kotlin.Int [fake_override]
overridden:
public open fun hashCode (): kotlin.Int declared in kotlin.Any
$this: VALUE_PARAMETER FAKE_OVERRIDE name:<this> type:<root>.J.JInner
FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:<root>.J.JInner) returnType:kotlin.String [fake_override]
overridden:
public open fun toString (): kotlin.String declared in kotlin.Any
$this: VALUE_PARAMETER FAKE_OVERRIDE name:<this> type:<root>.J.JInner
FUN IR_EXTERNAL_JAVA_DECLARATION_STUB name:bar visibility:public modality:OPEN <> ($this:<root>.J) returnType:kotlin.Unit
$this: VALUE_PARAMETER IR_EXTERNAL_JAVA_DECLARATION_STUB name:<this> type:<root>.J
FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:<root>.J, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator]
@@ -1,6 +1,25 @@
CLASS IR_EXTERNAL_JAVA_DECLARATION_STUB CLASS name:J modality:OPEN visibility:public superTypes:[kotlin.Any]
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.J
CONSTRUCTOR IR_EXTERNAL_JAVA_DECLARATION_STUB visibility:public <> () returnType:<root>.J [primary]
CLASS IR_EXTERNAL_JAVA_DECLARATION_STUB CLASS name:JJ modality:OPEN visibility:public superTypes:[kotlin.Any]
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.J.JJ
CONSTRUCTOR IR_EXTERNAL_JAVA_DECLARATION_STUB visibility:public <> () returnType:<root>.J.JJ [primary]
FUN IR_EXTERNAL_JAVA_DECLARATION_STUB name:foo visibility:public modality:OPEN <> ($this:<root>.J.JJ) returnType:kotlin.Unit
$this: VALUE_PARAMETER IR_EXTERNAL_JAVA_DECLARATION_STUB name:<this> type:<root>.J.JJ
FUN IR_EXTERNAL_JAVA_DECLARATION_STUB name:bar visibility:public modality:OPEN <> () returnType:kotlin.Unit
FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:<root>.J.JJ, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator]
overridden:
public open fun equals (other: kotlin.Any?): kotlin.Boolean [operator] declared in kotlin.Any
$this: VALUE_PARAMETER FAKE_OVERRIDE name:<this> type:<root>.J.JJ
VALUE_PARAMETER name:other index:0 type:kotlin.Any?
FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:<root>.J.JJ) returnType:kotlin.Int [fake_override]
overridden:
public open fun hashCode (): kotlin.Int declared in kotlin.Any
$this: VALUE_PARAMETER FAKE_OVERRIDE name:<this> type:<root>.J.JJ
FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:<root>.J.JJ) returnType:kotlin.String [fake_override]
overridden:
public open fun toString (): kotlin.String declared in kotlin.Any
$this: VALUE_PARAMETER FAKE_OVERRIDE name:<this> type:<root>.J.JJ
FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:<root>.J, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator]
overridden:
public open fun equals (other: kotlin.Any?): kotlin.Boolean [operator] declared in kotlin.Any
@@ -0,0 +1,49 @@
CLASS IR_EXTERNAL_JAVA_DECLARATION_STUB CLASS name:Base modality:OPEN visibility:public superTypes:[kotlin.Any]
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.Base
CONSTRUCTOR IR_EXTERNAL_JAVA_DECLARATION_STUB visibility:public <> () returnType:<root>.Base [primary]
CLASS IR_EXTERNAL_JAVA_DECLARATION_STUB CLASS name:BaseInner modality:OPEN visibility:public [inner] superTypes:[kotlin.Any]
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.Base.BaseInner
CONSTRUCTOR IR_EXTERNAL_JAVA_DECLARATION_STUB visibility:public <> ($this:<root>.Base) returnType:<root>.Base.BaseInner [primary]
$outer: VALUE_PARAMETER IR_EXTERNAL_JAVA_DECLARATION_STUB name:<this> type:<root>.Base
FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:<root>.Base.BaseInner, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator]
overridden:
public open fun equals (other: kotlin.Any?): kotlin.Boolean [operator] declared in kotlin.Any
$this: VALUE_PARAMETER FAKE_OVERRIDE name:<this> type:<root>.Base.BaseInner
VALUE_PARAMETER name:other index:0 type:kotlin.Any?
FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:<root>.Base.BaseInner) returnType:kotlin.Int [fake_override]
overridden:
public open fun hashCode (): kotlin.Int declared in kotlin.Any
$this: VALUE_PARAMETER FAKE_OVERRIDE name:<this> type:<root>.Base.BaseInner
FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:<root>.Base.BaseInner) returnType:kotlin.String [fake_override]
overridden:
public open fun toString (): kotlin.String declared in kotlin.Any
$this: VALUE_PARAMETER FAKE_OVERRIDE name:<this> type:<root>.Base.BaseInner
CLASS IR_EXTERNAL_JAVA_DECLARATION_STUB CLASS name:BaseNested modality:OPEN visibility:public superTypes:[kotlin.Any]
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.Base.BaseNested
CONSTRUCTOR IR_EXTERNAL_JAVA_DECLARATION_STUB visibility:public <> () returnType:<root>.Base.BaseNested [primary]
FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:<root>.Base.BaseNested, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator]
overridden:
public open fun equals (other: kotlin.Any?): kotlin.Boolean [operator] declared in kotlin.Any
$this: VALUE_PARAMETER FAKE_OVERRIDE name:<this> type:<root>.Base.BaseNested
VALUE_PARAMETER name:other index:0 type:kotlin.Any?
FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:<root>.Base.BaseNested) returnType:kotlin.Int [fake_override]
overridden:
public open fun hashCode (): kotlin.Int declared in kotlin.Any
$this: VALUE_PARAMETER FAKE_OVERRIDE name:<this> type:<root>.Base.BaseNested
FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:<root>.Base.BaseNested) returnType:kotlin.String [fake_override]
overridden:
public open fun toString (): kotlin.String declared in kotlin.Any
$this: VALUE_PARAMETER FAKE_OVERRIDE name:<this> type:<root>.Base.BaseNested
FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:<root>.Base, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator]
overridden:
public open fun equals (other: kotlin.Any?): kotlin.Boolean [operator] declared in kotlin.Any
$this: VALUE_PARAMETER FAKE_OVERRIDE name:<this> type:<root>.Base
VALUE_PARAMETER name:other index:0 type:kotlin.Any?
FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:<root>.Base) returnType:kotlin.Int [fake_override]
overridden:
public open fun hashCode (): kotlin.Int declared in kotlin.Any
$this: VALUE_PARAMETER FAKE_OVERRIDE name:<this> type:<root>.Base
FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:<root>.Base) returnType:kotlin.String [fake_override]
overridden:
public open fun toString (): kotlin.String declared in kotlin.Any
$this: VALUE_PARAMETER FAKE_OVERRIDE name:<this> type:<root>.Base
@@ -0,0 +1,49 @@
CLASS IR_EXTERNAL_JAVA_DECLARATION_STUB CLASS name:Base modality:OPEN visibility:public superTypes:[kotlin.Any]
$this: VALUE_PARAMETER IR_EXTERNAL_JAVA_DECLARATION_STUB name:<this> type:<root>.Base
CONSTRUCTOR IR_EXTERNAL_JAVA_DECLARATION_STUB visibility:public <> () returnType:<root>.Base [primary]
CLASS IR_EXTERNAL_JAVA_DECLARATION_STUB CLASS name:BaseInner modality:OPEN visibility:public [inner] superTypes:[kotlin.Any]
$this: VALUE_PARAMETER IR_EXTERNAL_JAVA_DECLARATION_STUB name:<this> type:<root>.Base.BaseInner
CONSTRUCTOR IR_EXTERNAL_JAVA_DECLARATION_STUB visibility:public <> ($this:<root>.Base) returnType:<root>.Base.BaseInner [primary]
$outer: VALUE_PARAMETER IR_EXTERNAL_JAVA_DECLARATION_STUB name:<this> type:<root>.Base
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 [operator] declared in kotlin.Any
$this: VALUE_PARAMETER FAKE_OVERRIDE name:<this> type:kotlin.Any
VALUE_PARAMETER IR_EXTERNAL_DECLARATION_STUB 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 FAKE_OVERRIDE 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 FAKE_OVERRIDE name:<this> type:kotlin.Any
CLASS IR_EXTERNAL_JAVA_DECLARATION_STUB CLASS name:BaseNested modality:OPEN visibility:public superTypes:[kotlin.Any]
$this: VALUE_PARAMETER IR_EXTERNAL_JAVA_DECLARATION_STUB name:<this> type:<root>.Base.BaseNested
CONSTRUCTOR IR_EXTERNAL_JAVA_DECLARATION_STUB visibility:public <> () returnType:<root>.Base.BaseNested [primary]
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 [operator] declared in kotlin.Any
$this: VALUE_PARAMETER FAKE_OVERRIDE name:<this> type:kotlin.Any
VALUE_PARAMETER IR_EXTERNAL_DECLARATION_STUB 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 FAKE_OVERRIDE 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 FAKE_OVERRIDE name:<this> type:kotlin.Any
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 [operator] declared in kotlin.Any
$this: VALUE_PARAMETER FAKE_OVERRIDE name:<this> type:kotlin.Any
VALUE_PARAMETER IR_EXTERNAL_DECLARATION_STUB 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 FAKE_OVERRIDE 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 FAKE_OVERRIDE name:<this> type:kotlin.Any
@@ -0,0 +1,49 @@
CLASS IR_EXTERNAL_JAVA_DECLARATION_STUB CLASS name:Derived modality:OPEN visibility:public superTypes:[<root>.Base]
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.Derived
CONSTRUCTOR IR_EXTERNAL_JAVA_DECLARATION_STUB visibility:public <> () returnType:<root>.Derived [primary]
CLASS IR_EXTERNAL_JAVA_DECLARATION_STUB CLASS name:DerivedInner modality:OPEN visibility:public [inner] superTypes:[<root>.Base.BaseInner]
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.Derived.DerivedInner
CONSTRUCTOR IR_EXTERNAL_JAVA_DECLARATION_STUB visibility:public <> ($this:<root>.Derived) returnType:<root>.Derived.DerivedInner [primary]
$outer: VALUE_PARAMETER IR_EXTERNAL_JAVA_DECLARATION_STUB name:<this> type:<root>.Derived
FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:<root>.Derived.DerivedInner, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator]
overridden:
public open fun equals (other: kotlin.Any?): kotlin.Boolean [fake_override,operator] declared in <root>.Base.BaseInner
$this: VALUE_PARAMETER FAKE_OVERRIDE name:<this> type:<root>.Derived.DerivedInner
VALUE_PARAMETER name:other index:0 type:kotlin.Any?
FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:<root>.Derived.DerivedInner) returnType:kotlin.Int [fake_override]
overridden:
public open fun hashCode (): kotlin.Int [fake_override] declared in <root>.Base.BaseInner
$this: VALUE_PARAMETER FAKE_OVERRIDE name:<this> type:<root>.Derived.DerivedInner
FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:<root>.Derived.DerivedInner) returnType:kotlin.String [fake_override]
overridden:
public open fun toString (): kotlin.String [fake_override] declared in <root>.Base.BaseInner
$this: VALUE_PARAMETER FAKE_OVERRIDE name:<this> type:<root>.Derived.DerivedInner
CLASS IR_EXTERNAL_JAVA_DECLARATION_STUB CLASS name:DerivedNested modality:OPEN visibility:public superTypes:[<root>.Base.BaseNested]
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.Derived.DerivedNested
CONSTRUCTOR IR_EXTERNAL_JAVA_DECLARATION_STUB visibility:public <> () returnType:<root>.Derived.DerivedNested [primary]
FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:<root>.Derived.DerivedNested, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator]
overridden:
public open fun equals (other: kotlin.Any?): kotlin.Boolean [fake_override,operator] declared in <root>.Base.BaseNested
$this: VALUE_PARAMETER FAKE_OVERRIDE name:<this> type:<root>.Derived.DerivedNested
VALUE_PARAMETER name:other index:0 type:kotlin.Any?
FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:<root>.Derived.DerivedNested) returnType:kotlin.Int [fake_override]
overridden:
public open fun hashCode (): kotlin.Int [fake_override] declared in <root>.Base.BaseNested
$this: VALUE_PARAMETER FAKE_OVERRIDE name:<this> type:<root>.Derived.DerivedNested
FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:<root>.Derived.DerivedNested) returnType:kotlin.String [fake_override]
overridden:
public open fun toString (): kotlin.String [fake_override] declared in <root>.Base.BaseNested
$this: VALUE_PARAMETER FAKE_OVERRIDE name:<this> type:<root>.Derived.DerivedNested
FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:<root>.Derived, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator]
overridden:
public open fun equals (other: kotlin.Any?): kotlin.Boolean [fake_override,operator] declared in <root>.Base
$this: VALUE_PARAMETER FAKE_OVERRIDE name:<this> type:<root>.Derived
VALUE_PARAMETER name:other index:0 type:kotlin.Any?
FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:<root>.Derived) returnType:kotlin.Int [fake_override]
overridden:
public open fun hashCode (): kotlin.Int [fake_override] declared in <root>.Base
$this: VALUE_PARAMETER FAKE_OVERRIDE name:<this> type:<root>.Derived
FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:<root>.Derived) returnType:kotlin.String [fake_override]
overridden:
public open fun toString (): kotlin.String [fake_override] declared in <root>.Base
$this: VALUE_PARAMETER FAKE_OVERRIDE name:<this> type:<root>.Derived
@@ -0,0 +1,49 @@
CLASS IR_EXTERNAL_JAVA_DECLARATION_STUB CLASS name:Derived modality:OPEN visibility:public superTypes:[<root>.Base]
$this: VALUE_PARAMETER IR_EXTERNAL_JAVA_DECLARATION_STUB name:<this> type:<root>.Derived
CONSTRUCTOR IR_EXTERNAL_JAVA_DECLARATION_STUB visibility:public <> () returnType:<root>.Derived [primary]
CLASS IR_EXTERNAL_JAVA_DECLARATION_STUB CLASS name:DerivedInner modality:OPEN visibility:public [inner] superTypes:[<root>.Base.BaseInner]
$this: VALUE_PARAMETER IR_EXTERNAL_JAVA_DECLARATION_STUB name:<this> type:<root>.Derived.DerivedInner
CONSTRUCTOR IR_EXTERNAL_JAVA_DECLARATION_STUB visibility:public <> ($this:<root>.Derived) returnType:<root>.Derived.DerivedInner [primary]
$outer: VALUE_PARAMETER IR_EXTERNAL_JAVA_DECLARATION_STUB name:<this> type:<root>.Derived
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 <root>.Base.BaseInner
$this: VALUE_PARAMETER FAKE_OVERRIDE name:<this> type:kotlin.Any
VALUE_PARAMETER IR_EXTERNAL_DECLARATION_STUB 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 <root>.Base.BaseInner
$this: VALUE_PARAMETER FAKE_OVERRIDE 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 [fake_override] declared in <root>.Base.BaseInner
$this: VALUE_PARAMETER FAKE_OVERRIDE name:<this> type:kotlin.Any
CLASS IR_EXTERNAL_JAVA_DECLARATION_STUB CLASS name:DerivedNested modality:OPEN visibility:public superTypes:[<root>.Base.BaseNested]
$this: VALUE_PARAMETER IR_EXTERNAL_JAVA_DECLARATION_STUB name:<this> type:<root>.Derived.DerivedNested
CONSTRUCTOR IR_EXTERNAL_JAVA_DECLARATION_STUB visibility:public <> () returnType:<root>.Derived.DerivedNested [primary]
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 <root>.Base.BaseNested
$this: VALUE_PARAMETER FAKE_OVERRIDE name:<this> type:kotlin.Any
VALUE_PARAMETER IR_EXTERNAL_DECLARATION_STUB 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 <root>.Base.BaseNested
$this: VALUE_PARAMETER FAKE_OVERRIDE 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 [fake_override] declared in <root>.Base.BaseNested
$this: VALUE_PARAMETER FAKE_OVERRIDE name:<this> type:kotlin.Any
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 <root>.Base
$this: VALUE_PARAMETER FAKE_OVERRIDE name:<this> type:kotlin.Any
VALUE_PARAMETER IR_EXTERNAL_DECLARATION_STUB 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 <root>.Base
$this: VALUE_PARAMETER FAKE_OVERRIDE 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 [fake_override] declared in <root>.Base
$this: VALUE_PARAMETER FAKE_OVERRIDE name:<this> type:kotlin.Any
@@ -0,0 +1,3 @@
FILE fqName:<root> fileName:/javaNestedClassesInHierarchy.kt
FUN name:test visibility:public modality:FINAL <> () returnType:kotlin.Unit
BLOCK_BODY
@@ -0,0 +1,19 @@
// TARGET_BACKEND: JVM
// FIR_IDENTICAL
// DUMP_EXTERNAL_CLASS: Base, Derived
// FILE: javaNestedClassesInHierarchy.kt
fun test() {}
// FILE: Base.java
public class Base {
public class BaseInner {}
public static class BaseNested {}
}
// FILE: Derived.java
public class Derived extends Base {
public class DerivedInner extends BaseInner {}
public static class DerivedNested extends BaseNested {}
}
@@ -0,0 +1,2 @@
fun test() {
}
@@ -3006,6 +3006,12 @@ public class IrTextTestGenerated extends AbstractIrTextTest {
runTest("compiler/testData/ir/irText/stubs/javaNestedClass.kt");
}
@Test
@TestMetadata("javaNestedClassesInHierarchy.kt")
public void testJavaNestedClassesInHierarchy() throws Exception {
runTest("compiler/testData/ir/irText/stubs/javaNestedClassesInHierarchy.kt");
}
@Test
@TestMetadata("javaStaticMethod.kt")
public void testJavaStaticMethod() throws Exception {
@@ -79,12 +79,16 @@ class IrTextDumpHandler(testServices: TestServices) : AbstractIrHandler(testServ
if (externalClassIds.isEmpty()) return
val baseFile = testServices.moduleStructure.originalTestDataFiles.first()
for (externalClassId in externalClassIds) {
val classDump = info.irPluginContext.findExternalClass(externalClassId).dump()
val suffix = ".__${externalClassId.replace("/", ".")}"
val expectedFile = baseFile.withSuffixAndExtension(suffix, module.getDumpExtension(ignoreFirIdentical = true))
assertions.assertEqualsToFile(expectedFile, classDump)
}
assertions.assertAll(
externalClassIds.map { externalClassId ->
{
val classDump = info.irPluginContext.findExternalClass(externalClassId).dump()
val suffix = ".__${externalClassId.replace("/", ".")}"
val expectedFile = baseFile.withSuffixAndExtension(suffix, module.getDumpExtension(ignoreFirIdentical = true))
assertions.assertEqualsToFile(expectedFile, classDump)
}
}
)
}
private fun IrPluginContext.findExternalClass(externalClassId: String): IrClass {