[Test] KT-61360: add tests for the IrFakeOverrideBuilder

Add tests for fake overrides with focus on java interoperability

Co-authored-by: Aleksandra Arsenteva <aleksandra.arsenteva@jetbrains.com>
This commit is contained in:
anzhela.sukhanova
2024-01-19 18:22:17 +02:00
committed by Space Team
parent 30aae741a6
commit 82255d5ee8
853 changed files with 269404 additions and 0 deletions
@@ -0,0 +1,262 @@
FILE fqName:<root> fileName:/1.kt
CLASS CLASS name:A modality:FINAL visibility:public superTypes:[<root>.Java1]
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.A
CONSTRUCTOR visibility:public <> () returnType:<root>.A [primary]
BLOCK_BODY
DELEGATING_CONSTRUCTOR_CALL 'public constructor <init> () declared in <root>.Java1'
INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:A modality:FINAL visibility:public superTypes:[<root>.Java1]'
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>.Java1
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
VALUE_PARAMETER name:other index:0 type:kotlin.Any?
FUN FAKE_OVERRIDE name:foo visibility:public modality:OPEN <> ($this:<root>.Java1) returnType:kotlin.Unit [fake_override]
overridden:
public open fun foo (): kotlin.Unit declared in <root>.Java1
$this: VALUE_PARAMETER name:<this> type:<root>.Java1
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>.Java1
$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>.Java1
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
CLASS CLASS name:B modality:FINAL visibility:public superTypes:[<root>.Java1]
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.B
CONSTRUCTOR visibility:public <> () returnType:<root>.B [primary]
BLOCK_BODY
DELEGATING_CONSTRUCTOR_CALL 'public constructor <init> () declared in <root>.Java1'
INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:B modality:FINAL visibility:public superTypes:[<root>.Java1]'
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>.Java1
$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>.Java1
$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>.Java1
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
FUN name:foo visibility:public modality:OPEN <> ($this:<root>.B) returnType:kotlin.Unit
overridden:
public open fun foo (): kotlin.Unit declared in <root>.Java1
$this: VALUE_PARAMETER name:<this> type:<root>.B
BLOCK_BODY
CLASS CLASS name:C modality:FINAL visibility:public superTypes:[<root>.Java2]
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.C
CONSTRUCTOR visibility:public <> () returnType:<root>.C [primary]
BLOCK_BODY
DELEGATING_CONSTRUCTOR_CALL 'public constructor <init> () declared in <root>.Java2'
INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:C modality:FINAL visibility:public superTypes:[<root>.Java2]'
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>.Java2
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
VALUE_PARAMETER name:other index:0 type:kotlin.Any?
FUN FAKE_OVERRIDE name:foo visibility:public modality:OPEN <> ($this:<root>.Java1) returnType:kotlin.Unit [fake_override]
overridden:
public open fun foo (): kotlin.Unit declared in <root>.Java2
$this: VALUE_PARAMETER name:<this> type:<root>.Java1
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>.Java2
$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>.Java2
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
CLASS CLASS name:D modality:FINAL visibility:public superTypes:[<root>.Java2]
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.D
CONSTRUCTOR visibility:public <> () returnType:<root>.D [primary]
BLOCK_BODY
DELEGATING_CONSTRUCTOR_CALL 'public constructor <init> () declared in <root>.Java2'
INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:D modality:FINAL visibility:public superTypes:[<root>.Java2]'
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>.Java2
$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>.Java2
$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>.Java2
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
FUN name:foo visibility:public modality:OPEN <> ($this:<root>.D) returnType:kotlin.Unit
overridden:
public open fun foo (): kotlin.Unit declared in <root>.Java2
$this: VALUE_PARAMETER name:<this> type:<root>.D
BLOCK_BODY
CLASS CLASS name:E modality:FINAL visibility:public superTypes:[<root>.Java3]
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.E
CONSTRUCTOR visibility:public <> () returnType:<root>.E [primary]
BLOCK_BODY
DELEGATING_CONSTRUCTOR_CALL 'public constructor <init> () declared in <root>.Java3'
INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:E modality:FINAL visibility:public superTypes:[<root>.Java3]'
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>.Java3
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
VALUE_PARAMETER name:other index:0 type:kotlin.Any?
FUN FAKE_OVERRIDE name:foo visibility:public modality:OPEN <> ($this:<root>.Java1) returnType:kotlin.Unit [fake_override]
overridden:
public open fun foo (): kotlin.Unit declared in <root>.Java3
$this: VALUE_PARAMETER name:<this> type:<root>.Java1
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>.Java3
$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>.Java3
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
CLASS CLASS name:F modality:FINAL visibility:public superTypes:[<root>.Java3]
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.F
CONSTRUCTOR visibility:public <> () returnType:<root>.F [primary]
BLOCK_BODY
DELEGATING_CONSTRUCTOR_CALL 'public constructor <init> () declared in <root>.Java3'
INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:F modality:FINAL visibility:public superTypes:[<root>.Java3]'
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>.Java3
$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>.Java3
$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>.Java3
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
FUN name:foo visibility:public modality:OPEN <> ($this:<root>.F) returnType:kotlin.Unit
overridden:
public open fun foo (): kotlin.Unit declared in <root>.Java3
$this: VALUE_PARAMETER name:<this> type:<root>.F
BLOCK_BODY
CLASS CLASS name:G modality:FINAL visibility:public superTypes:[<root>.Java4]
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.G
CONSTRUCTOR visibility:public <> () returnType:<root>.G [primary]
BLOCK_BODY
DELEGATING_CONSTRUCTOR_CALL 'public constructor <init> () declared in <root>.Java4'
INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:G modality:FINAL visibility:public superTypes:[<root>.Java4]'
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>.Java4
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
VALUE_PARAMETER name:other index:0 type:kotlin.Any?
FUN FAKE_OVERRIDE name:foo visibility:public modality:OPEN <> ($this:<root>.Java4) returnType:kotlin.Unit [fake_override]
overridden:
public open fun foo (): kotlin.Unit declared in <root>.Java4
$this: VALUE_PARAMETER name:<this> type:<root>.Java4
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>.Java4
$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>.Java4
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
CLASS CLASS name:H modality:FINAL visibility:public superTypes:[<root>.Java4]
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.H
CONSTRUCTOR visibility:public <> () returnType:<root>.H [primary]
BLOCK_BODY
DELEGATING_CONSTRUCTOR_CALL 'public constructor <init> () declared in <root>.Java4'
INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:H modality:FINAL visibility:public superTypes:[<root>.Java4]'
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>.Java4
$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>.Java4
$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>.Java4
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
FUN name:foo visibility:public modality:OPEN <> ($this:<root>.H) returnType:kotlin.Unit
overridden:
public open fun foo (): kotlin.Unit declared in <root>.Java4
$this: VALUE_PARAMETER name:<this> type:<root>.H
BLOCK_BODY
CLASS CLASS name:KotlinClass modality:OPEN visibility:public superTypes:[<root>.Java1]
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.KotlinClass
CONSTRUCTOR visibility:public <> () returnType:<root>.KotlinClass [primary]
BLOCK_BODY
DELEGATING_CONSTRUCTOR_CALL 'public constructor <init> () declared in <root>.Java1'
INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:KotlinClass modality:OPEN visibility:public superTypes:[<root>.Java1]'
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>.Java1
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
VALUE_PARAMETER name:other index:0 type:kotlin.Any?
FUN FAKE_OVERRIDE name:foo visibility:public modality:OPEN <> ($this:<root>.Java1) returnType:kotlin.Unit [fake_override]
overridden:
public open fun foo (): kotlin.Unit declared in <root>.Java1
$this: VALUE_PARAMETER name:<this> type:<root>.Java1
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>.Java1
$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>.Java1
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
FUN name:test visibility:public modality:FINAL <> (a:<root>.A, b:<root>.B, c:<root>.C, d:<root>.D, e:<root>.E, f:<root>.F, g:<root>.G, h:<root>.H) returnType:kotlin.Unit
VALUE_PARAMETER name:a index:0 type:<root>.A
VALUE_PARAMETER name:b index:1 type:<root>.B
VALUE_PARAMETER name:c index:2 type:<root>.C
VALUE_PARAMETER name:d index:3 type:<root>.D
VALUE_PARAMETER name:e index:4 type:<root>.E
VALUE_PARAMETER name:f index:5 type:<root>.F
VALUE_PARAMETER name:g index:6 type:<root>.G
VALUE_PARAMETER name:h index:7 type:<root>.H
BLOCK_BODY
CALL 'public open fun foo (): kotlin.Unit declared in <root>.A' type=kotlin.Unit origin=null
$this: GET_VAR 'a: <root>.A declared in <root>.test' type=<root>.A origin=null
CALL 'public open fun bar (): kotlin.Unit declared in <root>.Java1.Inner' type=kotlin.Unit origin=null
$this: CONSTRUCTOR_CALL 'public constructor <init> () declared in <root>.Java1.Inner' type=<root>.Java1.Inner origin=null
$outer: GET_VAR 'a: <root>.A declared in <root>.test' type=<root>.A origin=null
CALL 'public open fun foo (): kotlin.Unit declared in <root>.B' type=kotlin.Unit origin=null
$this: GET_VAR 'b: <root>.B declared in <root>.test' type=<root>.B origin=null
CALL 'public open fun bar (): kotlin.Unit declared in <root>.Java1.Inner' type=kotlin.Unit origin=null
$this: CONSTRUCTOR_CALL 'public constructor <init> () declared in <root>.Java1.Inner' type=<root>.Java1.Inner origin=null
$outer: GET_VAR 'b: <root>.B declared in <root>.test' type=<root>.B origin=null
CALL 'public open fun foo (): kotlin.Unit declared in <root>.C' type=kotlin.Unit origin=null
$this: GET_VAR 'c: <root>.C declared in <root>.test' type=<root>.C origin=null
CALL 'public open fun bar (): kotlin.Unit declared in <root>.Java1.Inner' type=kotlin.Unit origin=null
$this: CONSTRUCTOR_CALL 'public constructor <init> () declared in <root>.Java1.Inner' type=<root>.Java1.Inner origin=null
$outer: GET_VAR 'c: <root>.C declared in <root>.test' type=<root>.C origin=null
CALL 'public open fun foo (): kotlin.Unit declared in <root>.D' type=kotlin.Unit origin=null
$this: GET_VAR 'd: <root>.D declared in <root>.test' type=<root>.D origin=null
CALL 'public open fun bar (): kotlin.Unit declared in <root>.Java1.Inner' type=kotlin.Unit origin=null
$this: CONSTRUCTOR_CALL 'public constructor <init> () declared in <root>.Java1.Inner' type=<root>.Java1.Inner origin=null
$outer: GET_VAR 'd: <root>.D declared in <root>.test' type=<root>.D origin=null
CALL 'public open fun foo (): kotlin.Unit declared in <root>.E' type=kotlin.Unit origin=null
$this: GET_VAR 'e: <root>.E declared in <root>.test' type=<root>.E origin=null
CALL 'public open fun bar (): kotlin.Unit declared in <root>.Java1.Inner' type=kotlin.Unit origin=null
$this: CONSTRUCTOR_CALL 'public constructor <init> () declared in <root>.Java1.Inner' type=<root>.Java1.Inner origin=null
$outer: GET_VAR 'e: <root>.E declared in <root>.test' type=<root>.E origin=null
CALL 'public open fun foo (): kotlin.Unit declared in <root>.F' type=kotlin.Unit origin=null
$this: GET_VAR 'f: <root>.F declared in <root>.test' type=<root>.F origin=null
CALL 'public open fun bar (): kotlin.Unit declared in <root>.Java1.Inner' type=kotlin.Unit origin=null
$this: CONSTRUCTOR_CALL 'public constructor <init> () declared in <root>.Java1.Inner' type=<root>.Java1.Inner origin=null
$outer: GET_VAR 'f: <root>.F declared in <root>.test' type=<root>.F origin=null
CALL 'public open fun foo (): kotlin.Unit declared in <root>.G' type=kotlin.Unit origin=null
$this: GET_VAR 'g: <root>.G declared in <root>.test' type=<root>.G origin=null
CALL 'public open fun bar (): kotlin.Unit declared in <root>.Java4.Inner' type=kotlin.Unit origin=null
$this: CONSTRUCTOR_CALL 'public constructor <init> () declared in <root>.Java4.Inner' type=<root>.Java4.Inner origin=null
$outer: GET_VAR 'g: <root>.G declared in <root>.test' type=<root>.G origin=null
CALL 'public open fun foo (): kotlin.Unit declared in <root>.H' type=kotlin.Unit origin=null
$this: GET_VAR 'h: <root>.H declared in <root>.test' type=<root>.H origin=null
CALL 'public open fun bar (): kotlin.Unit declared in <root>.Java4.Inner' type=kotlin.Unit origin=null
$this: CONSTRUCTOR_CALL 'public constructor <init> () declared in <root>.Java4.Inner' type=<root>.Java4.Inner origin=null
$outer: GET_VAR 'h: <root>.H declared in <root>.test' type=<root>.H origin=null
@@ -0,0 +1,72 @@
// FIR_IDENTICAL
// TARGET_BACKEND: JVM
// FULL_JDK
// FILE: Java1.java
public class Java1 {
public void foo(Java1 this){};
public class Inner {
public void bar(Inner this){};
}
}
// FILE: Java2.java
public class Java2 extends Java1 { }
// FILE: Java3.java
public class Java3 extends KotlinClass { }
// FILE: Java4.java
public class Java4 extends KotlinClass {
public void foo(Java4 this){ };
public class Inner {
public void bar(Inner this){};
}
}
// FILE: 1.kt
class A : Java1() //Kotlin ← Java
class B : Java1() { //Kotlin ← Java with explicit override
override fun foo() { }
}
class C : Java2() //Kotlin ← Java1 ←Java2
class D : Java2() { //Kotlin ← Java1 ←Java2 with explicit override
override fun foo() { }
}
class E : Java3() //Kotlin ← Java ← Kotlin ← Java
class F : Java3() { //Kotlin ← Java ← Kotlin ← Java with explicit override
override fun foo() { }
}
class G : Java4() //Kotlin ← Java ← Kotlin ← Java with explicit override in java
class H : Java4() { //Kotlin ← Java ← Kotlin ← Java with explicit override in java and kotlin
override fun foo() { }
}
open class KotlinClass: Java1()
fun test(a: A, b: B, c: C, d: D, e: E, f: F, g: G, h: H) {
a.foo()
a.Inner().bar()
b.foo()
b.Inner().bar()
c.foo()
c.Inner().bar()
d.foo()
d.Inner().bar()
e.foo()
e.Inner().bar()
f.foo()
f.Inner().bar()
g.foo()
g.Inner().bar()
h.foo()
h.Inner().bar()
}
@@ -0,0 +1,111 @@
class A : Java1 {
constructor() /* primary */ {
super/*Java1*/()
/* <init>() */
}
}
class B : Java1 {
constructor() /* primary */ {
super/*Java1*/()
/* <init>() */
}
override fun foo() {
}
}
class C : Java2 {
constructor() /* primary */ {
super/*Java2*/()
/* <init>() */
}
}
class D : Java2 {
constructor() /* primary */ {
super/*Java2*/()
/* <init>() */
}
override fun foo() {
}
}
class E : Java3 {
constructor() /* primary */ {
super/*Java3*/()
/* <init>() */
}
}
class F : Java3 {
constructor() /* primary */ {
super/*Java3*/()
/* <init>() */
}
override fun foo() {
}
}
class G : Java4 {
constructor() /* primary */ {
super/*Java4*/()
/* <init>() */
}
}
class H : Java4 {
constructor() /* primary */ {
super/*Java4*/()
/* <init>() */
}
override fun foo() {
}
}
open class KotlinClass : Java1 {
constructor() /* primary */ {
super/*Java1*/()
/* <init>() */
}
}
fun test(a: A, b: B, c: C, d: D, e: E, f: F, g: G, h: H) {
a.foo()
a.Inner().bar()
b.foo()
b.Inner().bar()
c.foo()
c.Inner().bar()
d.foo()
d.Inner().bar()
e.foo()
e.Inner().bar()
f.foo()
f.Inner().bar()
g.foo()
g.Inner().bar()
h.foo()
h.Inner().bar()
}
@@ -0,0 +1,167 @@
// CHECK:
// Mangled name: A
// Public signature: /A|null[0]
class A : Java1 {
// CHECK:
// Mangled name: A#<init>(){}
// Public signature: /A.<init>|-5645683436151566731[0]
// Public signature debug description: <init>(){}
constructor() /* primary */
// CHECK:
// Mangled name: A#foo(){}
// Public signature: /A.foo|-1041209573719867811[0]
// Public signature debug description: foo(){}
/* fake */ override fun foo(): Unit
}
// CHECK:
// Mangled name: B
// Public signature: /B|null[0]
class B : Java1 {
// CHECK:
// Mangled name: B#<init>(){}
// Public signature: /B.<init>|-5645683436151566731[0]
// Public signature debug description: <init>(){}
constructor() /* primary */
// CHECK:
// Mangled name: B#foo(){}
// Public signature: /B.foo|-1041209573719867811[0]
// Public signature debug description: foo(){}
override fun foo(): Unit
}
// CHECK:
// Mangled name: C
// Public signature: /C|null[0]
class C : Java2 {
// CHECK:
// Mangled name: C#<init>(){}
// Public signature: /C.<init>|-5645683436151566731[0]
// Public signature debug description: <init>(){}
constructor() /* primary */
// CHECK:
// Mangled name: C#foo(){}
// Public signature: /C.foo|-1041209573719867811[0]
// Public signature debug description: foo(){}
/* fake */ override fun foo(): Unit
}
// CHECK:
// Mangled name: D
// Public signature: /D|null[0]
class D : Java2 {
// CHECK:
// Mangled name: D#<init>(){}
// Public signature: /D.<init>|-5645683436151566731[0]
// Public signature debug description: <init>(){}
constructor() /* primary */
// CHECK:
// Mangled name: D#foo(){}
// Public signature: /D.foo|-1041209573719867811[0]
// Public signature debug description: foo(){}
override fun foo(): Unit
}
// CHECK:
// Mangled name: E
// Public signature: /E|null[0]
class E : Java3 {
// CHECK:
// Mangled name: E#<init>(){}
// Public signature: /E.<init>|-5645683436151566731[0]
// Public signature debug description: <init>(){}
constructor() /* primary */
// CHECK:
// Mangled name: E#foo(){}
// Public signature: /E.foo|-1041209573719867811[0]
// Public signature debug description: foo(){}
/* fake */ override fun foo(): Unit
}
// CHECK:
// Mangled name: F
// Public signature: /F|null[0]
class F : Java3 {
// CHECK:
// Mangled name: F#<init>(){}
// Public signature: /F.<init>|-5645683436151566731[0]
// Public signature debug description: <init>(){}
constructor() /* primary */
// CHECK:
// Mangled name: F#foo(){}
// Public signature: /F.foo|-1041209573719867811[0]
// Public signature debug description: foo(){}
override fun foo(): Unit
}
// CHECK:
// Mangled name: G
// Public signature: /G|null[0]
class G : Java4 {
// CHECK:
// Mangled name: G#<init>(){}
// Public signature: /G.<init>|-5645683436151566731[0]
// Public signature debug description: <init>(){}
constructor() /* primary */
// CHECK:
// Mangled name: G#foo(){}
// Public signature: /G.foo|-1041209573719867811[0]
// Public signature debug description: foo(){}
/* fake */ override fun foo(): Unit
}
// CHECK:
// Mangled name: H
// Public signature: /H|null[0]
class H : Java4 {
// CHECK:
// Mangled name: H#<init>(){}
// Public signature: /H.<init>|-5645683436151566731[0]
// Public signature debug description: <init>(){}
constructor() /* primary */
// CHECK:
// Mangled name: H#foo(){}
// Public signature: /H.foo|-1041209573719867811[0]
// Public signature debug description: foo(){}
override fun foo(): Unit
}
// CHECK:
// Mangled name: KotlinClass
// Public signature: /KotlinClass|null[0]
open class KotlinClass : Java1 {
// CHECK:
// Mangled name: KotlinClass#<init>(){}
// Public signature: /KotlinClass.<init>|-5645683436151566731[0]
// Public signature debug description: <init>(){}
constructor() /* primary */
// CHECK:
// Mangled name: KotlinClass#foo(){}
// Public signature: /KotlinClass.foo|-1041209573719867811[0]
// Public signature debug description: foo(){}
/* fake */ override fun foo(): Unit
}
// CHECK:
// Mangled name: #test(A;B;C;D;E;F;G;H){}
// Public signature: /test|-2663909601123444132[0]
// Public signature debug description: test(A;B;C;D;E;F;G;H){}
fun test(a: A, b: B, c: C, d: D, e: E, f: F, g: G, h: H): Unit
@@ -0,0 +1,184 @@
FILE fqName:<root> fileName:/1.kt
CLASS CLASS name:A modality:OPEN visibility:public superTypes:[kotlin.Any]
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.A
CONSTRUCTOR visibility:public <> () returnType:<root>.A [primary]
BLOCK_BODY
DELEGATING_CONSTRUCTOR_CALL 'public constructor <init> () declared in kotlin.Any'
INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:A modality:OPEN visibility:public superTypes:[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 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:foo visibility:public modality:OPEN <> ($this:<root>.A, a:kotlin.Int, b:kotlin.Any?, c:kotlin.Nothing?) returnType:kotlin.Unit
$this: VALUE_PARAMETER name:<this> type:<root>.A
VALUE_PARAMETER name:a index:0 type:kotlin.Int
EXPRESSION_BODY
CONST Int type=kotlin.Int value=0
VALUE_PARAMETER name:b index:1 type:kotlin.Any?
EXPRESSION_BODY
CONST String type=kotlin.String value="string"
VALUE_PARAMETER name:c index:2 type:kotlin.Nothing?
EXPRESSION_BODY
CONST Null type=kotlin.Nothing? value=null
BLOCK_BODY
CLASS CLASS name:B modality:FINAL visibility:public superTypes:[<root>.Java1]
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.B
CONSTRUCTOR visibility:public <> () returnType:<root>.B [primary]
BLOCK_BODY
DELEGATING_CONSTRUCTOR_CALL 'public constructor <init> () declared in <root>.Java1'
INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:B modality:FINAL visibility:public superTypes:[<root>.Java1]'
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>.Java1
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
VALUE_PARAMETER name:other index:0 type:kotlin.Any?
FUN FAKE_OVERRIDE name:foo visibility:public modality:OPEN <> ($this:<root>.A, a:kotlin.Int, b:kotlin.Any?, c:kotlin.Nothing?) returnType:kotlin.Unit [fake_override]
overridden:
public open fun foo (a: kotlin.Int, b: kotlin.Any?, c: kotlin.Nothing?): kotlin.Unit declared in <root>.Java1
$this: VALUE_PARAMETER name:<this> type:<root>.A
VALUE_PARAMETER name:a index:0 type:kotlin.Int
VALUE_PARAMETER name:b index:1 type:kotlin.Any?
VALUE_PARAMETER name:c index:2 type:kotlin.Nothing?
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>.Java1
$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>.Java1
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
CLASS CLASS name:C modality:FINAL visibility:public superTypes:[<root>.Java1]
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.C
CONSTRUCTOR visibility:public <> () returnType:<root>.C [primary]
BLOCK_BODY
DELEGATING_CONSTRUCTOR_CALL 'public constructor <init> () declared in <root>.Java1'
INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:C modality:FINAL visibility:public superTypes:[<root>.Java1]'
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>.Java1
$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>.Java1
$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>.Java1
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
FUN name:foo visibility:public modality:OPEN <> ($this:<root>.C, a:kotlin.Int, b:kotlin.Any?, c:kotlin.Nothing?) returnType:kotlin.Unit
overridden:
public open fun foo (a: kotlin.Int, b: kotlin.Any?, c: kotlin.Nothing?): kotlin.Unit declared in <root>.Java1
$this: VALUE_PARAMETER name:<this> type:<root>.C
VALUE_PARAMETER name:a index:0 type:kotlin.Int
VALUE_PARAMETER name:b index:1 type:kotlin.Any?
VALUE_PARAMETER name:c index:2 type:kotlin.Nothing?
BLOCK_BODY
CLASS CLASS name:D modality:FINAL visibility:public superTypes:[<root>.Java2]
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.D
CONSTRUCTOR visibility:public <> () returnType:<root>.D [primary]
BLOCK_BODY
DELEGATING_CONSTRUCTOR_CALL 'public constructor <init> () declared in <root>.Java2'
INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:D modality:FINAL visibility:public superTypes:[<root>.Java2]'
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>.Java2
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
VALUE_PARAMETER name:other index:0 type:kotlin.Any?
FUN FAKE_OVERRIDE name:foo visibility:public modality:OPEN <> ($this:<root>.A, a:kotlin.Int, b:kotlin.Any?, c:kotlin.Nothing?) returnType:kotlin.Unit [fake_override]
overridden:
public open fun foo (a: kotlin.Int, b: kotlin.Any?, c: kotlin.Nothing?): kotlin.Unit declared in <root>.Java2
$this: VALUE_PARAMETER name:<this> type:<root>.A
VALUE_PARAMETER name:a index:0 type:kotlin.Int
VALUE_PARAMETER name:b index:1 type:kotlin.Any?
VALUE_PARAMETER name:c index:2 type:kotlin.Nothing?
FUN FAKE_OVERRIDE name:foo visibility:public/*package*/ modality:OPEN <> ($this:<root>.Java2, a:@[FlexibleNullability] kotlin.Int?, b:@[FlexibleNullability] kotlin.Any?, c:@[FlexibleNullability] kotlin.Any?) returnType:kotlin.Unit [fake_override]
overridden:
public/*package*/ open fun foo (a: @[FlexibleNullability] kotlin.Int?, b: @[FlexibleNullability] kotlin.Any?, c: @[FlexibleNullability] kotlin.Any?): kotlin.Unit declared in <root>.Java2
$this: VALUE_PARAMETER name:<this> type:<root>.Java2
VALUE_PARAMETER name:a index:0 type:@[FlexibleNullability] kotlin.Int?
VALUE_PARAMETER name:b index:1 type:@[FlexibleNullability] kotlin.Any?
VALUE_PARAMETER name:c index:2 type:@[FlexibleNullability] 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>.Java2
$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>.Java2
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
CLASS CLASS name:E modality:FINAL visibility:public superTypes:[<root>.Java2]
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.E
CONSTRUCTOR visibility:public <> () returnType:<root>.E [primary]
BLOCK_BODY
DELEGATING_CONSTRUCTOR_CALL 'public constructor <init> () declared in <root>.Java2'
INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:E modality:FINAL visibility:public superTypes:[<root>.Java2]'
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>.Java2
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
VALUE_PARAMETER name:other index:0 type:kotlin.Any?
FUN FAKE_OVERRIDE name:foo visibility:public/*package*/ modality:OPEN <> ($this:<root>.Java2, a:@[FlexibleNullability] kotlin.Int?, b:@[FlexibleNullability] kotlin.Any?, c:@[FlexibleNullability] kotlin.Any?) returnType:kotlin.Unit [fake_override]
overridden:
public/*package*/ open fun foo (a: @[FlexibleNullability] kotlin.Int?, b: @[FlexibleNullability] kotlin.Any?, c: @[FlexibleNullability] kotlin.Any?): kotlin.Unit declared in <root>.Java2
$this: VALUE_PARAMETER name:<this> type:<root>.Java2
VALUE_PARAMETER name:a index:0 type:@[FlexibleNullability] kotlin.Int?
VALUE_PARAMETER name:b index:1 type:@[FlexibleNullability] kotlin.Any?
VALUE_PARAMETER name:c index:2 type:@[FlexibleNullability] 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>.Java2
$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>.Java2
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
FUN name:foo visibility:public modality:OPEN <> ($this:<root>.E, a:kotlin.Int, b:kotlin.Any?, c:kotlin.Nothing?) returnType:kotlin.Unit
overridden:
public open fun foo (a: kotlin.Int, b: kotlin.Any?, c: kotlin.Nothing?): kotlin.Unit declared in <root>.Java2
$this: VALUE_PARAMETER name:<this> type:<root>.E
VALUE_PARAMETER name:a index:0 type:kotlin.Int
VALUE_PARAMETER name:b index:1 type:kotlin.Any?
VALUE_PARAMETER name:c index:2 type:kotlin.Nothing?
BLOCK_BODY
FUN name:test visibility:public modality:FINAL <> (b:<root>.B, c:<root>.C, d:<root>.D, e:<root>.E) returnType:kotlin.Unit
VALUE_PARAMETER name:b index:0 type:<root>.B
VALUE_PARAMETER name:c index:1 type:<root>.C
VALUE_PARAMETER name:d index:2 type:<root>.D
VALUE_PARAMETER name:e index:3 type:<root>.E
BLOCK_BODY
CALL 'public open fun foo (a: kotlin.Int, b: kotlin.Any?, c: kotlin.Nothing?): kotlin.Unit declared in <root>.B' type=kotlin.Unit origin=null
$this: GET_VAR 'b: <root>.B declared in <root>.test' type=<root>.B origin=null
CALL 'public open fun foo (a: kotlin.Int, b: kotlin.Any?, c: kotlin.Nothing?): kotlin.Unit declared in <root>.B' type=kotlin.Unit origin=null
$this: GET_VAR 'b: <root>.B declared in <root>.test' type=<root>.B origin=null
a: CONST Int type=kotlin.Int value=1
CALL 'public open fun foo (a: kotlin.Int, b: kotlin.Any?, c: kotlin.Nothing?): kotlin.Unit declared in <root>.C' type=kotlin.Unit origin=null
$this: GET_VAR 'c: <root>.C declared in <root>.test' type=<root>.C origin=null
CALL 'public open fun foo (a: kotlin.Int, b: kotlin.Any?, c: kotlin.Nothing?): kotlin.Unit declared in <root>.C' type=kotlin.Unit origin=null
$this: GET_VAR 'c: <root>.C declared in <root>.test' type=<root>.C origin=null
a: CONST Int type=kotlin.Int value=1
b: CONST String type=kotlin.String value=""
c: CONST Null type=kotlin.Nothing? value=null
CALL 'public open fun foo (a: kotlin.Int, b: kotlin.Any?, c: kotlin.Nothing?): kotlin.Unit declared in <root>.D' type=kotlin.Unit origin=null
$this: GET_VAR 'd: <root>.D declared in <root>.test' type=<root>.D origin=null
CALL 'public open fun foo (a: kotlin.Int, b: kotlin.Any?, c: kotlin.Nothing?): kotlin.Unit declared in <root>.D' type=kotlin.Unit origin=null
$this: GET_VAR 'd: <root>.D declared in <root>.test' type=<root>.D origin=null
a: CONST Int type=kotlin.Int value=1
b: CONST Null type=kotlin.Nothing? value=null
c: CONST Null type=kotlin.Nothing? value=null
CALL 'public open fun foo (a: kotlin.Int, b: kotlin.Any?, c: kotlin.Nothing?): kotlin.Unit declared in <root>.E' type=kotlin.Unit origin=null
$this: GET_VAR 'e: <root>.E declared in <root>.test' type=<root>.E origin=null
CALL 'public/*package*/ open fun foo (a: @[FlexibleNullability] kotlin.Int?, b: @[FlexibleNullability] kotlin.Any?, c: @[FlexibleNullability] kotlin.Any?): kotlin.Unit declared in <root>.E' type=kotlin.Unit origin=null
$this: GET_VAR 'e: <root>.E declared in <root>.test' type=<root>.E origin=null
a: CONST Null type=kotlin.Nothing? value=null
b: CONST Null type=kotlin.Nothing? value=null
c: CONST Null type=kotlin.Nothing? value=null
@@ -0,0 +1,38 @@
// FIR_IDENTICAL
// TARGET_BACKEND: JVM
// FILE: Java1.java
public class Java1 extends A { }
// FILE: Java2.java
public class Java2 extends A {
void foo(Integer a, Object b, Object c){ };
}
// FILE: 1.kt
open class A {
open fun foo(a: Int = 0, b: Any? = "string", c: Nothing? = null) { }
}
class B : Java1() //Kotlin ← Java ← Kotlin
class C : Java1() { //Kotlin ← Java ← Kotlin with explicit override
override fun foo(a: Int, b: Any?, c: Nothing?) { }
}
class D : Java2() //Kotlin ← Java ← Kotlin with explicit override in java
class E: Java2() { //Kotlin ← Java ← Kotlin with explicit override in java and kotlin
override fun foo(a: Int, b: Any?, c: Nothing?) { }
}
fun test(b: B, c: C, d: D, e: E) {
b.foo()
b.foo(1)
c.foo()
c.foo(1, "", null)
d.foo()
d.foo(1, null, null)
e.foo()
e.foo(null, null, null)
}
@@ -0,0 +1,64 @@
open class A {
constructor() /* primary */ {
super/*Any*/()
/* <init>() */
}
open fun foo(a: Int = 0, b: Any? = "string", c: Nothing? = null) {
}
}
class B : Java1 {
constructor() /* primary */ {
super/*Java1*/()
/* <init>() */
}
}
class C : Java1 {
constructor() /* primary */ {
super/*Java1*/()
/* <init>() */
}
override fun foo(a: Int, b: Any?, c: Nothing?) {
}
}
class D : Java2 {
constructor() /* primary */ {
super/*Java2*/()
/* <init>() */
}
}
class E : Java2 {
constructor() /* primary */ {
super/*Java2*/()
/* <init>() */
}
override fun foo(a: Int, b: Any?, c: Nothing?) {
}
}
fun test(b: B, c: C, d: D, e: E) {
b.foo()
b.foo(a = 1)
c.foo()
c.foo(a = 1, b = "", c = null)
d.foo()
d.foo(a = 1, b = null, c = null)
e.foo()
e.foo(a = null, b = null, c = null)
}
@@ -0,0 +1,107 @@
// CHECK:
// Mangled name: A
// Public signature: /A|null[0]
open class A {
// CHECK:
// Mangled name: A#<init>(){}
// Public signature: /A.<init>|-5645683436151566731[0]
// Public signature debug description: <init>(){}
constructor() /* primary */
// CHECK:
// Mangled name: A#foo(kotlin.Int;kotlin.Any?;kotlin.Nothing?){}
// Public signature: /A.foo|6201035694832034790[0]
// Public signature debug description: foo(kotlin.Int;kotlin.Any?;kotlin.Nothing?){}
open fun foo(a: Int, b: Any?, c: Nothing?): Unit
}
// CHECK:
// Mangled name: B
// Public signature: /B|null[0]
class B : Java1 {
// CHECK:
// Mangled name: B#<init>(){}
// Public signature: /B.<init>|-5645683436151566731[0]
// Public signature debug description: <init>(){}
constructor() /* primary */
// CHECK:
// Mangled name: B#foo(kotlin.Int;kotlin.Any?;kotlin.Nothing?){}
// Public signature: /B.foo|6201035694832034790[0]
// Public signature debug description: foo(kotlin.Int;kotlin.Any?;kotlin.Nothing?){}
/* fake */ override fun foo(a: Int, b: Any?, c: Nothing?): Unit
}
// CHECK:
// Mangled name: C
// Public signature: /C|null[0]
class C : Java1 {
// CHECK:
// Mangled name: C#<init>(){}
// Public signature: /C.<init>|-5645683436151566731[0]
// Public signature debug description: <init>(){}
constructor() /* primary */
// CHECK:
// Mangled name: C#foo(kotlin.Int;kotlin.Any?;kotlin.Nothing?){}
// Public signature: /C.foo|6201035694832034790[0]
// Public signature debug description: foo(kotlin.Int;kotlin.Any?;kotlin.Nothing?){}
override fun foo(a: Int, b: Any?, c: Nothing?): Unit
}
// CHECK:
// Mangled name: D
// Public signature: /D|null[0]
class D : Java2 {
// CHECK:
// Mangled name: D#<init>(){}
// Public signature: /D.<init>|-5645683436151566731[0]
// Public signature debug description: <init>(){}
constructor() /* primary */
// CHECK:
// Mangled name: D#foo(kotlin.Int;kotlin.Any?;kotlin.Nothing?){}
// Public signature: /D.foo|6201035694832034790[0]
// Public signature debug description: foo(kotlin.Int;kotlin.Any?;kotlin.Nothing?){}
/* fake */ override fun foo(a: Int, b: Any?, c: Nothing?): Unit
// CHECK:
// Mangled name: D#foo(kotlin.Int?;kotlin.Any?;kotlin.Any?){}
// Public signature: /D.foo|2458295513865718285[0]
// Public signature debug description: foo(kotlin.Int?;kotlin.Any?;kotlin.Any?){}
package /* fake */ override fun foo(a: Int?, b: Any?, c: Any?): Unit
}
// CHECK:
// Mangled name: E
// Public signature: /E|null[0]
class E : Java2 {
// CHECK:
// Mangled name: E#<init>(){}
// Public signature: /E.<init>|-5645683436151566731[0]
// Public signature debug description: <init>(){}
constructor() /* primary */
// CHECK:
// Mangled name: E#foo(kotlin.Int?;kotlin.Any?;kotlin.Any?){}
// Public signature: /E.foo|2458295513865718285[0]
// Public signature debug description: foo(kotlin.Int?;kotlin.Any?;kotlin.Any?){}
package /* fake */ override fun foo(a: Int?, b: Any?, c: Any?): Unit
// CHECK:
// Mangled name: E#foo(kotlin.Int;kotlin.Any?;kotlin.Nothing?){}
// Public signature: /E.foo|6201035694832034790[0]
// Public signature debug description: foo(kotlin.Int;kotlin.Any?;kotlin.Nothing?){}
override fun foo(a: Int, b: Any?, c: Nothing?): Unit
}
// CHECK:
// Mangled name: #test(B;C;D;E){}
// Public signature: /test|-2264777070922935105[0]
// Public signature debug description: test(B;C;D;E){}
fun test(b: B, c: C, d: D, e: E): Unit
@@ -0,0 +1,112 @@
FILE fqName:<root> fileName:/1.kt
CLASS CLASS name:A modality:FINAL visibility:public superTypes:[<root>.Java1; <root>.Java2]
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.A
CONSTRUCTOR visibility:public <> () returnType:<root>.A [primary]
BLOCK_BODY
DELEGATING_CONSTRUCTOR_CALL 'public constructor <init> () declared in <root>.Java1'
INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:A modality:FINAL visibility:public superTypes:[<root>.Java1; <root>.Java2]'
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>.Java1
public open fun equals (other: kotlin.Any?): kotlin.Boolean declared in <root>.Java2
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
VALUE_PARAMETER name:other index:0 type:kotlin.Any?
FUN FAKE_OVERRIDE name:foo visibility:public modality:OPEN <> ($this:<root>.Java1) returnType:kotlin.Unit [fake_override]
overridden:
public open fun foo (): kotlin.Unit declared in <root>.Java1
public abstract fun foo (): kotlin.Unit declared in <root>.Java2
$this: VALUE_PARAMETER name:<this> type:<root>.Java1
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>.Java1
public open fun hashCode (): kotlin.Int declared in <root>.Java2
$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>.Java1
public open fun toString (): kotlin.String declared in <root>.Java2
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
CLASS CLASS name:B modality:FINAL visibility:public superTypes:[<root>.Java1; <root>.Java2]
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.B
CONSTRUCTOR visibility:public <> () returnType:<root>.B [primary]
BLOCK_BODY
DELEGATING_CONSTRUCTOR_CALL 'public constructor <init> () declared in <root>.Java1'
INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:B modality:FINAL visibility:public superTypes:[<root>.Java1; <root>.Java2]'
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>.Java1
public open fun equals (other: kotlin.Any?): kotlin.Boolean declared in <root>.Java2
$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>.Java1
public open fun hashCode (): kotlin.Int declared in <root>.Java2
$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>.Java1
public open fun toString (): kotlin.String declared in <root>.Java2
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
FUN name:foo visibility:public modality:OPEN <> ($this:<root>.B) returnType:kotlin.Unit
overridden:
public open fun foo (): kotlin.Unit declared in <root>.Java1
public abstract fun foo (): kotlin.Unit declared in <root>.Java2
$this: VALUE_PARAMETER name:<this> type:<root>.B
BLOCK_BODY
CLASS CLASS name:C modality:FINAL visibility:public superTypes:[<root>.KotlinInterface; <root>.Java1]
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.C
CONSTRUCTOR visibility:public <> () returnType:<root>.C [primary]
BLOCK_BODY
DELEGATING_CONSTRUCTOR_CALL 'public constructor <init> () declared in <root>.Java1'
INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:C modality:FINAL visibility:public superTypes:[<root>.KotlinInterface; <root>.Java1]'
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>.KotlinInterface
public open fun equals (other: kotlin.Any?): kotlin.Boolean declared in <root>.Java1
$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>.KotlinInterface
public open fun hashCode (): kotlin.Int declared in <root>.Java1
$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>.KotlinInterface
public open fun toString (): kotlin.String declared in <root>.Java1
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
FUN name:foo visibility:public modality:OPEN <> ($this:<root>.C) returnType:kotlin.Unit
overridden:
public abstract fun foo (): kotlin.Unit declared in <root>.KotlinInterface
public open fun foo (): kotlin.Unit declared in <root>.Java1
$this: VALUE_PARAMETER name:<this> type:<root>.C
BLOCK_BODY
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:foo visibility:public modality:ABSTRACT <> ($this:<root>.KotlinInterface) returnType:kotlin.Unit
$this: VALUE_PARAMETER name:<this> type:<root>.KotlinInterface
FUN name:test visibility:public modality:FINAL <> (a:<root>.A, b:<root>.B, c:<root>.C) returnType:kotlin.Unit
VALUE_PARAMETER name:a index:0 type:<root>.A
VALUE_PARAMETER name:b index:1 type:<root>.B
VALUE_PARAMETER name:c index:2 type:<root>.C
BLOCK_BODY
CALL 'public open fun foo (): kotlin.Unit declared in <root>.A' type=kotlin.Unit origin=null
$this: GET_VAR 'a: <root>.A declared in <root>.test' type=<root>.A origin=null
CALL 'public open fun foo (): kotlin.Unit declared in <root>.B' type=kotlin.Unit origin=null
$this: GET_VAR 'b: <root>.B declared in <root>.test' type=<root>.B origin=null
CALL 'public open fun foo (): kotlin.Unit declared in <root>.C' type=kotlin.Unit origin=null
$this: GET_VAR 'c: <root>.C declared in <root>.test' type=<root>.C origin=null
@@ -0,0 +1,35 @@
// FIR_IDENTICAL
// TARGET_BACKEND: JVM
// FILE: Java1.java
public class Java1 {
public void foo(Java1 this){ }
}
// FILE: Java2.java
public interface Java2 {
public void foo();
}
// FILE: 1.kt
class A : Java1(), Java2
class B : Java1(), Java2 {
override fun foo() { }
}
class C : KotlinInterface, Java1() {
override fun foo() { }
}
interface KotlinInterface {
fun foo()
}
fun test(a: A, b: B, c: C) {
a.foo()
b.foo()
c.foo()
}
@@ -0,0 +1,43 @@
class A : Java1, Java2 {
constructor() /* primary */ {
super/*Java1*/()
/* <init>() */
}
}
class B : Java1, Java2 {
constructor() /* primary */ {
super/*Java1*/()
/* <init>() */
}
override fun foo() {
}
}
class C : Java1, KotlinInterface {
constructor() /* primary */ {
super/*Java1*/()
/* <init>() */
}
override fun foo() {
}
}
interface KotlinInterface {
abstract fun foo()
}
fun test(a: A, b: B, c: C) {
a.foo()
b.foo()
c.foo()
}
@@ -0,0 +1,71 @@
// CHECK:
// Mangled name: A
// Public signature: /A|null[0]
class A : Java1, Java2 {
// CHECK:
// Mangled name: A#<init>(){}
// Public signature: /A.<init>|-5645683436151566731[0]
// Public signature debug description: <init>(){}
constructor() /* primary */
// CHECK:
// Mangled name: A#foo(){}
// Public signature: /A.foo|-1041209573719867811[0]
// Public signature debug description: foo(){}
/* fake */ override fun foo(): Unit
}
// CHECK:
// Mangled name: B
// Public signature: /B|null[0]
class B : Java1, Java2 {
// CHECK:
// Mangled name: B#<init>(){}
// Public signature: /B.<init>|-5645683436151566731[0]
// Public signature debug description: <init>(){}
constructor() /* primary */
// CHECK:
// Mangled name: B#foo(){}
// Public signature: /B.foo|-1041209573719867811[0]
// Public signature debug description: foo(){}
override fun foo(): Unit
}
// CHECK:
// Mangled name: C
// Public signature: /C|null[0]
class C : Java1, KotlinInterface {
// CHECK:
// Mangled name: C#<init>(){}
// Public signature: /C.<init>|-5645683436151566731[0]
// Public signature debug description: <init>(){}
constructor() /* primary */
// CHECK:
// Mangled name: C#foo(){}
// Public signature: /C.foo|-1041209573719867811[0]
// Public signature debug description: foo(){}
override fun foo(): Unit
}
// CHECK:
// Mangled name: KotlinInterface
// Public signature: /KotlinInterface|null[0]
interface KotlinInterface {
// CHECK:
// Mangled name: KotlinInterface#foo(){}
// Public signature: /KotlinInterface.foo|-1041209573719867811[0]
// Public signature debug description: foo(){}
abstract fun foo(): Unit
}
// CHECK:
// Mangled name: #test(A;B;C){}
// Public signature: /test|-4981009800298118531[0]
// Public signature debug description: test(A;B;C){}
fun test(a: A, b: B, c: C): Unit
@@ -0,0 +1,199 @@
FILE fqName:<root> fileName:/1.kt
CLASS CLASS name:A modality:OPEN visibility:public superTypes:[kotlin.Any]
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.A
CONSTRUCTOR visibility:public <> () returnType:<root>.A [primary]
BLOCK_BODY
DELEGATING_CONSTRUCTOR_CALL 'public constructor <init> () declared in kotlin.Any'
INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:A modality:OPEN visibility:public superTypes:[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 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:foo visibility:public modality:OPEN <> ($this:<root>.A, a:kotlin.Int, b:kotlin.Any?, c:kotlin.Nothing?) returnType:kotlin.Unit
$this: VALUE_PARAMETER name:<this> type:<root>.A
VALUE_PARAMETER name:a index:0 type:kotlin.Int
EXPRESSION_BODY
CONST Int type=kotlin.Int value=0
VALUE_PARAMETER name:b index:1 type:kotlin.Any?
EXPRESSION_BODY
CONST String type=kotlin.String value="string"
VALUE_PARAMETER name:c index:2 type:kotlin.Nothing?
EXPRESSION_BODY
CONST Null type=kotlin.Nothing? value=null
BLOCK_BODY
CLASS CLASS name:B modality:ABSTRACT visibility:public superTypes:[<root>.A; <root>.Java1]
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.B
CONSTRUCTOR visibility:public <> () returnType:<root>.B [primary]
BLOCK_BODY
DELEGATING_CONSTRUCTOR_CALL 'public constructor <init> () declared in <root>.A'
INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:B modality:ABSTRACT visibility:public superTypes:[<root>.A; <root>.Java1]'
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>.A
public open fun equals (other: kotlin.Any?): kotlin.Boolean declared in <root>.Java1
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
VALUE_PARAMETER name:other index:0 type:kotlin.Any?
FUN FAKE_OVERRIDE name:foo visibility:public modality:ABSTRACT <> ($this:<root>.Java1, a:@[FlexibleNullability] kotlin.Int?, b:@[FlexibleNullability] kotlin.Any?, c:@[FlexibleNullability] kotlin.Any?) returnType:kotlin.Unit [fake_override]
overridden:
public abstract fun foo (a: @[FlexibleNullability] kotlin.Int?, b: @[FlexibleNullability] kotlin.Any?, c: @[FlexibleNullability] kotlin.Any?): kotlin.Unit declared in <root>.Java1
$this: VALUE_PARAMETER name:<this> type:<root>.Java1
VALUE_PARAMETER name:a index:0 type:@[FlexibleNullability] kotlin.Int?
VALUE_PARAMETER name:b index:1 type:@[FlexibleNullability] kotlin.Any?
VALUE_PARAMETER name:c index:2 type:@[FlexibleNullability] kotlin.Any?
FUN FAKE_OVERRIDE name:foo visibility:public modality:OPEN <> ($this:<root>.A, a:kotlin.Int, b:kotlin.Any?, c:kotlin.Nothing?) returnType:kotlin.Unit [fake_override]
overridden:
public open fun foo (a: kotlin.Int, b: kotlin.Any?, c: kotlin.Nothing?): kotlin.Unit declared in <root>.A
$this: VALUE_PARAMETER name:<this> type:<root>.A
VALUE_PARAMETER name:a index:0 type:kotlin.Int
VALUE_PARAMETER name:b index:1 type:kotlin.Any?
VALUE_PARAMETER name:c index:2 type:kotlin.Nothing?
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>.A
public open fun hashCode (): kotlin.Int declared in <root>.Java1
$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>.A
public open fun toString (): kotlin.String declared in <root>.Java1
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
CLASS CLASS name:C modality:FINAL visibility:public superTypes:[<root>.A; <root>.Java1]
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.C
CONSTRUCTOR visibility:public <> () returnType:<root>.C [primary]
BLOCK_BODY
DELEGATING_CONSTRUCTOR_CALL 'public constructor <init> () declared in <root>.A'
INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:C modality:FINAL visibility:public superTypes:[<root>.A; <root>.Java1]'
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>.A
public open fun equals (other: kotlin.Any?): kotlin.Boolean declared in <root>.Java1
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
VALUE_PARAMETER name:other index:0 type:kotlin.Any?
FUN FAKE_OVERRIDE name:foo visibility:public modality:OPEN <> ($this:<root>.A, a:kotlin.Int, b:kotlin.Any?, c:kotlin.Nothing?) returnType:kotlin.Unit [fake_override]
overridden:
public open fun foo (a: kotlin.Int, b: kotlin.Any?, c: kotlin.Nothing?): kotlin.Unit declared in <root>.A
$this: VALUE_PARAMETER name:<this> type:<root>.A
VALUE_PARAMETER name:a index:0 type:kotlin.Int
VALUE_PARAMETER name:b index:1 type:kotlin.Any?
VALUE_PARAMETER name:c index:2 type:kotlin.Nothing?
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>.A
public open fun hashCode (): kotlin.Int declared in <root>.Java1
$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>.A
public open fun toString (): kotlin.String declared in <root>.Java1
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
FUN name:foo visibility:public modality:OPEN <> ($this:<root>.C, a:kotlin.Int?, b:kotlin.Any?, c:kotlin.Any?) returnType:kotlin.Unit
overridden:
public abstract fun foo (a: @[FlexibleNullability] kotlin.Int?, b: @[FlexibleNullability] kotlin.Any?, c: @[FlexibleNullability] kotlin.Any?): kotlin.Unit declared in <root>.Java1
$this: VALUE_PARAMETER name:<this> type:<root>.C
VALUE_PARAMETER name:a index:0 type:kotlin.Int?
VALUE_PARAMETER name:b index:1 type:kotlin.Any?
VALUE_PARAMETER name:c index:2 type:kotlin.Any?
BLOCK_BODY
CLASS CLASS name:D modality:FINAL visibility:public superTypes:[<root>.A; <root>.Java2]
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.D
CONSTRUCTOR visibility:public <> () returnType:<root>.D [primary]
BLOCK_BODY
DELEGATING_CONSTRUCTOR_CALL 'public constructor <init> () declared in <root>.A'
INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:D modality:FINAL visibility:public superTypes:[<root>.A; <root>.Java2]'
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>.A
public open fun equals (other: kotlin.Any?): kotlin.Boolean declared in <root>.Java2
$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>.A
public open fun hashCode (): kotlin.Int declared in <root>.Java2
$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>.A
public open fun toString (): kotlin.String declared in <root>.Java2
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
FUN name:foo visibility:public modality:OPEN <> ($this:<root>.D, a:kotlin.Int, b:kotlin.Any?, c:kotlin.Nothing?) returnType:kotlin.Unit
overridden:
public open fun foo (a: kotlin.Int, b: kotlin.Any?, c: kotlin.Nothing?): kotlin.Unit declared in <root>.A
public open fun foo (a: kotlin.Int, b: kotlin.Any?, c: kotlin.Nothing?): kotlin.Unit declared in <root>.Java2
$this: VALUE_PARAMETER name:<this> type:<root>.D
VALUE_PARAMETER name:a index:0 type:kotlin.Int
VALUE_PARAMETER name:b index:1 type:kotlin.Any?
VALUE_PARAMETER name:c index:2 type:kotlin.Nothing?
BLOCK_BODY
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:foo visibility:public modality:OPEN <> ($this:<root>.KotlinInterface, a:kotlin.Int, b:kotlin.Any?, c:kotlin.Nothing?) returnType:kotlin.Unit
$this: VALUE_PARAMETER name:<this> type:<root>.KotlinInterface
VALUE_PARAMETER name:a index:0 type:kotlin.Int
EXPRESSION_BODY
CONST Int type=kotlin.Int value=1
VALUE_PARAMETER name:b index:1 type:kotlin.Any?
EXPRESSION_BODY
CONST String type=kotlin.String value="string2"
VALUE_PARAMETER name:c index:2 type:kotlin.Nothing?
EXPRESSION_BODY
CONST Null type=kotlin.Nothing? value=null
BLOCK_BODY
FUN name:test visibility:public modality:FINAL <> (b:<root>.B, c:<root>.C, d:<root>.D) returnType:kotlin.Unit
VALUE_PARAMETER name:b index:0 type:<root>.B
VALUE_PARAMETER name:c index:1 type:<root>.C
VALUE_PARAMETER name:d index:2 type:<root>.D
BLOCK_BODY
CALL 'public open fun foo (a: kotlin.Int, b: kotlin.Any?, c: kotlin.Nothing?): kotlin.Unit declared in <root>.B' type=kotlin.Unit origin=null
$this: GET_VAR 'b: <root>.B declared in <root>.test' type=<root>.B origin=null
CALL 'public open fun foo (a: kotlin.Int, b: kotlin.Any?, c: kotlin.Nothing?): kotlin.Unit declared in <root>.B' type=kotlin.Unit origin=null
$this: GET_VAR 'b: <root>.B declared in <root>.test' type=<root>.B origin=null
a: CONST Int type=kotlin.Int value=1
b: CONST Null type=kotlin.Nothing? value=null
c: CONST Null type=kotlin.Nothing? value=null
CALL 'public abstract fun foo (a: @[FlexibleNullability] kotlin.Int?, b: @[FlexibleNullability] kotlin.Any?, c: @[FlexibleNullability] kotlin.Any?): kotlin.Unit declared in <root>.B' type=kotlin.Unit origin=null
$this: GET_VAR 'b: <root>.B declared in <root>.test' type=<root>.B origin=null
a: CONST Int type=kotlin.Int value=1
b: CONST String type=kotlin.String value=""
c: CONST String type=kotlin.String value=""
CALL 'public open fun foo (a: kotlin.Int, b: kotlin.Any?, c: kotlin.Nothing?): kotlin.Unit declared in <root>.C' type=kotlin.Unit origin=null
$this: GET_VAR 'c: <root>.C declared in <root>.test' type=<root>.C origin=null
CALL 'public open fun foo (a: kotlin.Int?, b: kotlin.Any?, c: kotlin.Any?): kotlin.Unit declared in <root>.C' type=kotlin.Unit origin=null
$this: GET_VAR 'c: <root>.C declared in <root>.test' type=<root>.C origin=null
a: CONST Null type=kotlin.Nothing? value=null
b: CONST String type=kotlin.String value=""
c: CONST Null type=kotlin.Nothing? value=null
CALL 'public open fun foo (a: kotlin.Int, b: kotlin.Any?, c: kotlin.Nothing?): kotlin.Unit declared in <root>.C' type=kotlin.Unit origin=null
$this: GET_VAR 'c: <root>.C declared in <root>.test' type=<root>.C origin=null
a: CONST Int type=kotlin.Int value=1
b: CONST String type=kotlin.String value=""
c: CONST Null type=kotlin.Nothing? value=null
CALL 'public open fun foo (a: kotlin.Int, b: kotlin.Any?, c: kotlin.Nothing?): kotlin.Unit declared in <root>.D' type=kotlin.Unit origin=null
$this: GET_VAR 'd: <root>.D declared in <root>.test' type=<root>.D origin=null
CALL 'public open fun foo (a: kotlin.Int, b: kotlin.Any?, c: kotlin.Nothing?): kotlin.Unit declared in <root>.D' type=kotlin.Unit origin=null
$this: GET_VAR 'd: <root>.D declared in <root>.test' type=<root>.D origin=null
a: CONST Int type=kotlin.Int value=1
b: CONST Null type=kotlin.Nothing? value=null
c: CONST Null type=kotlin.Nothing? value=null
@@ -0,0 +1,41 @@
// FIR_IDENTICAL
// TARGET_BACKEND: JVM
// FILE: Java1.java
public interface Java1 {
void foo(Integer a, Object b, Object c);
}
// FILE: Java2.java
public interface Java2 extends KotlinInterface { }
// FILE: 1.kt
open class A {
open fun foo(a: Int = 0, b: Any? = "string", c: Nothing? = null) { }
}
abstract class B : A(), Java1 //Kotlin ← Java, Kotlin2
class C: A(), Java1 { //Kotlin ← Java, Kotlin2 with explicit override
override fun foo(a: Int?, b: Any?, c: Any?) { }
}
class D : A(), Java2 { //Kotlin ← Java, Kotlin2 ← Kotlin3
override fun foo(a: Int, b: Any?, c: Nothing?) { }
}
interface KotlinInterface {
fun foo(a: Int = 1, b: Any? = "string2", c: Nothing? = null) { }
}
fun test(b: B, c: C, d: D) {
b.foo()
b.foo(1, null, null)
b.foo(1, "", "")
c.foo()
c.foo(null, "", null)
c.foo(1, "", null)
d.foo()
d.foo(1, null, null)
}
@@ -0,0 +1,61 @@
open class A {
constructor() /* primary */ {
super/*Any*/()
/* <init>() */
}
open fun foo(a: Int = 0, b: Any? = "string", c: Nothing? = null) {
}
}
abstract class B : A, Java1 {
constructor() /* primary */ {
super/*A*/()
/* <init>() */
}
}
class C : A, Java1 {
constructor() /* primary */ {
super/*A*/()
/* <init>() */
}
override fun foo(a: Int?, b: Any?, c: Any?) {
}
}
class D : A, Java2 {
constructor() /* primary */ {
super/*A*/()
/* <init>() */
}
override fun foo(a: Int, b: Any?, c: Nothing?) {
}
}
interface KotlinInterface {
fun foo(a: Int = 1, b: Any? = "string2", c: Nothing? = null) {
}
}
fun test(b: B, c: C, d: D) {
b.foo()
b.foo(a = 1, b = null, c = null)
b.foo(a = 1, b = "", c = "")
c.foo()
c.foo(a = null, b = "", c = null)
c.foo(a = 1, b = "", c = null)
d.foo()
d.foo(a = 1, b = null, c = null)
}
@@ -0,0 +1,101 @@
// CHECK:
// Mangled name: A
// Public signature: /A|null[0]
open class A {
// CHECK:
// Mangled name: A#<init>(){}
// Public signature: /A.<init>|-5645683436151566731[0]
// Public signature debug description: <init>(){}
constructor() /* primary */
// CHECK:
// Mangled name: A#foo(kotlin.Int;kotlin.Any?;kotlin.Nothing?){}
// Public signature: /A.foo|6201035694832034790[0]
// Public signature debug description: foo(kotlin.Int;kotlin.Any?;kotlin.Nothing?){}
open fun foo(a: Int, b: Any?, c: Nothing?): Unit
}
// CHECK:
// Mangled name: B
// Public signature: /B|null[0]
abstract class B : A, Java1 {
// CHECK:
// Mangled name: B#<init>(){}
// Public signature: /B.<init>|-5645683436151566731[0]
// Public signature debug description: <init>(){}
constructor() /* primary */
// CHECK:
// Mangled name: B#foo(kotlin.Int?;kotlin.Any?;kotlin.Any?){}
// Public signature: /B.foo|2458295513865718285[0]
// Public signature debug description: foo(kotlin.Int?;kotlin.Any?;kotlin.Any?){}
abstract /* fake */ override fun foo(a: Int?, b: Any?, c: Any?): Unit
// CHECK:
// Mangled name: B#foo(kotlin.Int;kotlin.Any?;kotlin.Nothing?){}
// Public signature: /B.foo|6201035694832034790[0]
// Public signature debug description: foo(kotlin.Int;kotlin.Any?;kotlin.Nothing?){}
/* fake */ override fun foo(a: Int, b: Any?, c: Nothing?): Unit
}
// CHECK:
// Mangled name: C
// Public signature: /C|null[0]
class C : A, Java1 {
// CHECK:
// Mangled name: C#<init>(){}
// Public signature: /C.<init>|-5645683436151566731[0]
// Public signature debug description: <init>(){}
constructor() /* primary */
// CHECK:
// Mangled name: C#foo(kotlin.Int;kotlin.Any?;kotlin.Nothing?){}
// Public signature: /C.foo|6201035694832034790[0]
// Public signature debug description: foo(kotlin.Int;kotlin.Any?;kotlin.Nothing?){}
/* fake */ override fun foo(a: Int, b: Any?, c: Nothing?): Unit
// CHECK:
// Mangled name: C#foo(kotlin.Int?;kotlin.Any?;kotlin.Any?){}
// Public signature: /C.foo|2458295513865718285[0]
// Public signature debug description: foo(kotlin.Int?;kotlin.Any?;kotlin.Any?){}
override fun foo(a: Int?, b: Any?, c: Any?): Unit
}
// CHECK:
// Mangled name: D
// Public signature: /D|null[0]
class D : A, Java2 {
// CHECK:
// Mangled name: D#<init>(){}
// Public signature: /D.<init>|-5645683436151566731[0]
// Public signature debug description: <init>(){}
constructor() /* primary */
// CHECK:
// Mangled name: D#foo(kotlin.Int;kotlin.Any?;kotlin.Nothing?){}
// Public signature: /D.foo|6201035694832034790[0]
// Public signature debug description: foo(kotlin.Int;kotlin.Any?;kotlin.Nothing?){}
override fun foo(a: Int, b: Any?, c: Nothing?): Unit
}
// CHECK:
// Mangled name: KotlinInterface
// Public signature: /KotlinInterface|null[0]
interface KotlinInterface {
// CHECK:
// Mangled name: KotlinInterface#foo(kotlin.Int;kotlin.Any?;kotlin.Nothing?){}
// Public signature: /KotlinInterface.foo|6201035694832034790[0]
// Public signature debug description: foo(kotlin.Int;kotlin.Any?;kotlin.Nothing?){}
fun foo(a: Int, b: Any?, c: Nothing?): Unit
}
// CHECK:
// Mangled name: #test(B;C;D){}
// Public signature: /test|-8823403443617116000[0]
// Public signature debug description: test(B;C;D){}
fun test(b: B, c: C, d: D): Unit