[IrFakeOverrideBuilder] Consolidate visibility handling
Now fake overrides declarations invisible for override are totally ignored by FakeOverrideBuilder, instead of creating fake overrides for them, and than filtering them out later. As side-effect it fixes KT-64972. ^KT-64974
This commit is contained in:
committed by
Space Team
parent
104e6a9b7c
commit
e6fd523431
+39
-18
@@ -3,43 +3,64 @@
|
||||
// VERSION: 1
|
||||
|
||||
open class X {
|
||||
private fun foo() = "private in super"
|
||||
fun bar() = foo()
|
||||
private fun foo1() = "private in super"
|
||||
fun testX1() = foo1()
|
||||
private fun foo2() = "private in super"
|
||||
fun testX2() = foo2()
|
||||
|
||||
private val zeg = "private in super"
|
||||
fun lim() = zeg
|
||||
private val val1 = "private in super"
|
||||
fun testX3() = val1
|
||||
private val val2 = "private in super"
|
||||
fun testX4() = val2
|
||||
}
|
||||
|
||||
// FILE: B.kt
|
||||
// VERSION: 2
|
||||
|
||||
open class X {
|
||||
public fun foo() = "public in super"
|
||||
fun bar() = foo()
|
||||
public fun foo1() = "public in super"
|
||||
fun testX1() = foo1()
|
||||
open public fun foo2() = "public in super"
|
||||
fun testX2() = foo2()
|
||||
|
||||
private val zeg = "public in super"
|
||||
fun lim() = zeg
|
||||
public val val1 = "public in super"
|
||||
fun testX3() = val1
|
||||
open public val val2 = "public in super"
|
||||
fun testX4() = val2
|
||||
}
|
||||
|
||||
// MODULE: mainLib(lib)
|
||||
// FILE: mainLib.kt
|
||||
|
||||
class Y: X() {
|
||||
private fun foo() = "private in derived"
|
||||
fun qux() = foo()
|
||||
private fun foo1() = "private in derived"
|
||||
fun testY1() = foo1()
|
||||
private fun foo2() = "private in derived"
|
||||
fun testY2() = foo2()
|
||||
|
||||
private val val1 = "private in derived"
|
||||
fun testY3() = val1
|
||||
private val val2 = "private in derived"
|
||||
fun testY4() = val2
|
||||
|
||||
private val zeg = "private in derived"
|
||||
fun tes() = zeg
|
||||
}
|
||||
|
||||
fun lib(): String = when {
|
||||
X().bar() != "public in super" -> "fail 1"
|
||||
Y().bar() != "public in super" -> "fail 2"
|
||||
Y().qux() != "private in derived" -> "fail 3"
|
||||
X().testX1() != "public in super" -> "fail X().testX1()"
|
||||
Y().testX1() != "public in super" -> "fail Y().testX1()"
|
||||
Y().testY1() != "private in derived" -> "fail Y().testY1()"
|
||||
|
||||
X().lim() != "public in super" -> "fail 4"
|
||||
Y().lim() != "public in super" -> "fail 5"
|
||||
Y().tes() != "private in derived" -> "fail 6"
|
||||
X().testX2() != "public in super" -> "fail X().testX2()"
|
||||
Y().testX2() != "public in super" -> "fail Y().testX2()"
|
||||
Y().testY2() != "private in derived" -> "fail Y().testY2()"
|
||||
|
||||
X().testX3() != "public in super" -> "fail X().testX3()"
|
||||
Y().testX3() != "public in super" -> "fail Y().testX3()"
|
||||
Y().testY3() != "private in derived" -> "fail Y().testY3()"
|
||||
|
||||
X().testX4() != "public in super" -> "fail X().testX4()"
|
||||
Y().testX4() != "public in super" -> "fail Y().testX4()"
|
||||
Y().testY4() != "private in derived" -> "fail Y().testY4()"
|
||||
|
||||
else -> "OK"
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user