[Test] Add regression test for KT-65493

This commit is contained in:
Dmitriy Novozhilov
2024-02-22 10:04:59 +02:00
committed by Space Team
parent 35b172c40f
commit 6479b15e46
7 changed files with 123 additions and 0 deletions
@@ -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
@@ -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
@@ -0,0 +1,45 @@
FILE fqName:<root> fileName:/main.kt
CLASS CLASS name:Derived modality:ABSTRACT visibility:public superTypes:[<root>.JavaBase; <root>.KotlinInterface]
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.Derived
CONSTRUCTOR visibility:public <> () returnType:<root>.Derived [primary]
BLOCK_BODY
DELEGATING_CONSTRUCTOR_CALL 'public constructor <init> () declared in <root>.JavaBase'
INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:Derived modality:ABSTRACT visibility:public superTypes:[<root>.JavaBase; <root>.KotlinInterface]'
FUN FAKE_OVERRIDE name:bar visibility:public modality:OPEN <> ($this:<root>.KotlinInterface) returnType:kotlin.collections.List<kotlin.Any?> [fake_override]
overridden:
public open fun bar (): @[FlexibleNullability] @[FlexibleMutability] @[RawType] kotlin.collections.MutableList<kotlin.Any?>? declared in <root>.JavaBase
public abstract fun bar (): kotlin.collections.List<kotlin.Any?> declared in <root>.KotlinInterface
$this: VALUE_PARAMETER name:<this> type:<root>.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 <root>.JavaBase
public open fun equals (other: kotlin.Any?): kotlin.Boolean declared in <root>.KotlinInterface
$this: VALUE_PARAMETER name:<this> 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 <root>.JavaBase
public open fun hashCode (): kotlin.Int declared in <root>.KotlinInterface
$this: VALUE_PARAMETER 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 <root>.JavaBase
public open fun toString (): kotlin.String declared in <root>.KotlinInterface
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
CLASS INTERFACE name:KotlinInterface modality:ABSTRACT visibility:public superTypes:[kotlin.Any]
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.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:<this> 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:<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 name:<this> type:kotlin.Any
FUN name:bar visibility:public modality:ABSTRACT <> ($this:<root>.KotlinInterface) returnType:kotlin.collections.List<kotlin.Any?>
$this: VALUE_PARAMETER name:<this> type:<root>.KotlinInterface
@@ -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<Any?>
}
abstract class Derived: JavaBase(), KotlinInterface
@@ -0,0 +1,13 @@
abstract class Derived : JavaBase, KotlinInterface {
constructor() /* primary */ {
super/*JavaBase*/()
/* <init>() */
}
}
interface KotlinInterface {
abstract fun bar(): List<Any?>
}
@@ -0,0 +1,29 @@
// CHECK:
// Mangled name: Derived
// Public signature: /Derived|null[0]
abstract class Derived : JavaBase, KotlinInterface {
// CHECK:
// Mangled name: Derived#<init>(){}
// Public signature: /Derived.<init>|-5645683436151566731[0]
// Public signature debug description: <init>(){}
constructor() /* primary */
// CHECK JVM_IR:
// Mangled name: Derived#bar(){}kotlin.collections.List<kotlin.Any?>
// Public signature: /Derived.bar|7957968205035256403[0]
// Public signature debug description: bar(){}kotlin.collections.List<kotlin.Any?>
/* fake */ override fun bar(): List<Any?>
}
// CHECK:
// Mangled name: KotlinInterface
// Public signature: /KotlinInterface|null[0]
interface KotlinInterface {
// CHECK JVM_IR:
// Mangled name: KotlinInterface#bar(){}kotlin.collections.List<kotlin.Any?>
// Public signature: /KotlinInterface.bar|7957968205035256403[0]
// Public signature debug description: bar(){}kotlin.collections.List<kotlin.Any?>
abstract fun bar(): List<Any?>
}
@@ -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