diff --git a/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/backend/generators/CallAndReferenceGenerator.kt b/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/backend/generators/CallAndReferenceGenerator.kt index 585b04c66b5..bd940c9f997 100644 --- a/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/backend/generators/CallAndReferenceGenerator.kt +++ b/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/backend/generators/CallAndReferenceGenerator.kt @@ -13,13 +13,16 @@ import org.jetbrains.kotlin.fir.dispatchReceiverClassLookupTagOrNull import org.jetbrains.kotlin.fir.expressions.* import org.jetbrains.kotlin.fir.expressions.builder.buildAnnotationCall import org.jetbrains.kotlin.fir.expressions.impl.FirNoReceiverExpression +import org.jetbrains.kotlin.fir.getContainingClassLookupTag import org.jetbrains.kotlin.fir.references.* import org.jetbrains.kotlin.fir.references.builder.buildResolvedNamedReference import org.jetbrains.kotlin.fir.render import org.jetbrains.kotlin.fir.resolve.calls.FirSyntheticFunctionSymbol +import org.jetbrains.kotlin.fir.resolve.defaultType import org.jetbrains.kotlin.fir.resolve.fullyExpandedType import org.jetbrains.kotlin.fir.resolve.substitution.ConeSubstitutor import org.jetbrains.kotlin.fir.resolve.substitution.ConeSubstitutorByMap +import org.jetbrains.kotlin.fir.resolve.toFirRegularClassSymbol import org.jetbrains.kotlin.fir.resolve.toSymbol import org.jetbrains.kotlin.fir.resolve.transformers.body.resolve.approximateDeclarationType import org.jetbrains.kotlin.fir.scopes.unsubstitutedScope @@ -703,7 +706,35 @@ class CallAndReferenceGenerator( val resolvedReference = callableReferenceAccess.calleeReference as FirResolvedNamedReference val firCallableSymbol = resolvedReference.resolvedSymbol as FirCallableSymbol<*> // Make sure the reference indeed refers to a member of that companion - if (firCallableSymbol.dispatchReceiverClassLookupTagOrNull() != classSymbol.toLookupTag()) { + + val dispatchReceiverClassLookupTag = firCallableSymbol.dispatchReceiverClassLookupTagOrNull() ?: return null + val callableIsDefinitelyNotMemberOfCompanion = with(session.typeContext) { + !classSymbol.defaultType().anySuperTypeConstructor { it.typeConstructor() == dispatchReceiverClassLookupTag } + } + if (callableIsDefinitelyNotMemberOfCompanion) { + return null + } + /* + * This check is supposed to distinguish cases when both companion and containing class have this function + * + * open class Base { + * fun foo() {} + * } + * + * class Some : Base() { + * companion object : Base() { + * fun bar() + * } + * } + * + * Some::foo // reference to Some.foo + * Some::bar // reference to Some.Companion.bar + */ + val containingClass = classSymbol.getContainingClassLookupTag()?.toFirRegularClassSymbol(session) ?: return null + val callableIsDefinitelyMemberOfOuterClass = with(session.typeContext) { + containingClass.defaultType().anySuperTypeConstructor { it.typeConstructor() == dispatchReceiverClassLookupTag } + } + if (callableIsDefinitelyMemberOfOuterClass) { return null } } diff --git a/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirBlackBoxCodegenTestGenerated.java b/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirBlackBoxCodegenTestGenerated.java index 6c994ffceb7..6ad61194371 100644 --- a/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirBlackBoxCodegenTestGenerated.java +++ b/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirBlackBoxCodegenTestGenerated.java @@ -4656,6 +4656,12 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT runTest("compiler/testData/codegen/box/callableReference/serializability/noReflect.kt"); } + @Test + @TestMetadata("referenceToCompanionFunction.kt") + public void testReferenceToCompanionFunction() throws Exception { + runTest("compiler/testData/codegen/box/callableReference/serializability/referenceToCompanionFunction.kt"); + } + @Test @TestMetadata("reflectedIsNotSerialized.kt") public void testReflectedIsNotSerialized() throws Exception { diff --git a/compiler/testData/codegen/box/callableReference/serializability/referenceToCompanionFunction.fir.ir.txt b/compiler/testData/codegen/box/callableReference/serializability/referenceToCompanionFunction.fir.ir.txt new file mode 100644 index 00000000000..bd50c4bf0f6 --- /dev/null +++ b/compiler/testData/codegen/box/callableReference/serializability/referenceToCompanionFunction.fir.ir.txt @@ -0,0 +1,156 @@ +FILE fqName: fileName:/referenceToCompanionFunction.kt + CLASS CLASS name:Base modality:ABSTRACT visibility:public superTypes:[kotlin.Any] + $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.Base + CONSTRUCTOR visibility:public <> () returnType:.Base [primary] + BLOCK_BODY + DELEGATING_CONSTRUCTOR_CALL 'public constructor () [primary] declared in kotlin.Any' + INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:Base modality:ABSTRACT visibility:public superTypes:[kotlin.Any]' + FUN name:foo visibility:public modality:FINAL <> ($this:.Base) returnType:kotlin.String + $this: VALUE_PARAMETER name: type:.Base + BLOCK_BODY + RETURN type=kotlin.Nothing from='public final fun foo (): kotlin.String declared in .Base' + CONST String type=kotlin.String value="A" + FUN name:bar visibility:public modality:ABSTRACT <> ($this:.Base) returnType:kotlin.String + $this: VALUE_PARAMETER name: type:.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 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:Some modality:FINAL visibility:public superTypes:[kotlin.Any] + $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.Some + CONSTRUCTOR visibility:public <> () returnType:.Some [primary] + BLOCK_BODY + DELEGATING_CONSTRUCTOR_CALL 'public constructor () [primary] declared in kotlin.Any' + INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:Some modality:FINAL visibility:public superTypes:[kotlin.Any]' + CLASS OBJECT name:Companion modality:FINAL visibility:public [companion] superTypes:[.Base] + $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.Some.Companion + CONSTRUCTOR visibility:private <> () returnType:.Some.Companion [primary] + BLOCK_BODY + DELEGATING_CONSTRUCTOR_CALL 'public constructor () [primary] declared in .Base' + INSTANCE_INITIALIZER_CALL classDescriptor='CLASS OBJECT name:Companion modality:FINAL visibility:public [companion] superTypes:[.Base]' + FUN name:bar visibility:public modality:OPEN <> ($this:.Some.Companion) returnType:kotlin.String + overridden: + public abstract fun bar (): kotlin.String declared in .Base + $this: VALUE_PARAMETER name: type:.Some.Companion + BLOCK_BODY + RETURN type=kotlin.Nothing from='public open fun bar (): kotlin.String declared in .Some.Companion' + CONST String type=kotlin.String value="B" + FUN FAKE_OVERRIDE name:foo visibility:public modality:FINAL <> ($this:.Base) returnType:kotlin.String [fake_override] + overridden: + public final fun foo (): kotlin.String declared in .Base + $this: VALUE_PARAMETER name: type:.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 [fake_override,operator] declared in .Base + $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 .Base + $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 .Base + $this: VALUE_PARAMETER name: 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 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 OBJECT name:Singleton modality:FINAL visibility:public superTypes:[.Base] + $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.Singleton + CONSTRUCTOR visibility:private <> () returnType:.Singleton [primary] + BLOCK_BODY + DELEGATING_CONSTRUCTOR_CALL 'public constructor () [primary] declared in .Base' + INSTANCE_INITIALIZER_CALL classDescriptor='CLASS OBJECT name:Singleton modality:FINAL visibility:public superTypes:[.Base]' + FUN name:bar visibility:public modality:OPEN <> ($this:.Singleton) returnType:kotlin.String + overridden: + public abstract fun bar (): kotlin.String declared in .Base + $this: VALUE_PARAMETER name: type:.Singleton + BLOCK_BODY + RETURN type=kotlin.Nothing from='public open fun bar (): kotlin.String declared in .Singleton' + CONST String type=kotlin.String value="C" + FUN FAKE_OVERRIDE name:foo visibility:public modality:FINAL <> ($this:.Base) returnType:kotlin.String [fake_override] + overridden: + public final fun foo (): kotlin.String declared in .Base + $this: VALUE_PARAMETER name: type:.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 [fake_override,operator] declared in .Base + $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 .Base + $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 .Base + $this: VALUE_PARAMETER name: type:kotlin.Any + FUN name:box visibility:public modality:FINAL <> () returnType:kotlin.String + BLOCK_BODY + VAR name:ref1 type:kotlin.reflect.KFunction0 [val] + FUNCTION_REFERENCE 'public final fun foo (): kotlin.String [fake_override] declared in .Some.Companion' type=kotlin.reflect.KFunction0 origin=null reflectionTarget= + $this: GET_OBJECT 'CLASS OBJECT name:Companion modality:FINAL visibility:public [companion] superTypes:[.Base]' type=.Some.Companion + VAR name:ref2 type:kotlin.reflect.KFunction0 [val] + FUNCTION_REFERENCE 'public open fun bar (): kotlin.String declared in .Some.Companion' type=kotlin.reflect.KFunction0 origin=null reflectionTarget= + $this: GET_OBJECT 'CLASS OBJECT name:Companion modality:FINAL visibility:public [companion] superTypes:[.Base]' type=.Some.Companion + VAR name:ref3 type:kotlin.reflect.KFunction0 [val] + FUNCTION_REFERENCE 'public final fun foo (): kotlin.String [fake_override] declared in .Some.Companion' type=kotlin.reflect.KFunction0 origin=null reflectionTarget= + $this: GET_OBJECT 'CLASS OBJECT name:Companion modality:FINAL visibility:public [companion] superTypes:[.Base]' type=.Some.Companion + VAR name:ref4 type:kotlin.reflect.KFunction0 [val] + FUNCTION_REFERENCE 'public open fun bar (): kotlin.String declared in .Some.Companion' type=kotlin.reflect.KFunction0 origin=null reflectionTarget= + $this: GET_OBJECT 'CLASS OBJECT name:Companion modality:FINAL visibility:public [companion] superTypes:[.Base]' type=.Some.Companion + VAR name:ref5 type:kotlin.reflect.KFunction0 [val] + FUNCTION_REFERENCE 'public final fun foo (): kotlin.String [fake_override] declared in .Singleton' type=kotlin.reflect.KFunction0 origin=null reflectionTarget= + $this: GET_OBJECT 'CLASS OBJECT name:Singleton modality:FINAL visibility:public superTypes:[.Base]' type=.Singleton + VAR name:ref6 type:kotlin.reflect.KFunction0 [val] + FUNCTION_REFERENCE 'public open fun bar (): kotlin.String declared in .Singleton' type=kotlin.reflect.KFunction0 origin=null reflectionTarget= + $this: GET_OBJECT 'CLASS OBJECT name:Singleton modality:FINAL visibility:public superTypes:[.Base]' type=.Singleton + VAR name:result type:kotlin.String [val] + CALL 'public final fun plus (other: kotlin.Any?): kotlin.String [operator] declared in kotlin.String' type=kotlin.String origin=PLUS + $this: CALL 'public final fun plus (other: kotlin.Any?): kotlin.String [operator] declared in kotlin.String' type=kotlin.String origin=PLUS + $this: CALL 'public final fun plus (other: kotlin.Any?): kotlin.String [operator] declared in kotlin.String' type=kotlin.String origin=PLUS + $this: CALL 'public final fun plus (other: kotlin.Any?): kotlin.String [operator] declared in kotlin.String' type=kotlin.String origin=PLUS + $this: CALL 'public final fun plus (other: kotlin.Any?): kotlin.String [operator] declared in kotlin.String' type=kotlin.String origin=PLUS + $this: CALL 'public abstract fun invoke (): R of kotlin.reflect.KFunction0 [operator] declared in kotlin.reflect.KFunction0' type=kotlin.String origin=INVOKE + $this: GET_VAR 'val ref1: kotlin.reflect.KFunction0 [val] declared in .box' type=kotlin.reflect.KFunction0 origin=VARIABLE_AS_FUNCTION + other: CALL 'public abstract fun invoke (): R of kotlin.reflect.KFunction0 [operator] declared in kotlin.reflect.KFunction0' type=kotlin.String origin=INVOKE + $this: GET_VAR 'val ref2: kotlin.reflect.KFunction0 [val] declared in .box' type=kotlin.reflect.KFunction0 origin=VARIABLE_AS_FUNCTION + other: CALL 'public abstract fun invoke (): R of kotlin.reflect.KFunction0 [operator] declared in kotlin.reflect.KFunction0' type=kotlin.String origin=INVOKE + $this: GET_VAR 'val ref3: kotlin.reflect.KFunction0 [val] declared in .box' type=kotlin.reflect.KFunction0 origin=VARIABLE_AS_FUNCTION + other: CALL 'public abstract fun invoke (): R of kotlin.reflect.KFunction0 [operator] declared in kotlin.reflect.KFunction0' type=kotlin.String origin=INVOKE + $this: GET_VAR 'val ref4: kotlin.reflect.KFunction0 [val] declared in .box' type=kotlin.reflect.KFunction0 origin=VARIABLE_AS_FUNCTION + other: CALL 'public abstract fun invoke (): R of kotlin.reflect.KFunction0 [operator] declared in kotlin.reflect.KFunction0' type=kotlin.String origin=INVOKE + $this: GET_VAR 'val ref5: kotlin.reflect.KFunction0 [val] declared in .box' type=kotlin.reflect.KFunction0 origin=VARIABLE_AS_FUNCTION + other: CALL 'public abstract fun invoke (): R of kotlin.reflect.KFunction0 [operator] declared in kotlin.reflect.KFunction0' type=kotlin.String origin=INVOKE + $this: GET_VAR 'val ref6: kotlin.reflect.KFunction0 [val] declared in .box' type=kotlin.reflect.KFunction0 origin=VARIABLE_AS_FUNCTION + RETURN type=kotlin.Nothing from='public final fun box (): kotlin.String declared in ' + WHEN type=kotlin.String origin=IF + BRANCH + if: CALL 'public final fun EQEQ (arg0: kotlin.Any?, arg1: kotlin.Any?): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=EQEQ + arg0: GET_VAR 'val result: kotlin.String [val] declared in .box' type=kotlin.String origin=null + arg1: CONST String type=kotlin.String value="ABABAC" + then: CONST String type=kotlin.String value="OK" + BRANCH + if: CONST Boolean type=kotlin.Boolean value=true + then: STRING_CONCATENATION type=kotlin.String + CONST String type=kotlin.String value="Fail: " + GET_VAR 'val result: kotlin.String [val] declared in .box' type=kotlin.String origin=null diff --git a/compiler/testData/codegen/box/callableReference/serializability/referenceToCompanionFunction.kt b/compiler/testData/codegen/box/callableReference/serializability/referenceToCompanionFunction.kt new file mode 100644 index 00000000000..a98b3fe39ef --- /dev/null +++ b/compiler/testData/codegen/box/callableReference/serializability/referenceToCompanionFunction.kt @@ -0,0 +1,33 @@ +// IGNORE_BACKEND_K1: ANY +// FE 1.0 incorrectly resolves reference `Some::foo` (KT-45315) +// DONT_TARGET_EXACT_BACKEND: WASM +// WASM_MUTE_REASON: Wasm box test does not support disabling only K1 mode with IGNORE_BACKEND directive +// ISSUE: KT-55909 +// DUMP_IR + +abstract class Base { + fun foo(): String = "A" + abstract fun bar(): String +} + +class Some { + companion object : Base() { + override fun bar(): String = "B" + } +} + +// For sanity check +object Singleton : Base() { + override fun bar(): String = "C" +} + +fun box(): String { + val ref1 = Some::foo + val ref2 = Some::bar + val ref3 = Some.Companion::foo + val ref4 = Some.Companion::bar + val ref5 = Singleton::foo + val ref6 = Singleton::bar + val result = ref1() + ref2() + ref3() + ref4() + ref5() + ref6() + return if (result == "ABABAC") "OK" else "Fail: $result" +} diff --git a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/BlackBoxCodegenTestGenerated.java b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/BlackBoxCodegenTestGenerated.java index cd0a80f3ba5..094009909bd 100644 --- a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/BlackBoxCodegenTestGenerated.java +++ b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/BlackBoxCodegenTestGenerated.java @@ -4530,6 +4530,12 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest { runTest("compiler/testData/codegen/box/callableReference/serializability/noReflect.kt"); } + @Test + @TestMetadata("referenceToCompanionFunction.kt") + public void testReferenceToCompanionFunction() throws Exception { + runTest("compiler/testData/codegen/box/callableReference/serializability/referenceToCompanionFunction.kt"); + } + @Test @TestMetadata("reflectedIsNotSerialized.kt") public void testReflectedIsNotSerialized() throws Exception { diff --git a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/IrBlackBoxCodegenTestGenerated.java b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/IrBlackBoxCodegenTestGenerated.java index 3abf90b3763..788a8804696 100644 --- a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/IrBlackBoxCodegenTestGenerated.java +++ b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/IrBlackBoxCodegenTestGenerated.java @@ -4656,6 +4656,12 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes runTest("compiler/testData/codegen/box/callableReference/serializability/noReflect.kt"); } + @Test + @TestMetadata("referenceToCompanionFunction.kt") + public void testReferenceToCompanionFunction() throws Exception { + runTest("compiler/testData/codegen/box/callableReference/serializability/referenceToCompanionFunction.kt"); + } + @Test @TestMetadata("reflectedIsNotSerialized.kt") public void testReflectedIsNotSerialized() throws Exception { diff --git a/compiler/tests-gen/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java b/compiler/tests-gen/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java index da7d4e88743..fb2502f53d1 100644 --- a/compiler/tests-gen/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java +++ b/compiler/tests-gen/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java @@ -3952,6 +3952,11 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes runTest("compiler/testData/codegen/box/callableReference/serializability/noReflect.kt"); } + @TestMetadata("referenceToCompanionFunction.kt") + public void testReferenceToCompanionFunction() throws Exception { + runTest("compiler/testData/codegen/box/callableReference/serializability/referenceToCompanionFunction.kt"); + } + @TestMetadata("reflectedIsNotSerialized.kt") public void testReflectedIsNotSerialized() throws Exception { runTest("compiler/testData/codegen/box/callableReference/serializability/reflectedIsNotSerialized.kt"); diff --git a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/JsCodegenBoxTestGenerated.java b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/JsCodegenBoxTestGenerated.java index 40a39ad6017..ceae145f63e 100644 --- a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/JsCodegenBoxTestGenerated.java +++ b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/JsCodegenBoxTestGenerated.java @@ -3293,6 +3293,12 @@ public class JsCodegenBoxTestGenerated extends AbstractJsCodegenBoxTest { public void testAllFilesPresentInSerializability() throws Exception { KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/callableReference/serializability"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS, true); } + + @Test + @TestMetadata("referenceToCompanionFunction.kt") + public void testReferenceToCompanionFunction() throws Exception { + runTest("compiler/testData/codegen/box/callableReference/serializability/referenceToCompanionFunction.kt"); + } } } diff --git a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/fir/FirJsCodegenBoxTestGenerated.java b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/fir/FirJsCodegenBoxTestGenerated.java index 348809c0936..2768f36f276 100644 --- a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/fir/FirJsCodegenBoxTestGenerated.java +++ b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/fir/FirJsCodegenBoxTestGenerated.java @@ -3347,6 +3347,12 @@ public class FirJsCodegenBoxTestGenerated extends AbstractFirJsCodegenBoxTest { public void testAllFilesPresentInSerializability() throws Exception { KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/callableReference/serializability"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS_IR, true); } + + @Test + @TestMetadata("referenceToCompanionFunction.kt") + public void testReferenceToCompanionFunction() throws Exception { + runTest("compiler/testData/codegen/box/callableReference/serializability/referenceToCompanionFunction.kt"); + } } } diff --git a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/ir/IrJsCodegenBoxTestGenerated.java b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/ir/IrJsCodegenBoxTestGenerated.java index fe2be8533f4..2739dd9ae4d 100644 --- a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/ir/IrJsCodegenBoxTestGenerated.java +++ b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/ir/IrJsCodegenBoxTestGenerated.java @@ -3347,6 +3347,12 @@ public class IrJsCodegenBoxTestGenerated extends AbstractIrJsCodegenBoxTest { public void testAllFilesPresentInSerializability() throws Exception { KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/callableReference/serializability"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS_IR, true); } + + @Test + @TestMetadata("referenceToCompanionFunction.kt") + public void testReferenceToCompanionFunction() throws Exception { + runTest("compiler/testData/codegen/box/callableReference/serializability/referenceToCompanionFunction.kt"); + } } } diff --git a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/ir/IrJsES6CodegenBoxTestGenerated.java b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/ir/IrJsES6CodegenBoxTestGenerated.java index e5ac302ab10..ef2641db658 100644 --- a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/ir/IrJsES6CodegenBoxTestGenerated.java +++ b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/ir/IrJsES6CodegenBoxTestGenerated.java @@ -3347,6 +3347,12 @@ public class IrJsES6CodegenBoxTestGenerated extends AbstractIrJsES6CodegenBoxTes public void testAllFilesPresentInSerializability() throws Exception { KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/callableReference/serializability"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS_IR_ES6, true); } + + @Test + @TestMetadata("referenceToCompanionFunction.kt") + public void testReferenceToCompanionFunction() throws Exception { + runTest("compiler/testData/codegen/box/callableReference/serializability/referenceToCompanionFunction.kt"); + } } } diff --git a/native/native.tests/tests-gen/org/jetbrains/kotlin/konan/blackboxtest/K2NativeCodegenBoxTestGenerated.java b/native/native.tests/tests-gen/org/jetbrains/kotlin/konan/blackboxtest/K2NativeCodegenBoxTestGenerated.java index f154bf62590..553fb7347a3 100644 --- a/native/native.tests/tests-gen/org/jetbrains/kotlin/konan/blackboxtest/K2NativeCodegenBoxTestGenerated.java +++ b/native/native.tests/tests-gen/org/jetbrains/kotlin/konan/blackboxtest/K2NativeCodegenBoxTestGenerated.java @@ -3457,6 +3457,12 @@ public class K2NativeCodegenBoxTestGenerated extends AbstractNativeCodegenBoxTes public void testAllFilesPresentInSerializability() throws Exception { KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/callableReference/serializability"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.NATIVE, true); } + + @Test + @TestMetadata("referenceToCompanionFunction.kt") + public void testReferenceToCompanionFunction() throws Exception { + runTest("compiler/testData/codegen/box/callableReference/serializability/referenceToCompanionFunction.kt"); + } } } diff --git a/native/native.tests/tests-gen/org/jetbrains/kotlin/konan/blackboxtest/NativeCodegenBoxTestGenerated.java b/native/native.tests/tests-gen/org/jetbrains/kotlin/konan/blackboxtest/NativeCodegenBoxTestGenerated.java index 96d85f50e80..7ded8a695e5 100644 --- a/native/native.tests/tests-gen/org/jetbrains/kotlin/konan/blackboxtest/NativeCodegenBoxTestGenerated.java +++ b/native/native.tests/tests-gen/org/jetbrains/kotlin/konan/blackboxtest/NativeCodegenBoxTestGenerated.java @@ -3419,6 +3419,12 @@ public class NativeCodegenBoxTestGenerated extends AbstractNativeCodegenBoxTest public void testAllFilesPresentInSerializability() throws Exception { KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/callableReference/serializability"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.NATIVE, true); } + + @Test + @TestMetadata("referenceToCompanionFunction.kt") + public void testReferenceToCompanionFunction() throws Exception { + runTest("compiler/testData/codegen/box/callableReference/serializability/referenceToCompanionFunction.kt"); + } } }