[Private fake overrides] Tests for private fake overrides construction
This commit is contained in:
Generated
+10
@@ -11761,6 +11761,16 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT
|
|||||||
runTest("compiler/testData/codegen/box/fakeOverride/function.kt");
|
runTest("compiler/testData/codegen/box/fakeOverride/function.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("privateFakeOverrides0.kt")
|
||||||
|
public void testPrivateFakeOverrides0() throws Exception {
|
||||||
|
runTest("compiler/testData/codegen/box/fakeOverride/privateFakeOverrides0.kt");
|
||||||
|
}
|
||||||
|
|
||||||
|
@TestMetadata("privateFakeOverrides1.kt")
|
||||||
|
public void testPrivateFakeOverrides1() throws Exception {
|
||||||
|
runTest("compiler/testData/codegen/box/fakeOverride/privateFakeOverrides1.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("propertyGetter.kt")
|
@TestMetadata("propertyGetter.kt")
|
||||||
public void testPropertyGetter() throws Exception {
|
public void testPropertyGetter() throws Exception {
|
||||||
runTest("compiler/testData/codegen/box/fakeOverride/propertyGetter.kt");
|
runTest("compiler/testData/codegen/box/fakeOverride/propertyGetter.kt");
|
||||||
|
|||||||
@@ -0,0 +1,59 @@
|
|||||||
|
// MODULE: lib
|
||||||
|
// FILE: lib.kt
|
||||||
|
// WITH_RUNTIME
|
||||||
|
|
||||||
|
import kotlin.test.assertEquals
|
||||||
|
|
||||||
|
// Private classes
|
||||||
|
private open class A {
|
||||||
|
public fun foo1() = "PASS"
|
||||||
|
internal fun foo2() = "PASS"
|
||||||
|
protected fun foo3() = "PASS"
|
||||||
|
}
|
||||||
|
|
||||||
|
private class B:A() {
|
||||||
|
fun foo4() = foo3()
|
||||||
|
}
|
||||||
|
|
||||||
|
// Private interfaces
|
||||||
|
private interface C {
|
||||||
|
fun foo() = "PASS"
|
||||||
|
}
|
||||||
|
|
||||||
|
private class D: C
|
||||||
|
|
||||||
|
fun runner(): String {
|
||||||
|
assertEquals(B().foo1(), "PASS")
|
||||||
|
assertEquals(B().foo2(), "PASS")
|
||||||
|
assertEquals(B().foo4(), "PASS")
|
||||||
|
|
||||||
|
assertEquals(D().foo(), "PASS")
|
||||||
|
|
||||||
|
// Objects
|
||||||
|
object : A(){
|
||||||
|
fun foo4() = foo3()
|
||||||
|
}.apply {
|
||||||
|
assertEquals(foo1(), "PASS")
|
||||||
|
assertEquals(foo2(), "PASS")
|
||||||
|
assertEquals(foo4(), "PASS")
|
||||||
|
}
|
||||||
|
|
||||||
|
// Function local classes
|
||||||
|
abstract class E {
|
||||||
|
public open fun foo1() = "PASS"
|
||||||
|
internal open fun foo2() = "PASS"
|
||||||
|
protected open fun foo3() = "PASS"
|
||||||
|
}
|
||||||
|
class F : E() {
|
||||||
|
fun foo4() = foo3()
|
||||||
|
}
|
||||||
|
assertEquals(F().foo1(), "PASS")
|
||||||
|
assertEquals(F().foo2(), "PASS")
|
||||||
|
assertEquals(F().foo4(), "PASS")
|
||||||
|
return("OK")
|
||||||
|
}
|
||||||
|
|
||||||
|
// MODULE: main(lib)
|
||||||
|
// FILE: main.kt
|
||||||
|
fun box() = runner()
|
||||||
|
|
||||||
@@ -0,0 +1,103 @@
|
|||||||
|
// MODULE: lib
|
||||||
|
// FILE: lib.kt
|
||||||
|
// WITH_RUNTIME
|
||||||
|
|
||||||
|
import kotlin.test.assertEquals
|
||||||
|
|
||||||
|
// Private classes
|
||||||
|
private open class A {
|
||||||
|
public open fun foo1() = "FAIL"
|
||||||
|
internal open fun foo2() = "FAIL"
|
||||||
|
protected open fun foo3() = "FAIL"
|
||||||
|
private fun foo4() = "FAIL"
|
||||||
|
}
|
||||||
|
|
||||||
|
private class B:A() {
|
||||||
|
override public fun foo1() = "PASS"
|
||||||
|
override internal fun foo2() = "PASS"
|
||||||
|
override protected fun foo3() = "PASS"
|
||||||
|
private fun foo4() = "PASS"
|
||||||
|
fun foo5() = foo3()
|
||||||
|
fun foo6() = foo4()
|
||||||
|
}
|
||||||
|
|
||||||
|
private abstract class G {
|
||||||
|
public abstract fun foo1()
|
||||||
|
internal abstract fun foo2()
|
||||||
|
protected abstract fun foo3()
|
||||||
|
private fun foo4() = "FAIL"
|
||||||
|
}
|
||||||
|
|
||||||
|
private class H:A() {
|
||||||
|
override public fun foo1() = "PASS"
|
||||||
|
override internal fun foo2() = "PASS"
|
||||||
|
override protected fun foo3() = "PASS"
|
||||||
|
private fun foo4() = "PASS"
|
||||||
|
fun foo5() = foo3()
|
||||||
|
fun foo6() = foo4()
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Private interfaces
|
||||||
|
private interface C {
|
||||||
|
fun foo() = "FAIL"
|
||||||
|
}
|
||||||
|
|
||||||
|
private class D: C {
|
||||||
|
override fun foo() = "PASS"
|
||||||
|
}
|
||||||
|
|
||||||
|
fun runner(): String {
|
||||||
|
assertEquals(B().foo1(), "PASS")
|
||||||
|
assertEquals(B().foo2(), "PASS")
|
||||||
|
assertEquals(B().foo5(), "PASS")
|
||||||
|
assertEquals(B().foo6(), "PASS")
|
||||||
|
|
||||||
|
assertEquals(H().foo1(), "PASS")
|
||||||
|
assertEquals(H().foo2(), "PASS")
|
||||||
|
assertEquals(H().foo5(), "PASS")
|
||||||
|
assertEquals(H().foo6(), "PASS")
|
||||||
|
|
||||||
|
assertEquals(D().foo(), "PASS")
|
||||||
|
|
||||||
|
// Objects
|
||||||
|
object : A(){
|
||||||
|
override public fun foo1() = "PASS"
|
||||||
|
override internal fun foo2() = "PASS"
|
||||||
|
override protected fun foo3() = "PASS"
|
||||||
|
private fun foo4() = "PASS"
|
||||||
|
fun foo5() = foo3()
|
||||||
|
fun foo6() = foo4()
|
||||||
|
}.apply {
|
||||||
|
assertEquals(foo1(), "PASS")
|
||||||
|
assertEquals(foo2(), "PASS")
|
||||||
|
assertEquals(foo5(), "PASS")
|
||||||
|
assertEquals(foo6(), "PASS")
|
||||||
|
}
|
||||||
|
|
||||||
|
// Function local classes
|
||||||
|
open class E {
|
||||||
|
public open fun foo1() = "FAIL"
|
||||||
|
internal open fun foo2() = "FAIL"
|
||||||
|
protected open fun foo3() = "FAIL"
|
||||||
|
private fun foo4() = "FAIL"
|
||||||
|
}
|
||||||
|
class F : E() {
|
||||||
|
public override fun foo1() = "PASS"
|
||||||
|
internal override fun foo2() = "PASS"
|
||||||
|
protected override fun foo3() = "PASS"
|
||||||
|
private fun foo4() = "PASS"
|
||||||
|
fun foo5() = foo3()
|
||||||
|
fun foo6() = foo4()
|
||||||
|
}
|
||||||
|
assertEquals(F().foo1(), "PASS")
|
||||||
|
assertEquals(F().foo2(), "PASS")
|
||||||
|
assertEquals(F().foo5(), "PASS")
|
||||||
|
assertEquals(F().foo6(), "PASS")
|
||||||
|
|
||||||
|
return "OK"
|
||||||
|
}
|
||||||
|
|
||||||
|
// MODULE: main(lib)
|
||||||
|
// FILE: main.kt
|
||||||
|
fun box() = runner()
|
||||||
+10
@@ -13161,6 +13161,16 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest {
|
|||||||
runTest("compiler/testData/codegen/box/fakeOverride/function.kt");
|
runTest("compiler/testData/codegen/box/fakeOverride/function.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("privateFakeOverrides0.kt")
|
||||||
|
public void testPrivateFakeOverrides0() throws Exception {
|
||||||
|
runTest("compiler/testData/codegen/box/fakeOverride/privateFakeOverrides0.kt");
|
||||||
|
}
|
||||||
|
|
||||||
|
@TestMetadata("privateFakeOverrides1.kt")
|
||||||
|
public void testPrivateFakeOverrides1() throws Exception {
|
||||||
|
runTest("compiler/testData/codegen/box/fakeOverride/privateFakeOverrides1.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("propertyGetter.kt")
|
@TestMetadata("propertyGetter.kt")
|
||||||
public void testPropertyGetter() throws Exception {
|
public void testPropertyGetter() throws Exception {
|
||||||
runTest("compiler/testData/codegen/box/fakeOverride/propertyGetter.kt");
|
runTest("compiler/testData/codegen/box/fakeOverride/propertyGetter.kt");
|
||||||
|
|||||||
+10
@@ -13161,6 +13161,16 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes
|
|||||||
runTest("compiler/testData/codegen/box/fakeOverride/function.kt");
|
runTest("compiler/testData/codegen/box/fakeOverride/function.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("privateFakeOverrides0.kt")
|
||||||
|
public void testPrivateFakeOverrides0() throws Exception {
|
||||||
|
runTest("compiler/testData/codegen/box/fakeOverride/privateFakeOverrides0.kt");
|
||||||
|
}
|
||||||
|
|
||||||
|
@TestMetadata("privateFakeOverrides1.kt")
|
||||||
|
public void testPrivateFakeOverrides1() throws Exception {
|
||||||
|
runTest("compiler/testData/codegen/box/fakeOverride/privateFakeOverrides1.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("propertyGetter.kt")
|
@TestMetadata("propertyGetter.kt")
|
||||||
public void testPropertyGetter() throws Exception {
|
public void testPropertyGetter() throws Exception {
|
||||||
runTest("compiler/testData/codegen/box/fakeOverride/propertyGetter.kt");
|
runTest("compiler/testData/codegen/box/fakeOverride/propertyGetter.kt");
|
||||||
|
|||||||
+10
@@ -11761,6 +11761,16 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes
|
|||||||
runTest("compiler/testData/codegen/box/fakeOverride/function.kt");
|
runTest("compiler/testData/codegen/box/fakeOverride/function.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("privateFakeOverrides0.kt")
|
||||||
|
public void testPrivateFakeOverrides0() throws Exception {
|
||||||
|
runTest("compiler/testData/codegen/box/fakeOverride/privateFakeOverrides0.kt");
|
||||||
|
}
|
||||||
|
|
||||||
|
@TestMetadata("privateFakeOverrides1.kt")
|
||||||
|
public void testPrivateFakeOverrides1() throws Exception {
|
||||||
|
runTest("compiler/testData/codegen/box/fakeOverride/privateFakeOverrides1.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("propertyGetter.kt")
|
@TestMetadata("propertyGetter.kt")
|
||||||
public void testPropertyGetter() throws Exception {
|
public void testPropertyGetter() throws Exception {
|
||||||
runTest("compiler/testData/codegen/box/fakeOverride/propertyGetter.kt");
|
runTest("compiler/testData/codegen/box/fakeOverride/propertyGetter.kt");
|
||||||
|
|||||||
Generated
+10
@@ -10076,6 +10076,16 @@ public class IrJsCodegenBoxES6TestGenerated extends AbstractIrJsCodegenBoxES6Tes
|
|||||||
runTest("compiler/testData/codegen/box/fakeOverride/function.kt");
|
runTest("compiler/testData/codegen/box/fakeOverride/function.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("privateFakeOverrides0.kt")
|
||||||
|
public void testPrivateFakeOverrides0() throws Exception {
|
||||||
|
runTest("compiler/testData/codegen/box/fakeOverride/privateFakeOverrides0.kt");
|
||||||
|
}
|
||||||
|
|
||||||
|
@TestMetadata("privateFakeOverrides1.kt")
|
||||||
|
public void testPrivateFakeOverrides1() throws Exception {
|
||||||
|
runTest("compiler/testData/codegen/box/fakeOverride/privateFakeOverrides1.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("propertyGetter.kt")
|
@TestMetadata("propertyGetter.kt")
|
||||||
public void testPropertyGetter() throws Exception {
|
public void testPropertyGetter() throws Exception {
|
||||||
runTest("compiler/testData/codegen/box/fakeOverride/propertyGetter.kt");
|
runTest("compiler/testData/codegen/box/fakeOverride/propertyGetter.kt");
|
||||||
|
|||||||
Generated
+10
@@ -10076,6 +10076,16 @@ public class IrJsCodegenBoxTestGenerated extends AbstractIrJsCodegenBoxTest {
|
|||||||
runTest("compiler/testData/codegen/box/fakeOverride/function.kt");
|
runTest("compiler/testData/codegen/box/fakeOverride/function.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("privateFakeOverrides0.kt")
|
||||||
|
public void testPrivateFakeOverrides0() throws Exception {
|
||||||
|
runTest("compiler/testData/codegen/box/fakeOverride/privateFakeOverrides0.kt");
|
||||||
|
}
|
||||||
|
|
||||||
|
@TestMetadata("privateFakeOverrides1.kt")
|
||||||
|
public void testPrivateFakeOverrides1() throws Exception {
|
||||||
|
runTest("compiler/testData/codegen/box/fakeOverride/privateFakeOverrides1.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("propertyGetter.kt")
|
@TestMetadata("propertyGetter.kt")
|
||||||
public void testPropertyGetter() throws Exception {
|
public void testPropertyGetter() throws Exception {
|
||||||
runTest("compiler/testData/codegen/box/fakeOverride/propertyGetter.kt");
|
runTest("compiler/testData/codegen/box/fakeOverride/propertyGetter.kt");
|
||||||
|
|||||||
+10
@@ -10076,6 +10076,16 @@ public class JsCodegenBoxTestGenerated extends AbstractJsCodegenBoxTest {
|
|||||||
runTest("compiler/testData/codegen/box/fakeOverride/function.kt");
|
runTest("compiler/testData/codegen/box/fakeOverride/function.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("privateFakeOverrides0.kt")
|
||||||
|
public void testPrivateFakeOverrides0() throws Exception {
|
||||||
|
runTest("compiler/testData/codegen/box/fakeOverride/privateFakeOverrides0.kt");
|
||||||
|
}
|
||||||
|
|
||||||
|
@TestMetadata("privateFakeOverrides1.kt")
|
||||||
|
public void testPrivateFakeOverrides1() throws Exception {
|
||||||
|
runTest("compiler/testData/codegen/box/fakeOverride/privateFakeOverrides1.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("propertyGetter.kt")
|
@TestMetadata("propertyGetter.kt")
|
||||||
public void testPropertyGetter() throws Exception {
|
public void testPropertyGetter() throws Exception {
|
||||||
runTest("compiler/testData/codegen/box/fakeOverride/propertyGetter.kt");
|
runTest("compiler/testData/codegen/box/fakeOverride/propertyGetter.kt");
|
||||||
|
|||||||
Reference in New Issue
Block a user