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

509 lines
6.7 KiB
Kotlin
Vendored

abstract class A : JavaDefault, KotlinDefault {
constructor() /* primary */ {
super/*Any*/()
/* <init>() */
}
override fun foo() {
}
fun test() {
<this>.<get-a>() /*~> Unit */
<this>.foo()
}
override val a: Int
override get(): Int {
return 5
}
}
abstract class B : JavaDefault, KotlinPrivate {
constructor() /* primary */ {
super/*Any*/()
/* <init>() */
}
fun test() {
<this>.foo()
}
}
class C : JavaDefault, KotlinPrivate {
val a: Int
field = 5
get
constructor() /* primary */ {
super/*Any*/()
/* <init>() */
}
override fun foo() {
}
fun test() {
<this>.<get-a>() /*~> Unit */
<this>.foo()
}
}
class D : KotlinProtected, JavaDefault {
constructor() /* primary */ {
super/*KotlinProtected*/()
/* <init>() */
}
override fun foo() {
}
fun test() {
<this>.<get-a>() /*~> Unit */
<this>.foo()
}
protected override val a: Int
protected override get(): Int {
return 5
}
}
class E : JavaDefault, KotlinPublic {
constructor() /* primary */ {
super/*Any*/()
/* <init>() */
}
override fun foo() {
}
fun test() {
<this>.<get-a>() /*~> Unit */
<this>.foo()
}
override val a: Int
override get(): Int {
return 5
}
}
class F : KotlinInternal, JavaDefault {
constructor() /* primary */ {
super/*KotlinInternal*/()
/* <init>() */
}
override fun foo() {
}
fun test() {
<this>.<get-a>() /*~> Unit */
<this>.foo()
}
override val a: Int
override get(): Int {
return 5
}
}
class G : JavaPrivate, KotlinDefault {
constructor() /* primary */ {
super/*JavaPrivate*/()
/* <init>() */
}
fun test() {
<this>.<get-a>() /*~> Unit */
<this>.foo()
}
}
class H : JavaPrivate, KotlinDefault {
constructor() /* primary */ {
super/*JavaPrivate*/()
/* <init>() */
}
override fun foo() {
}
fun test() {
<this>.<get-a>() /*~> Unit */
<this>.foo()
}
override val a: Int
override get(): Int {
return 5
}
}
class I : JavaPrivate, KotlinPrivate {
constructor() /* primary */ {
super/*JavaPrivate*/()
/* <init>() */
}
}
class J : JavaPrivate, KotlinPublic {
constructor() /* primary */ {
super/*JavaPrivate*/()
/* <init>() */
}
fun test() {
<this>.<get-a>() /*~> Unit */
<this>.foo()
}
}
class K : JavaPrivate, KotlinPublic {
constructor() /* primary */ {
super/*JavaPrivate*/()
/* <init>() */
}
override fun foo() {
}
fun test() {
<this>.<get-a>() /*~> Unit */
<this>.foo()
}
override val a: Int
override get(): Int {
return 5
}
}
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 : JavaProtected, KotlinDefault {
constructor() /* primary */ {
super/*JavaProtected*/()
/* <init>() */
}
override fun foo() {
}
fun test() {
<this>(super<L>).#a /*~> Unit */
<this>.foo()
}
override val a: Int
override get(): Int {
return 5
}
}
class M : JavaProtected, KotlinPrivate {
constructor() /* primary */ {
super/*JavaProtected*/()
/* <init>() */
}
fun test() {
<this>(super<M>).#a /*~> Unit */
<this>.foo()
}
}
class N : JavaProtected, KotlinPrivate {
val a: Int
field = 5
get
constructor() /* primary */ {
super/*JavaProtected*/()
/* <init>() */
}
override fun foo() {
}
fun test() {
<this>(super<N>).#a /*~> Unit */
<this>.foo()
}
}
class O : JavaProtected, KotlinPublic {
constructor() /* primary */ {
super/*JavaProtected*/()
/* <init>() */
}
override fun foo() {
}
fun test() {
<this>(super<O>).#a /*~> Unit */
<this>.foo()
}
override val a: Int
override get(): Int {
return 5
}
}
class P : JavaPublic, KotlinDefault {
constructor() /* primary */ {
super/*Any*/()
/* <init>() */
}
override fun foo() {
}
fun test() {
<this>.<get-a>() /*~> Unit */
<this>.foo()
}
override val a: Int
override get(): Int {
return 5
}
}
class Q : JavaPublic, KotlinPrivate {
val a: Int
field = 5
get
constructor() /* primary */ {
super/*Any*/()
/* <init>() */
}
override fun foo() {
}
fun test() {
<this>.<get-a>() /*~> Unit */
<this>.foo()
}
}
class R : KotlinProtected, JavaPublic {
constructor() /* primary */ {
super/*KotlinProtected*/()
/* <init>() */
}
override fun foo() {
}
fun test() {
<this>.<get-a>() /*~> Unit */
<this>.foo()
}
protected override val a: Int
protected override get(): Int {
return 5
}
}
class S : JavaPublic, KotlinPublic {
constructor() /* primary */ {
super/*Any*/()
/* <init>() */
}
override fun foo() {
}
fun test() {
<this>.<get-a>() /*~> Unit */
<this>.foo()
}
override val a: Int
override get(): Int {
return 5
}
}
class T : KotlinInternal, JavaPublic {
constructor() /* primary */ {
super/*KotlinInternal*/()
/* <init>() */
}
override fun foo() {
}
fun test() {
<this>.<get-a>() /*~> Unit */
<this>.foo()
}
internal override val a: Int
internal override get(): Int {
return 5
}
}
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, h: H, j: J, k: K, l: L, m: M, n: N, o: O, p: P, q: Q, r: R, s: S, t: T) {
a.foo()
a.<get-a>() /*~> Unit */
a.test()
b.foo()
b.test()
c.foo()
c.test()
d.foo()
d.foo()
e.foo()
e.<get-a>() /*~> Unit */
e.test()
f.foo()
f.<get-a>() /*~> Unit */
f.test()
h.foo()
h.<get-a>() /*~> Unit */
h.test()
j.foo()
j.<get-a>() /*~> Unit */
j.test()
k.foo()
k.<get-a>() /*~> Unit */
k.test()
l.foo()
l(super<L>).#a /*~> Unit */
l.test()
m.foo()
m(super<M>).#a /*~> Unit */
m.test()
n.foo()
n(super<N>).#a /*~> Unit */
n.test()
o.foo()
o(super<O>).#a /*~> Unit */
o.test()
p.foo()
p.<get-a>() /*~> Unit */
p.test()
q.foo()
q.test()
r.foo()
r.test()
s.foo()
s.test()
s.<get-a>() /*~> Unit */
t.foo()
t.test()
t.<get-a>() /*~> Unit */
}