From 6479b15e461e2294f2e5166395743cf43b20f617 Mon Sep 17 00:00:00 2001 From: Dmitriy Novozhilov Date: Thu, 22 Feb 2024 10:04:59 +0200 Subject: [PATCH] [Test] Add regression test for KT-65493 --- .../FirLightTreeJvmIrTextTestGenerated.java | 6 +++ .../ir/FirPsiJvmIrTextTestGenerated.java | 6 +++ .../intersectionWithRawType.ir.txt | 45 +++++++++++++++++++ .../fakeOverrides/intersectionWithRawType.kt | 18 ++++++++ .../intersectionWithRawType.kt.txt | 13 ++++++ .../intersectionWithRawType.sig.kt.txt | 29 ++++++++++++ .../ir/ClassicJvmIrTextTestGenerated.java | 6 +++ 7 files changed, 123 insertions(+) create mode 100644 compiler/testData/ir/irText/fakeOverrides/intersectionWithRawType.ir.txt create mode 100644 compiler/testData/ir/irText/fakeOverrides/intersectionWithRawType.kt create mode 100644 compiler/testData/ir/irText/fakeOverrides/intersectionWithRawType.kt.txt create mode 100644 compiler/testData/ir/irText/fakeOverrides/intersectionWithRawType.sig.kt.txt 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 b87222575dc..037b0cb71e2 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 @@ -2721,6 +2721,12 @@ public class FirLightTreeJvmIrTextTestGenerated extends AbstractFirLightTreeJvmI public void testIntersectionWithMappedSignature() { runTest("compiler/testData/ir/irText/fakeOverrides/intersectionWithMappedSignature.kt"); } + + @Test + @TestMetadata("intersectionWithRawType.kt") + public void testIntersectionWithRawType() { + runTest("compiler/testData/ir/irText/fakeOverrides/intersectionWithRawType.kt"); + } } @Nested 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 2f189ced5ea..f916e388863 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 @@ -2721,6 +2721,12 @@ public class FirPsiJvmIrTextTestGenerated extends AbstractFirPsiJvmIrTextTest { public void testIntersectionWithMappedSignature() { runTest("compiler/testData/ir/irText/fakeOverrides/intersectionWithMappedSignature.kt"); } + + @Test + @TestMetadata("intersectionWithRawType.kt") + public void testIntersectionWithRawType() { + runTest("compiler/testData/ir/irText/fakeOverrides/intersectionWithRawType.kt"); + } } @Nested diff --git a/compiler/testData/ir/irText/fakeOverrides/intersectionWithRawType.ir.txt b/compiler/testData/ir/irText/fakeOverrides/intersectionWithRawType.ir.txt new file mode 100644 index 00000000000..e9f3b159e70 --- /dev/null +++ b/compiler/testData/ir/irText/fakeOverrides/intersectionWithRawType.ir.txt @@ -0,0 +1,45 @@ +FILE fqName: fileName:/main.kt + CLASS CLASS name:Derived modality:ABSTRACT visibility:public superTypes:[.JavaBase; .KotlinInterface] + $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.Derived + CONSTRUCTOR visibility:public <> () returnType:.Derived [primary] + BLOCK_BODY + DELEGATING_CONSTRUCTOR_CALL 'public constructor () declared in .JavaBase' + INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:Derived modality:ABSTRACT visibility:public superTypes:[.JavaBase; .KotlinInterface]' + FUN FAKE_OVERRIDE name:bar visibility:public modality:OPEN <> ($this:.KotlinInterface) returnType:kotlin.collections.List [fake_override] + overridden: + public open fun bar (): @[FlexibleNullability] @[FlexibleMutability] @[RawType] kotlin.collections.MutableList? declared in .JavaBase + public abstract fun bar (): kotlin.collections.List declared in .KotlinInterface + $this: VALUE_PARAMETER name: type:.KotlinInterface + FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator] + overridden: + public open fun equals (other: kotlin.Any?): kotlin.Boolean declared in .JavaBase + public open fun equals (other: kotlin.Any?): kotlin.Boolean declared in .KotlinInterface + $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 .JavaBase + public open fun hashCode (): kotlin.Int declared in .KotlinInterface + $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 .JavaBase + public open fun toString (): kotlin.String declared in .KotlinInterface + $this: VALUE_PARAMETER name: type:kotlin.Any + CLASS INTERFACE name:KotlinInterface modality:ABSTRACT visibility:public superTypes:[kotlin.Any] + $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.KotlinInterface + FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator] + overridden: + public open fun equals (other: kotlin.Any?): kotlin.Boolean declared in kotlin.Any + $this: VALUE_PARAMETER name: 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 + FUN name:bar visibility:public modality:ABSTRACT <> ($this:.KotlinInterface) returnType:kotlin.collections.List + $this: VALUE_PARAMETER name: type:.KotlinInterface diff --git a/compiler/testData/ir/irText/fakeOverrides/intersectionWithRawType.kt b/compiler/testData/ir/irText/fakeOverrides/intersectionWithRawType.kt new file mode 100644 index 00000000000..5eb94e78aa0 --- /dev/null +++ b/compiler/testData/ir/irText/fakeOverrides/intersectionWithRawType.kt @@ -0,0 +1,18 @@ +// FIR_IDENTICAL +// ENABLE_IR_FAKE_OVERRIDE_GENERATION +// TARGET_BACKEND: JVM_IR +// ISSUE: KT-65493 + +// FILE: JavaBase.java +import java.util.*; + +public class JavaBase { + public List bar() { return null; }; +} + +// FILE: main.kt +interface KotlinInterface { + fun bar(): List +} + +abstract class Derived: JavaBase(), KotlinInterface diff --git a/compiler/testData/ir/irText/fakeOverrides/intersectionWithRawType.kt.txt b/compiler/testData/ir/irText/fakeOverrides/intersectionWithRawType.kt.txt new file mode 100644 index 00000000000..7edb91518fe --- /dev/null +++ b/compiler/testData/ir/irText/fakeOverrides/intersectionWithRawType.kt.txt @@ -0,0 +1,13 @@ +abstract class Derived : JavaBase, KotlinInterface { + constructor() /* primary */ { + super/*JavaBase*/() + /* () */ + + } + +} + +interface KotlinInterface { + abstract fun bar(): List + +} diff --git a/compiler/testData/ir/irText/fakeOverrides/intersectionWithRawType.sig.kt.txt b/compiler/testData/ir/irText/fakeOverrides/intersectionWithRawType.sig.kt.txt new file mode 100644 index 00000000000..5e07ce9a4fe --- /dev/null +++ b/compiler/testData/ir/irText/fakeOverrides/intersectionWithRawType.sig.kt.txt @@ -0,0 +1,29 @@ +// CHECK: +// Mangled name: Derived +// Public signature: /Derived|null[0] +abstract class Derived : JavaBase, KotlinInterface { + // CHECK: + // Mangled name: Derived#(){} + // Public signature: /Derived.|-5645683436151566731[0] + // Public signature debug description: (){} + constructor() /* primary */ + + // CHECK JVM_IR: + // Mangled name: Derived#bar(){}kotlin.collections.List + // Public signature: /Derived.bar|7957968205035256403[0] + // Public signature debug description: bar(){}kotlin.collections.List + /* fake */ override fun bar(): List + +} + +// CHECK: +// Mangled name: KotlinInterface +// Public signature: /KotlinInterface|null[0] +interface KotlinInterface { + // CHECK JVM_IR: + // Mangled name: KotlinInterface#bar(){}kotlin.collections.List + // Public signature: /KotlinInterface.bar|7957968205035256403[0] + // Public signature debug description: bar(){}kotlin.collections.List + abstract fun bar(): List + +} 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 f86c0ff387a..033a8ff2ecd 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 @@ -2721,6 +2721,12 @@ public class ClassicJvmIrTextTestGenerated extends AbstractClassicJvmIrTextTest public void testIntersectionWithMappedSignature() { runTest("compiler/testData/ir/irText/fakeOverrides/intersectionWithMappedSignature.kt"); } + + @Test + @TestMetadata("intersectionWithRawType.kt") + public void testIntersectionWithRawType() { + runTest("compiler/testData/ir/irText/fakeOverrides/intersectionWithRawType.kt"); + } } @Nested