From d06d3ff4675ce592e4671118f23ce7f615a9f055 Mon Sep 17 00:00:00 2001 From: Ivan Kochurkin Date: Tue, 18 Apr 2023 19:17:13 +0200 Subject: [PATCH] [FIR2IR] Consider `isExpect` value of super members during fake-overrides generating It's important for FIR2IR and IrActualizer Because `isExpect` is a part of signature, and it's considered during actualization --- .../generators/FakeOverrideGenerator.kt | 8 +- .../FirLightTreeJvmIrTextTestGenerated.java | 12 +++ .../ir/FirPsiJvmIrTextTestGenerated.java | 12 +++ .../expectMemberInNotExpectClass.ir.txt | 90 +++++++++++++++++ .../expectMemberInNotExpectClass.kt | 17 ++++ .../expectMemberInNotExpectClass.kt.txt | 34 +++++++ .../expectMemberInNotExpectClassFir.ir.txt | 97 +++++++++++++++++++ .../expectMemberInNotExpectClassFir.kt | 24 +++++ .../expectMemberInNotExpectClassFir.kt.txt | 40 ++++++++ .../ir/ClassicJvmIrTextTestGenerated.java | 12 +++ .../klib/KlibIrTextTestCaseGenerated.java | 10 ++ .../FirLightTreeJsIrTextTestGenerated.java | 12 +++ .../test/fir/FirPsiJsIrTextTestGenerated.java | 12 +++ .../test/ir/ClassicJsIrTextTestGenerated.java | 12 +++ 14 files changed, 388 insertions(+), 4 deletions(-) create mode 100644 compiler/testData/ir/irText/declarations/multiplatform/expectMemberInNotExpectClass.ir.txt create mode 100644 compiler/testData/ir/irText/declarations/multiplatform/expectMemberInNotExpectClass.kt create mode 100644 compiler/testData/ir/irText/declarations/multiplatform/expectMemberInNotExpectClass.kt.txt create mode 100644 compiler/testData/ir/irText/declarations/multiplatform/expectMemberInNotExpectClassFir.ir.txt create mode 100644 compiler/testData/ir/irText/declarations/multiplatform/expectMemberInNotExpectClassFir.kt create mode 100644 compiler/testData/ir/irText/declarations/multiplatform/expectMemberInNotExpectClassFir.kt.txt diff --git a/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/backend/generators/FakeOverrideGenerator.kt b/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/backend/generators/FakeOverrideGenerator.kt index f171d3c1c10..c2a9594a9d8 100644 --- a/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/backend/generators/FakeOverrideGenerator.kt +++ b/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/backend/generators/FakeOverrideGenerator.kt @@ -136,7 +136,7 @@ class FakeOverrideGenerator( session, symbol, firFunction, derivedClassLookupTag = firClass.symbol.toLookupTag(), newDispatchReceiverType = firClass.defaultType(), - isExpect = (firClass as? FirRegularClass)?.isExpect == true + isExpect = (firClass as? FirRegularClass)?.isExpect == true || firFunction.isExpect ) }, baseFunctionSymbols, @@ -164,7 +164,7 @@ class FakeOverrideGenerator( session, symbolForOverride, firProperty, derivedClassLookupTag = firClass.symbol.toLookupTag(), newDispatchReceiverType = firClass.defaultType(), - isExpect = (firClass as? FirRegularClass)?.isExpect == true + isExpect = (firClass as? FirRegularClass)?.isExpect == true || firProperty.isExpect ) }, basePropertySymbols, @@ -344,7 +344,7 @@ class FakeOverrideGenerator( session, callableSymbol, firFunction, derivedClassLookupTag = klass.symbol.toLookupTag(), newDispatchReceiverType = klass.defaultType(), - isExpect = (klass as? FirRegularClass)?.isExpect == true + isExpect = (klass as? FirRegularClass)?.isExpect == true || firFunction.isExpect ) }, computeDirectOverridden = FirTypeScope::getDirectOverriddenFunctions, @@ -363,7 +363,7 @@ class FakeOverrideGenerator( session, callableSymbol, firProperty, derivedClassLookupTag = klass.symbol.toLookupTag(), newDispatchReceiverType = klass.defaultType(), - isExpect = (klass as? FirRegularClass)?.isExpect == true + isExpect = (klass as? FirRegularClass)?.isExpect == true || firProperty.isExpect ) }, computeDirectOverridden = FirTypeScope::getDirectOverriddenProperties, diff --git a/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/ir/FirLightTreeJvmIrTextTestGenerated.java b/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/ir/FirLightTreeJvmIrTextTestGenerated.java index f012a4f6bc5..f15f9a6c0c1 100644 --- a/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/ir/FirLightTreeJvmIrTextTestGenerated.java +++ b/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/ir/FirLightTreeJvmIrTextTestGenerated.java @@ -1009,6 +1009,18 @@ public class FirLightTreeJvmIrTextTestGenerated extends AbstractFirLightTreeJvmI runTest("compiler/testData/ir/irText/declarations/multiplatform/expectIntersectionOverride.kt"); } + @Test + @TestMetadata("expectMemberInNotExpectClass.kt") + public void testExpectMemberInNotExpectClass() throws Exception { + runTest("compiler/testData/ir/irText/declarations/multiplatform/expectMemberInNotExpectClass.kt"); + } + + @Test + @TestMetadata("expectMemberInNotExpectClassFir.kt") + public void testExpectMemberInNotExpectClassFir() throws Exception { + runTest("compiler/testData/ir/irText/declarations/multiplatform/expectMemberInNotExpectClassFir.kt"); + } + @Test @TestMetadata("expectedEnumClass.kt") public void testExpectedEnumClass() throws Exception { diff --git a/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/ir/FirPsiJvmIrTextTestGenerated.java b/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/ir/FirPsiJvmIrTextTestGenerated.java index 8567238c27f..6bd0c69784f 100644 --- a/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/ir/FirPsiJvmIrTextTestGenerated.java +++ b/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/ir/FirPsiJvmIrTextTestGenerated.java @@ -1009,6 +1009,18 @@ public class FirPsiJvmIrTextTestGenerated extends AbstractFirPsiJvmIrTextTest { runTest("compiler/testData/ir/irText/declarations/multiplatform/expectIntersectionOverride.kt"); } + @Test + @TestMetadata("expectMemberInNotExpectClass.kt") + public void testExpectMemberInNotExpectClass() throws Exception { + runTest("compiler/testData/ir/irText/declarations/multiplatform/expectMemberInNotExpectClass.kt"); + } + + @Test + @TestMetadata("expectMemberInNotExpectClassFir.kt") + public void testExpectMemberInNotExpectClassFir() throws Exception { + runTest("compiler/testData/ir/irText/declarations/multiplatform/expectMemberInNotExpectClassFir.kt"); + } + @Test @TestMetadata("expectedEnumClass.kt") public void testExpectedEnumClass() throws Exception { diff --git a/compiler/testData/ir/irText/declarations/multiplatform/expectMemberInNotExpectClass.ir.txt b/compiler/testData/ir/irText/declarations/multiplatform/expectMemberInNotExpectClass.ir.txt new file mode 100644 index 00000000000..7cf6e4d6c06 --- /dev/null +++ b/compiler/testData/ir/irText/declarations/multiplatform/expectMemberInNotExpectClass.ir.txt @@ -0,0 +1,90 @@ +FILE fqName: fileName:/expectMemberInNotExpectClass.kt + CLASS CLASS name:C1 modality:OPEN visibility:public [expect] superTypes:[kotlin.Any] + $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.C1 + CONSTRUCTOR visibility:public <> () returnType:.C1 [primary,expect] + FUN name:f visibility:public modality:FINAL <> ($this:.C1) returnType:kotlin.String [expect] + $this: VALUE_PARAMETER name: type:.C1 + PROPERTY name:p visibility:public modality:FINAL [expect,val] + FIELD PROPERTY_BACKING_FIELD name:p type:kotlin.Int visibility:private [final] + FUN DEFAULT_PROPERTY_ACCESSOR name: visibility:public modality:FINAL <> ($this:.C1) returnType:kotlin.Int + correspondingProperty: PROPERTY name:p visibility:public modality:FINAL [expect,val] + $this: VALUE_PARAMETER name: type:.C1 + 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 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 declared in kotlin.Any + $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 declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + CLASS CLASS name:C2 modality:FINAL visibility:public superTypes:[.C1] + $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.C2 + CONSTRUCTOR visibility:public <> () returnType:.C2 [primary] + BLOCK_BODY + DELEGATING_CONSTRUCTOR_CALL 'public constructor () [primary] declared in .C1' + INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:C2 modality:FINAL visibility:public superTypes:[.C1]' + FUN FAKE_OVERRIDE name:f visibility:public modality:FINAL <> ($this:.C1) returnType:kotlin.String [fake_override] + overridden: + public final fun f (): kotlin.String declared in .C1 + $this: VALUE_PARAMETER name: type:.C1 + PROPERTY FAKE_OVERRIDE name:p visibility:public modality:FINAL [fake_override,val] + overridden: + public final p: kotlin.Int [val] + FUN FAKE_OVERRIDE name: visibility:public modality:FINAL <> ($this:.C1) returnType:kotlin.Int [fake_override] + correspondingProperty: PROPERTY FAKE_OVERRIDE name:p visibility:public modality:FINAL [fake_override,val] + overridden: + public final fun (): kotlin.Int declared in .C1 + $this: VALUE_PARAMETER name: type:.C1 + 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 .C1 + $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 .C1 + $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 .C1 + $this: VALUE_PARAMETER name: type:kotlin.Any + CLASS CLASS name:C1 modality:OPEN visibility:public superTypes:[kotlin.Any] + $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.C1 + CONSTRUCTOR visibility:public <> () returnType:.C1 [primary] + BLOCK_BODY + DELEGATING_CONSTRUCTOR_CALL 'public constructor () [primary] declared in kotlin.Any' + INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:C1 modality:OPEN visibility:public superTypes:[kotlin.Any]' + FUN name:f visibility:public modality:FINAL <> ($this:.C1) returnType:kotlin.String + $this: VALUE_PARAMETER name: type:.C1 + BLOCK_BODY + RETURN type=kotlin.Nothing from='public final fun f (): kotlin.String declared in .C1' + CONST String type=kotlin.String value="O" + PROPERTY name:p visibility:public modality:FINAL [val] + FIELD PROPERTY_BACKING_FIELD name:p type:kotlin.Int visibility:private [final] + EXPRESSION_BODY + CONST Int type=kotlin.Int value=42 + FUN DEFAULT_PROPERTY_ACCESSOR name: visibility:public modality:FINAL <> ($this:.C1) returnType:kotlin.Int + correspondingProperty: PROPERTY name:p visibility:public modality:FINAL [val] + $this: VALUE_PARAMETER name: type:.C1 + BLOCK_BODY + RETURN type=kotlin.Nothing from='public final fun (): kotlin.Int declared in .C1' + GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:p type:kotlin.Int visibility:private [final]' type=kotlin.Int origin=null + receiver: GET_VAR ': .C1 declared in .C1.' type=.C1 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 [operator] declared in kotlin.Any + $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 declared in kotlin.Any + $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 declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any diff --git a/compiler/testData/ir/irText/declarations/multiplatform/expectMemberInNotExpectClass.kt b/compiler/testData/ir/irText/declarations/multiplatform/expectMemberInNotExpectClass.kt new file mode 100644 index 00000000000..c29ca83900f --- /dev/null +++ b/compiler/testData/ir/irText/declarations/multiplatform/expectMemberInNotExpectClass.kt @@ -0,0 +1,17 @@ +// IGNORE_BACKEND_K2: ANY +// SKIP_KLIB_TEST +// LANGUAGE: +MultiPlatformProjects + +expect open class C1() { + fun f(): String + + val p: Int +} + +class C2 : C1() + +actual open class C1 { + actual fun f() = "O" + + actual val p = 42 +} \ No newline at end of file diff --git a/compiler/testData/ir/irText/declarations/multiplatform/expectMemberInNotExpectClass.kt.txt b/compiler/testData/ir/irText/declarations/multiplatform/expectMemberInNotExpectClass.kt.txt new file mode 100644 index 00000000000..094f3d18c56 --- /dev/null +++ b/compiler/testData/ir/irText/declarations/multiplatform/expectMemberInNotExpectClass.kt.txt @@ -0,0 +1,34 @@ +expect open class C1 { + expect constructor() /* primary */ + expect fun f(): String + + expect val p: Int + get + +} + +class C2 : C1 { + constructor() /* primary */ { + super/*C1*/() + /* () */ + + } + +} + +open class C1 { + constructor() /* primary */ { + super/*Any*/() + /* () */ + + } + + fun f(): String { + return "O" + } + + val p: Int + field = 42 + get + +} diff --git a/compiler/testData/ir/irText/declarations/multiplatform/expectMemberInNotExpectClassFir.ir.txt b/compiler/testData/ir/irText/declarations/multiplatform/expectMemberInNotExpectClassFir.ir.txt new file mode 100644 index 00000000000..b629c3cbf20 --- /dev/null +++ b/compiler/testData/ir/irText/declarations/multiplatform/expectMemberInNotExpectClassFir.ir.txt @@ -0,0 +1,97 @@ +Module: +FILE fqName: fileName:/common.kt + CLASS CLASS name:C1 modality:OPEN visibility:public [expect] superTypes:[kotlin.Any] + $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.C1 + CONSTRUCTOR visibility:public <> () returnType:.C1 [primary,expect] + FUN name:f visibility:public modality:FINAL <> ($this:.C1) returnType:kotlin.String [expect] + $this: VALUE_PARAMETER name: type:.C1 + PROPERTY name:p visibility:public modality:FINAL [expect,val] + FIELD PROPERTY_BACKING_FIELD name:p type:kotlin.Int visibility:private [final] + FUN DEFAULT_PROPERTY_ACCESSOR name: visibility:public modality:FINAL <> ($this:.C1) returnType:kotlin.Int + correspondingProperty: PROPERTY name:p visibility:public modality:FINAL [expect,val] + $this: VALUE_PARAMETER name: type:.C1 + BLOCK_BODY + RETURN type=kotlin.Nothing from='public final fun (): kotlin.Int declared in .C1' + GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:p type:kotlin.Int visibility:private [final]' type=kotlin.Int origin=null + receiver: GET_VAR ': .C1 declared in .C1.' type=.C1 origin=null + FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [expect,fake_override,operator] + overridden: + public open fun equals (other: kotlin.Any?): kotlin.Boolean [operator] declared in kotlin.Any + $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 [expect,fake_override] + overridden: + public open fun hashCode (): kotlin.Int declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String [expect,fake_override] + overridden: + public open fun toString (): kotlin.String declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + CLASS CLASS name:C2 modality:FINAL visibility:public superTypes:[.C1] + $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.C2 + CONSTRUCTOR visibility:public <> () returnType:.C2 [primary] + BLOCK_BODY + DELEGATING_CONSTRUCTOR_CALL 'public constructor () [primary,expect] declared in .C1' + INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:C2 modality:FINAL visibility:public superTypes:[.C1]' + FUN FAKE_OVERRIDE name:f visibility:public modality:FINAL <> ($this:.C1) returnType:kotlin.String [expect,fake_override] + overridden: + public final fun f (): kotlin.String [expect] declared in .C1 + $this: VALUE_PARAMETER name: type:.C1 + PROPERTY FAKE_OVERRIDE name:p visibility:public modality:FINAL [expect,fake_override,val] + overridden: + public final p: kotlin.Int [expect,val] + FUN FAKE_OVERRIDE name: visibility:public modality:FINAL <> ($this:.C1) returnType:kotlin.Int [fake_override] + correspondingProperty: PROPERTY FAKE_OVERRIDE name:p visibility:public modality:FINAL [expect,fake_override,val] + overridden: + public final fun (): kotlin.Int declared in .C1 + $this: VALUE_PARAMETER name: type:.C1 + 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 [expect,fake_override,operator] declared in .C1 + $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 [expect,fake_override] declared in .C1 + $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 [expect,fake_override] declared in .C1 + $this: VALUE_PARAMETER name: type:kotlin.Any +Module: platform +FILE fqName: fileName:/platform.kt + CLASS CLASS name:C1 modality:OPEN visibility:public superTypes:[kotlin.Any] + $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.C1 + CONSTRUCTOR visibility:public <> () returnType:.C1 [primary] + BLOCK_BODY + DELEGATING_CONSTRUCTOR_CALL 'public constructor () [primary] declared in kotlin.Any' + INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:C1 modality:OPEN visibility:public superTypes:[kotlin.Any]' + FUN name:f visibility:public modality:FINAL <> ($this:.C1) returnType:kotlin.String + $this: VALUE_PARAMETER name: type:.C1 + BLOCK_BODY + RETURN type=kotlin.Nothing from='public final fun f (): kotlin.String declared in .C1' + CONST String type=kotlin.String value="O" + PROPERTY name:p visibility:public modality:FINAL [val] + FIELD PROPERTY_BACKING_FIELD name:p type:kotlin.Int visibility:private [final] + EXPRESSION_BODY + CONST Int type=kotlin.Int value=42 + FUN DEFAULT_PROPERTY_ACCESSOR name: visibility:public modality:FINAL <> ($this:.C1) returnType:kotlin.Int + correspondingProperty: PROPERTY name:p visibility:public modality:FINAL [val] + $this: VALUE_PARAMETER name: type:.C1 + BLOCK_BODY + RETURN type=kotlin.Nothing from='public final fun (): kotlin.Int declared in .C1' + GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:p type:kotlin.Int visibility:private [final]' type=kotlin.Int origin=null + receiver: GET_VAR ': .C1 declared in .C1.' type=.C1 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 [operator] declared in kotlin.Any + $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 declared in kotlin.Any + $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 declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any diff --git a/compiler/testData/ir/irText/declarations/multiplatform/expectMemberInNotExpectClassFir.kt b/compiler/testData/ir/irText/declarations/multiplatform/expectMemberInNotExpectClassFir.kt new file mode 100644 index 00000000000..caf98ac4e2d --- /dev/null +++ b/compiler/testData/ir/irText/declarations/multiplatform/expectMemberInNotExpectClassFir.kt @@ -0,0 +1,24 @@ +// FIR_IDENTICAL +// IGNORE_BACKEND_K1: JVM_IR, JS_IR +// SKIP_KLIB_TEST +// LANGUAGE: +MultiPlatformProjects + +// MODULE: common +// FILE: common.kt + +expect open class C1() { + fun f(): String + + val p: Int +} + +class C2 : C1() + +// MODULE: platform()()(common) +// FILE: platform.kt + +actual open class C1 { + actual fun f() = "O" + + actual val p = 42 +} \ No newline at end of file diff --git a/compiler/testData/ir/irText/declarations/multiplatform/expectMemberInNotExpectClassFir.kt.txt b/compiler/testData/ir/irText/declarations/multiplatform/expectMemberInNotExpectClassFir.kt.txt new file mode 100644 index 00000000000..7bf6dbc2e1b --- /dev/null +++ b/compiler/testData/ir/irText/declarations/multiplatform/expectMemberInNotExpectClassFir.kt.txt @@ -0,0 +1,40 @@ +// MODULE: +// FILE: common.kt + +expect open class C1 { + expect constructor() /* primary */ + expect fun f(): String + + expect val p: Int + get + +} + +class C2 : C1 { + constructor() /* primary */ { + super/*C1*/() + /* () */ + + } + +} + +// MODULE: platform +// FILE: platform.kt + +open class C1 { + constructor() /* primary */ { + super/*Any*/() + /* () */ + + } + + fun f(): String { + return "O" + } + + val p: Int + field = 42 + get + +} diff --git a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/ir/ClassicJvmIrTextTestGenerated.java b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/ir/ClassicJvmIrTextTestGenerated.java index acedf77b1bb..828eb900452 100644 --- a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/ir/ClassicJvmIrTextTestGenerated.java +++ b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/ir/ClassicJvmIrTextTestGenerated.java @@ -1009,6 +1009,18 @@ public class ClassicJvmIrTextTestGenerated extends AbstractClassicJvmIrTextTest runTest("compiler/testData/ir/irText/declarations/multiplatform/expectIntersectionOverride.kt"); } + @Test + @TestMetadata("expectMemberInNotExpectClass.kt") + public void testExpectMemberInNotExpectClass() throws Exception { + runTest("compiler/testData/ir/irText/declarations/multiplatform/expectMemberInNotExpectClass.kt"); + } + + @Test + @TestMetadata("expectMemberInNotExpectClassFir.kt") + public void testExpectMemberInNotExpectClassFir() throws Exception { + runTest("compiler/testData/ir/irText/declarations/multiplatform/expectMemberInNotExpectClassFir.kt"); + } + @Test @TestMetadata("expectedEnumClass.kt") public void testExpectedEnumClass() throws Exception { diff --git a/compiler/tests-gen/org/jetbrains/kotlin/klib/KlibIrTextTestCaseGenerated.java b/compiler/tests-gen/org/jetbrains/kotlin/klib/KlibIrTextTestCaseGenerated.java index 32d2c27fbf5..56b6f0478e5 100644 --- a/compiler/tests-gen/org/jetbrains/kotlin/klib/KlibIrTextTestCaseGenerated.java +++ b/compiler/tests-gen/org/jetbrains/kotlin/klib/KlibIrTextTestCaseGenerated.java @@ -737,6 +737,16 @@ public class KlibIrTextTestCaseGenerated extends AbstractKlibIrTextTestCase { runTest("compiler/testData/ir/irText/declarations/multiplatform/expectIntersectionOverride.kt"); } + @TestMetadata("expectMemberInNotExpectClass.kt") + public void testExpectMemberInNotExpectClass() throws Exception { + runTest("compiler/testData/ir/irText/declarations/multiplatform/expectMemberInNotExpectClass.kt"); + } + + @TestMetadata("expectMemberInNotExpectClassFir.kt") + public void testExpectMemberInNotExpectClassFir() throws Exception { + runTest("compiler/testData/ir/irText/declarations/multiplatform/expectMemberInNotExpectClassFir.kt"); + } + @TestMetadata("expectedEnumClass.kt") public void testExpectedEnumClass() throws Exception { runTest("compiler/testData/ir/irText/declarations/multiplatform/expectedEnumClass.kt"); diff --git a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/fir/FirLightTreeJsIrTextTestGenerated.java b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/fir/FirLightTreeJsIrTextTestGenerated.java index c3c781afe50..1943ddd9ed6 100644 --- a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/fir/FirLightTreeJsIrTextTestGenerated.java +++ b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/fir/FirLightTreeJsIrTextTestGenerated.java @@ -829,6 +829,18 @@ public class FirLightTreeJsIrTextTestGenerated extends AbstractFirLightTreeJsIrT runTest("compiler/testData/ir/irText/declarations/multiplatform/expectIntersectionOverride.kt"); } + @Test + @TestMetadata("expectMemberInNotExpectClass.kt") + public void testExpectMemberInNotExpectClass() throws Exception { + runTest("compiler/testData/ir/irText/declarations/multiplatform/expectMemberInNotExpectClass.kt"); + } + + @Test + @TestMetadata("expectMemberInNotExpectClassFir.kt") + public void testExpectMemberInNotExpectClassFir() throws Exception { + runTest("compiler/testData/ir/irText/declarations/multiplatform/expectMemberInNotExpectClassFir.kt"); + } + @Test @TestMetadata("expectedEnumClass.kt") public void testExpectedEnumClass() throws Exception { diff --git a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/fir/FirPsiJsIrTextTestGenerated.java b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/fir/FirPsiJsIrTextTestGenerated.java index df5f80a4075..ed2b31d07c1 100644 --- a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/fir/FirPsiJsIrTextTestGenerated.java +++ b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/fir/FirPsiJsIrTextTestGenerated.java @@ -829,6 +829,18 @@ public class FirPsiJsIrTextTestGenerated extends AbstractFirPsiJsIrTextTest { runTest("compiler/testData/ir/irText/declarations/multiplatform/expectIntersectionOverride.kt"); } + @Test + @TestMetadata("expectMemberInNotExpectClass.kt") + public void testExpectMemberInNotExpectClass() throws Exception { + runTest("compiler/testData/ir/irText/declarations/multiplatform/expectMemberInNotExpectClass.kt"); + } + + @Test + @TestMetadata("expectMemberInNotExpectClassFir.kt") + public void testExpectMemberInNotExpectClassFir() throws Exception { + runTest("compiler/testData/ir/irText/declarations/multiplatform/expectMemberInNotExpectClassFir.kt"); + } + @Test @TestMetadata("expectedEnumClass.kt") public void testExpectedEnumClass() throws Exception { diff --git a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/ir/ClassicJsIrTextTestGenerated.java b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/ir/ClassicJsIrTextTestGenerated.java index 03bb5572491..dfa2002d215 100644 --- a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/ir/ClassicJsIrTextTestGenerated.java +++ b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/ir/ClassicJsIrTextTestGenerated.java @@ -829,6 +829,18 @@ public class ClassicJsIrTextTestGenerated extends AbstractClassicJsIrTextTest { runTest("compiler/testData/ir/irText/declarations/multiplatform/expectIntersectionOverride.kt"); } + @Test + @TestMetadata("expectMemberInNotExpectClass.kt") + public void testExpectMemberInNotExpectClass() throws Exception { + runTest("compiler/testData/ir/irText/declarations/multiplatform/expectMemberInNotExpectClass.kt"); + } + + @Test + @TestMetadata("expectMemberInNotExpectClassFir.kt") + public void testExpectMemberInNotExpectClassFir() throws Exception { + runTest("compiler/testData/ir/irText/declarations/multiplatform/expectMemberInNotExpectClassFir.kt"); + } + @Test @TestMetadata("expectedEnumClass.kt") public void testExpectedEnumClass() throws Exception {