Files
kotlin-fork/compiler/testData/ir/irText/fakeOverrides/methodparameters/intersectionKotlinDefaultParametersOverride.kt.txt
anzhela.sukhanova 82255d5ee8 [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>
2024-03-04 16:21:02 +00:00

62 lines
912 B
Kotlin
Vendored

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)
}