Files
kotlin-fork/compiler/testData/ir/irText/fakeOverrides/visibility/intersectionWithSeparateModule.fir.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

350 lines
4.8 KiB
Kotlin
Vendored

// MODULE: separate
// MODULE: main
// FILE: test.kt
abstract class A : JavaDefaultSeparateModule, KotlinDefault {
constructor() /* primary */ {
super/*Any*/()
/* <init>() */
}
override fun foo() {
}
override val a: Int
override get(): Int {
return 5
}
}
abstract class B : JavaDefaultSeparateModule, KotlinPrivate {
constructor() /* primary */ {
super/*Any*/()
/* <init>() */
}
}
class C : JavaDefaultSeparateModule, KotlinPrivate {
val a: Int
field = 5
get
constructor() /* primary */ {
super/*Any*/()
/* <init>() */
}
override fun foo() {
}
}
class D : KotlinProtected, JavaDefaultSeparateModule {
constructor() /* primary */ {
super/*KotlinProtected*/()
/* <init>() */
}
override fun foo() {
}
protected override val a: Int
protected override get(): Int {
return 5
}
}
class E : JavaDefaultSeparateModule, KotlinPublic {
constructor() /* primary */ {
super/*Any*/()
/* <init>() */
}
override fun foo() {
}
override val a: Int
override get(): Int {
return 5
}
}
class F : KotlinInternal, JavaDefaultSeparateModule {
constructor() /* primary */ {
super/*KotlinInternal*/()
/* <init>() */
}
override fun foo() {
}
override val a: Int
override get(): Int {
return 5
}
}
class G : JavaProtectedSeparateModule, KotlinDefault {
constructor() /* primary */ {
super/*JavaProtectedSeparateModule*/()
/* <init>() */
}
override fun foo() {
}
override val a: Int
override get(): Int {
return 5
}
}
class H : JavaProtectedSeparateModule, KotlinPrivate {
constructor() /* primary */ {
super/*JavaProtectedSeparateModule*/()
/* <init>() */
}
}
class I : JavaProtectedSeparateModule, KotlinPrivate {
val a: Int
field = 5
get
constructor() /* primary */ {
super/*JavaProtectedSeparateModule*/()
/* <init>() */
}
override fun foo() {
}
}
class J : JavaProtectedSeparateModule, KotlinPublic {
constructor() /* primary */ {
super/*JavaProtectedSeparateModule*/()
/* <init>() */
}
override fun foo() {
}
override val a: Int
override get(): Int {
return 5
}
}
abstract class K : JavaDefaultSeparateModule, JavaPublic {
constructor() /* primary */ {
super/*Any*/()
/* <init>() */
}
}
open class KotlinInternal {
constructor() /* primary */ {
super/*Any*/()
/* <init>() */
}
internal open fun foo() {
}
internal open val a: Int
internal open get(): Int {
return 1
}
}
open class KotlinProtected {
protected open val a: Int
field = 1
protected open get
constructor() /* primary */ {
super/*Any*/()
/* <init>() */
}
protected open fun foo() {
}
}
class L : JavaDefaultSeparateModule, JavaPublic {
val a: Int
field = 1
get
constructor() /* primary */ {
super/*Any*/()
/* <init>() */
}
override fun foo() {
}
}
class M : JavaProtectedSeparateModule, JavaPublic {
val a: Int
field = 1
get
constructor() /* primary */ {
super/*JavaProtectedSeparateModule*/()
/* <init>() */
}
override fun foo() {
}
}
class N : JavaProtectedSeparateModule, JavaDefault {
val a: Int
field = 1
get
constructor() /* primary */ {
super/*JavaProtectedSeparateModule*/()
/* <init>() */
}
override fun foo() {
}
}
abstract class O : JavaPrivate, JavaDefaultSeparateModule {
constructor() /* primary */ {
super/*JavaPrivate*/()
/* <init>() */
}
}
class P : JavaPrivate, JavaDefaultSeparateModule {
val a: Int
field = 1
get
constructor() /* primary */ {
super/*JavaPrivate*/()
/* <init>() */
}
override fun foo() {
}
}
class R : JavaProtected, JavaDefaultSeparateModule {
val a: Int
field = 1
get
constructor() /* primary */ {
super/*JavaProtected*/()
/* <init>() */
}
override fun foo() {
}
}
interface KotlinDefault {
fun foo() {
}
val a: Int
get(): Int {
return 1
}
}
interface KotlinPrivate {
private final fun foo() {
}
private final val a: Int
private final get(): Int {
return 1
}
}
interface KotlinPublic {
fun foo() {
}
val a: Int
get(): Int {
return 1
}
}
fun test(a: A, b: B, c: C, d: D, e: E, f: F, g: G, i: I, j: J, k: K, l: L, m: M, n: N, o: O, p: P, r: R) {
a.foo()
a.<get-a>() /*~> Unit */
b.foo()
c.foo()
d.foo()
e.foo()
e.<get-a>() /*~> Unit */
f.foo()
f.<get-a>() /*~> Unit */
g.foo()
g.<get-a>() /*~> Unit */
i.foo()
i.<get-a>() /*~> Unit */
j.foo()
j.<get-a>() /*~> Unit */
k.foo()
l.foo()
l.<get-a>() /*~> Unit */
m.foo()
m.<get-a>() /*~> Unit */
n.foo()
n.<get-a>() /*~> Unit */
o.foo()
p.foo()
p.<get-a>() /*~> Unit */
r.foo()
r.<get-a>() /*~> Unit */
}