From 9302c8c14db13375c3416b10d8ae995238486dc7 Mon Sep 17 00:00:00 2001 From: Dmitriy Novozhilov Date: Fri, 16 Feb 2024 09:36:47 +0200 Subject: [PATCH] [Test] Reproduce KT-65207 --- .../based/LLFirNativeTestGenerated.java | 18 ++++++ .../LLFirReversedNativeTestGenerated.java | 18 ++++++ .../FirLightTreeJvmIrTextTestGenerated.java | 6 ++ .../ir/FirPsiJvmIrTextTestGenerated.java | 6 ++ .../intersectionWithJava.fir.ir.txt | 55 +++++++++++++++++++ .../intersectionWithJava.fir.kt.txt | 16 ++++++ .../fakeOverrides/intersectionWithJava.ir.txt | 55 +++++++++++++++++++ .../fakeOverrides/intersectionWithJava.kt | 23 ++++++++ .../fakeOverrides/intersectionWithJava.kt.txt | 16 ++++++ .../intersectionWithJava.sig.kt.txt | 42 ++++++++++++++ .../ir/ClassicJvmIrTextTestGenerated.java | 6 ++ 11 files changed, 261 insertions(+) create mode 100644 compiler/testData/ir/irText/fakeOverrides/intersectionWithJava.fir.ir.txt create mode 100644 compiler/testData/ir/irText/fakeOverrides/intersectionWithJava.fir.kt.txt create mode 100644 compiler/testData/ir/irText/fakeOverrides/intersectionWithJava.ir.txt create mode 100644 compiler/testData/ir/irText/fakeOverrides/intersectionWithJava.kt create mode 100644 compiler/testData/ir/irText/fakeOverrides/intersectionWithJava.kt.txt create mode 100644 compiler/testData/ir/irText/fakeOverrides/intersectionWithJava.sig.kt.txt diff --git a/analysis/low-level-api-fir/low-level-api-fir-native/tests-gen/org/jetbrains/kotlin/analysis/low/level/api/fir/konan/compiler/based/LLFirNativeTestGenerated.java b/analysis/low-level-api-fir/low-level-api-fir-native/tests-gen/org/jetbrains/kotlin/analysis/low/level/api/fir/konan/compiler/based/LLFirNativeTestGenerated.java index 34efe2635bf..6d9fcd768d2 100644 --- a/analysis/low-level-api-fir/low-level-api-fir-native/tests-gen/org/jetbrains/kotlin/analysis/low/level/api/fir/konan/compiler/based/LLFirNativeTestGenerated.java +++ b/analysis/low-level-api-fir/low-level-api-fir-native/tests-gen/org/jetbrains/kotlin/analysis/low/level/api/fir/konan/compiler/based/LLFirNativeTestGenerated.java @@ -110,6 +110,24 @@ public class LLFirNativeTestGenerated extends AbstractLLFirNativeTest { runTest("compiler/testData/diagnostics/nativeTests/objCName5.kt"); } + @Test + @TestMetadata("objCName6.kt") + public void testObjCName6() { + runTest("compiler/testData/diagnostics/nativeTests/objCName6.kt"); + } + + @Test + @TestMetadata("objCNameWIthDifferentSwiftName.kt") + public void testObjCNameWIthDifferentSwiftName() { + runTest("compiler/testData/diagnostics/nativeTests/objCNameWIthDifferentSwiftName.kt"); + } + + @Test + @TestMetadata("objCNameWithTwoModules.kt") + public void testObjCNameWithTwoModules() { + runTest("compiler/testData/diagnostics/nativeTests/objCNameWithTwoModules.kt"); + } + @Test @TestMetadata("objCRefinement.kt") public void testObjCRefinement() { diff --git a/analysis/low-level-api-fir/low-level-api-fir-native/tests-gen/org/jetbrains/kotlin/analysis/low/level/api/fir/konan/compiler/based/LLFirReversedNativeTestGenerated.java b/analysis/low-level-api-fir/low-level-api-fir-native/tests-gen/org/jetbrains/kotlin/analysis/low/level/api/fir/konan/compiler/based/LLFirReversedNativeTestGenerated.java index 266ff21dfad..f78db0bc3cf 100644 --- a/analysis/low-level-api-fir/low-level-api-fir-native/tests-gen/org/jetbrains/kotlin/analysis/low/level/api/fir/konan/compiler/based/LLFirReversedNativeTestGenerated.java +++ b/analysis/low-level-api-fir/low-level-api-fir-native/tests-gen/org/jetbrains/kotlin/analysis/low/level/api/fir/konan/compiler/based/LLFirReversedNativeTestGenerated.java @@ -110,6 +110,24 @@ public class LLFirReversedNativeTestGenerated extends AbstractLLFirReversedNativ runTest("compiler/testData/diagnostics/nativeTests/objCName5.kt"); } + @Test + @TestMetadata("objCName6.kt") + public void testObjCName6() { + runTest("compiler/testData/diagnostics/nativeTests/objCName6.kt"); + } + + @Test + @TestMetadata("objCNameWIthDifferentSwiftName.kt") + public void testObjCNameWIthDifferentSwiftName() { + runTest("compiler/testData/diagnostics/nativeTests/objCNameWIthDifferentSwiftName.kt"); + } + + @Test + @TestMetadata("objCNameWithTwoModules.kt") + public void testObjCNameWithTwoModules() { + runTest("compiler/testData/diagnostics/nativeTests/objCNameWithTwoModules.kt"); + } + @Test @TestMetadata("objCRefinement.kt") public void testObjCRefinement() { 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 726d78318bb..6383e13816d 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 @@ -2704,6 +2704,12 @@ public class FirLightTreeJvmIrTextTestGenerated extends AbstractFirLightTreeJvmI runTest("compiler/testData/ir/irText/fakeOverrides/fakeOverrideOfRawJavaCollection.kt"); } + @Test + @TestMetadata("intersectionWithJava.kt") + public void testIntersectionWithJava() { + runTest("compiler/testData/ir/irText/fakeOverrides/intersectionWithJava.kt"); + } + @Test @TestMetadata("intersectionWithMappedSignature.kt") public void testIntersectionWithMappedSignature() { 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 a517be3c6dc..6e5eecf37f4 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 @@ -2704,6 +2704,12 @@ public class FirPsiJvmIrTextTestGenerated extends AbstractFirPsiJvmIrTextTest { runTest("compiler/testData/ir/irText/fakeOverrides/fakeOverrideOfRawJavaCollection.kt"); } + @Test + @TestMetadata("intersectionWithJava.kt") + public void testIntersectionWithJava() { + runTest("compiler/testData/ir/irText/fakeOverrides/intersectionWithJava.kt"); + } + @Test @TestMetadata("intersectionWithMappedSignature.kt") public void testIntersectionWithMappedSignature() { diff --git a/compiler/testData/ir/irText/fakeOverrides/intersectionWithJava.fir.ir.txt b/compiler/testData/ir/irText/fakeOverrides/intersectionWithJava.fir.ir.txt new file mode 100644 index 00000000000..c3caabf2607 --- /dev/null +++ b/compiler/testData/ir/irText/fakeOverrides/intersectionWithJava.fir.ir.txt @@ -0,0 +1,55 @@ +FILE fqName: fileName:/1.kt + CLASS CLASS name:C modality:ABSTRACT visibility:public superTypes:[.Java1.C>; .KotlinInterface.C>] + $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.C.C> + TYPE_PARAMETER name:R index:0 variance: superTypes:[kotlin.Any?] reified:false + CONSTRUCTOR visibility:public <> () returnType:.C.C> [primary] + BLOCK_BODY + DELEGATING_CONSTRUCTOR_CALL 'public constructor () declared in .Java1' + : R of .C + INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:C modality:ABSTRACT visibility:public superTypes:[.Java1.C>; .KotlinInterface.C>]' + FUN FAKE_OVERRIDE name:bar visibility:public modality:OPEN <> ($this:.Java1.C>) returnType:@[FlexibleNullability] java.util.ArrayList<@[FlexibleNullability] kotlin.Int?>? [fake_override] + overridden: + public open fun bar (): @[FlexibleNullability] java.util.ArrayList<@[FlexibleNullability] kotlin.Int?>? declared in .Java1 + public abstract fun bar (): java.util.ArrayList declared in .KotlinInterface + $this: VALUE_PARAMETER name: type:.Java1.C> + 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 .Java1 + 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:foo visibility:public modality:OPEN <> ($this:.Java1.C>) returnType:@[FlexibleNullability] R of .C? [fake_override] + overridden: + public open fun foo (): @[FlexibleNullability] T of .Java1? declared in .Java1 + public abstract fun foo (): T of .KotlinInterface declared in .KotlinInterface + $this: VALUE_PARAMETER name: type:.Java1.C> + 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 .Java1 + 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 .Java1 + 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.KotlinInterface> + TYPE_PARAMETER name:T index:0 variance: superTypes:[kotlin.Any?] reified:false + 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.KotlinInterface>) returnType:java.util.ArrayList + $this: VALUE_PARAMETER name: type:.KotlinInterface.KotlinInterface> + FUN name:foo visibility:public modality:ABSTRACT <> ($this:.KotlinInterface.KotlinInterface>) returnType:T of .KotlinInterface + $this: VALUE_PARAMETER name: type:.KotlinInterface.KotlinInterface> diff --git a/compiler/testData/ir/irText/fakeOverrides/intersectionWithJava.fir.kt.txt b/compiler/testData/ir/irText/fakeOverrides/intersectionWithJava.fir.kt.txt new file mode 100644 index 00000000000..744b76d6d14 --- /dev/null +++ b/compiler/testData/ir/irText/fakeOverrides/intersectionWithJava.fir.kt.txt @@ -0,0 +1,16 @@ +abstract class C : Java1, KotlinInterface { + constructor() /* primary */ { + super/*Java1*/() + /* () */ + + } + +} + +interface KotlinInterface { + abstract fun bar(): ArrayList + + abstract fun foo(): T + +} + diff --git a/compiler/testData/ir/irText/fakeOverrides/intersectionWithJava.ir.txt b/compiler/testData/ir/irText/fakeOverrides/intersectionWithJava.ir.txt new file mode 100644 index 00000000000..1861dd88711 --- /dev/null +++ b/compiler/testData/ir/irText/fakeOverrides/intersectionWithJava.ir.txt @@ -0,0 +1,55 @@ +FILE fqName: fileName:/1.kt + CLASS CLASS name:C modality:ABSTRACT visibility:public superTypes:[.Java1.C>; .KotlinInterface.C>] + $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.C.C> + TYPE_PARAMETER name:R index:0 variance: superTypes:[kotlin.Any?] reified:false + CONSTRUCTOR visibility:public <> () returnType:.C.C> [primary] + BLOCK_BODY + DELEGATING_CONSTRUCTOR_CALL 'public constructor () declared in .Java1' + : @[FlexibleNullability] R of .C? + INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:C modality:ABSTRACT visibility:public superTypes:[.Java1.C>; .KotlinInterface.C>]' + FUN FAKE_OVERRIDE name:bar visibility:public modality:OPEN <> ($this:.KotlinInterface.C>) returnType:java.util.ArrayList [fake_override] + overridden: + public open fun bar (): @[FlexibleNullability] java.util.ArrayList<@[FlexibleNullability] kotlin.Int?>? declared in .Java1 + public abstract fun bar (): java.util.ArrayList declared in .KotlinInterface + $this: VALUE_PARAMETER name: type:.KotlinInterface.C> + 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 .Java1 + 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:foo visibility:public modality:OPEN <> ($this:.KotlinInterface.C>) returnType:R of .C [fake_override] + overridden: + public open fun foo (): @[FlexibleNullability] T of .Java1? declared in .Java1 + public abstract fun foo (): T of .KotlinInterface declared in .KotlinInterface + $this: VALUE_PARAMETER name: type:.KotlinInterface.C> + 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 .Java1 + 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 .Java1 + 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.KotlinInterface> + TYPE_PARAMETER name:T index:0 variance: superTypes:[kotlin.Any?] reified:false + 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.KotlinInterface>) returnType:java.util.ArrayList + $this: VALUE_PARAMETER name: type:.KotlinInterface.KotlinInterface> + FUN name:foo visibility:public modality:ABSTRACT <> ($this:.KotlinInterface.KotlinInterface>) returnType:T of .KotlinInterface + $this: VALUE_PARAMETER name: type:.KotlinInterface.KotlinInterface> diff --git a/compiler/testData/ir/irText/fakeOverrides/intersectionWithJava.kt b/compiler/testData/ir/irText/fakeOverrides/intersectionWithJava.kt new file mode 100644 index 00000000000..ba57f157326 --- /dev/null +++ b/compiler/testData/ir/irText/fakeOverrides/intersectionWithJava.kt @@ -0,0 +1,23 @@ +// TARGET_BACKEND: JVM +// ENABLE_IR_FAKE_OVERRIDE_GENERATION +// ISSUE: KT-65207 + +// FILE: Java1.java +import java.util.ArrayList; + +public class Java1 { + public T foo() { + return null; + } + public ArrayList bar() { + return null; + }; +} + +// FILE: 1.kt +abstract class C : Java1(), KotlinInterface + +interface KotlinInterface { + fun foo(): T + fun bar(): ArrayList +} diff --git a/compiler/testData/ir/irText/fakeOverrides/intersectionWithJava.kt.txt b/compiler/testData/ir/irText/fakeOverrides/intersectionWithJava.kt.txt new file mode 100644 index 00000000000..a592ec29169 --- /dev/null +++ b/compiler/testData/ir/irText/fakeOverrides/intersectionWithJava.kt.txt @@ -0,0 +1,16 @@ +abstract class C : Java1, KotlinInterface { + constructor() /* primary */ { + super/*Java1*/<@FlexibleNullability R?>() + /* () */ + + } + +} + +interface KotlinInterface { + abstract fun bar(): ArrayList + + abstract fun foo(): T + +} + diff --git a/compiler/testData/ir/irText/fakeOverrides/intersectionWithJava.sig.kt.txt b/compiler/testData/ir/irText/fakeOverrides/intersectionWithJava.sig.kt.txt new file mode 100644 index 00000000000..b9eeddd8e7e --- /dev/null +++ b/compiler/testData/ir/irText/fakeOverrides/intersectionWithJava.sig.kt.txt @@ -0,0 +1,42 @@ +// CHECK: +// Mangled name: C +// Public signature: /C|null[0] +abstract class C : Java1, KotlinInterface { + // CHECK: + // Mangled name: C#(){} + // Public signature: /C.|-5645683436151566731[0] + // Public signature debug description: (){} + constructor() /* primary */ + + // CHECK JVM_IR: + // Mangled name: C#bar(){}java.util.ArrayList? + // Public signature: /C.bar|6344786471503787921[0] + // Public signature debug description: bar(){}java.util.ArrayList? + /* fake */ override fun bar(): ArrayList? + + // CHECK JVM_IR: + // Mangled name: C#foo(){}1:0? + // Public signature: /C.foo|-1179576840814333363[0] + // Public signature debug description: foo(){}1:0? + /* fake */ override fun foo(): R? + +} + +// CHECK: +// Mangled name: KotlinInterface +// Public signature: /KotlinInterface|null[0] +interface KotlinInterface { + // CHECK JVM_IR: + // Mangled name: KotlinInterface#bar(){}java.util.ArrayList + // Public signature: /KotlinInterface.bar|3123552224271008170[0] + // Public signature debug description: bar(){}java.util.ArrayList + abstract fun bar(): ArrayList + + // CHECK JVM_IR: + // Mangled name: KotlinInterface#foo(){}1:0 + // Public signature: /KotlinInterface.foo|-5478580208809996038[0] + // Public signature debug description: foo(){}1:0 + abstract fun foo(): T + +} + 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 349c0f7ecd6..37c27e4db80 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 @@ -2704,6 +2704,12 @@ public class ClassicJvmIrTextTestGenerated extends AbstractClassicJvmIrTextTest runTest("compiler/testData/ir/irText/fakeOverrides/fakeOverrideOfRawJavaCollection.kt"); } + @Test + @TestMetadata("intersectionWithJava.kt") + public void testIntersectionWithJava() { + runTest("compiler/testData/ir/irText/fakeOverrides/intersectionWithJava.kt"); + } + @Test @TestMetadata("intersectionWithMappedSignature.kt") public void testIntersectionWithMappedSignature() {