[KT-4124] Add tests for qualified labeled super access to functions and properties
This commit is contained in:
@@ -0,0 +1,46 @@
|
|||||||
|
interface T {
|
||||||
|
open fun baz(): String = "T.baz"
|
||||||
|
}
|
||||||
|
|
||||||
|
open class A {
|
||||||
|
open val foo: String = "OK"
|
||||||
|
open fun bar(): String = "OK"
|
||||||
|
open fun boo(): String = "OK"
|
||||||
|
}
|
||||||
|
|
||||||
|
open class B : A(), T {
|
||||||
|
override fun bar(): String = "B"
|
||||||
|
override fun baz(): String = "B.baz"
|
||||||
|
inner class E {
|
||||||
|
val foo: String = super<A>@B.foo
|
||||||
|
fun bar() = super<A>@B.bar() + super@B.bar() + super@B.baz()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class C : B() {
|
||||||
|
override fun bar(): String = "C"
|
||||||
|
override fun boo(): String = "C"
|
||||||
|
inner class D {
|
||||||
|
val foo: String = super<B>@C.foo
|
||||||
|
fun bar() = super<B>@C.bar() + super<B>@C.boo()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fun box(): String {
|
||||||
|
var r = ""
|
||||||
|
|
||||||
|
r = B().E().foo
|
||||||
|
if (r != "OK") return "fail 1; r = $r"
|
||||||
|
r = ""
|
||||||
|
r = B().E().bar()
|
||||||
|
if (r != "OKOKT.baz") return "fail 2; r = $r"
|
||||||
|
|
||||||
|
r = ""
|
||||||
|
r = C().D().foo
|
||||||
|
if (r != "OK") return "fail 3; r = $r"
|
||||||
|
r = ""
|
||||||
|
r = C().D().bar()
|
||||||
|
if (r != "BOK") return "fail 4; r = $r"
|
||||||
|
|
||||||
|
return "OK"
|
||||||
|
}
|
||||||
@@ -0,0 +1,45 @@
|
|||||||
|
interface T {
|
||||||
|
open val baz: String
|
||||||
|
get() = "T.baz"
|
||||||
|
}
|
||||||
|
|
||||||
|
open class A {
|
||||||
|
open val bar: String
|
||||||
|
get() = "OK"
|
||||||
|
open val boo: String
|
||||||
|
get() = "OK"
|
||||||
|
}
|
||||||
|
|
||||||
|
open class B : A(), T {
|
||||||
|
override val bar: String
|
||||||
|
get() = "B"
|
||||||
|
override val baz: String
|
||||||
|
get() = "B.baz"
|
||||||
|
inner class E {
|
||||||
|
val bar: String
|
||||||
|
get() = super<A>@B.bar + super@B.bar + super@B.baz
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class C : B() {
|
||||||
|
override val bar: String
|
||||||
|
get() = "C"
|
||||||
|
override val boo: String
|
||||||
|
get() = "C"
|
||||||
|
inner class D {
|
||||||
|
val bar: String
|
||||||
|
get() = super<B>@C.bar + super<B>@C.boo
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fun box(): String {
|
||||||
|
var r = ""
|
||||||
|
|
||||||
|
r = B().E().bar
|
||||||
|
if (r != "OKOKT.baz") return "fail 1; r = $r"
|
||||||
|
|
||||||
|
r = C().D().bar
|
||||||
|
if (r != "BOK") return "fail 2; r = $r"
|
||||||
|
|
||||||
|
return "OK"
|
||||||
|
}
|
||||||
+12
@@ -7768,6 +7768,18 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest {
|
|||||||
doTest(fileName);
|
doTest(fileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("innerClassQualifiedFunctionCall.kt")
|
||||||
|
public void testInnerClassQualifiedFunctionCall() throws Exception {
|
||||||
|
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/super/innerClassQualifiedFunctionCall.kt");
|
||||||
|
doTest(fileName);
|
||||||
|
}
|
||||||
|
|
||||||
|
@TestMetadata("innerClassQualifiedPropertyAccess.kt")
|
||||||
|
public void testInnerClassQualifiedPropertyAccess() throws Exception {
|
||||||
|
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/super/innerClassQualifiedPropertyAccess.kt");
|
||||||
|
doTest(fileName);
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("kt3492ClassFun.kt")
|
@TestMetadata("kt3492ClassFun.kt")
|
||||||
public void testKt3492ClassFun() throws Exception {
|
public void testKt3492ClassFun() throws Exception {
|
||||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/super/kt3492ClassFun.kt");
|
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/super/kt3492ClassFun.kt");
|
||||||
|
|||||||
@@ -95,6 +95,18 @@ public class SuperTestGenerated extends AbstractSuperTest {
|
|||||||
doTest(fileName);
|
doTest(fileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("innerClassQualifiedFunctionCall.kt")
|
||||||
|
public void testInnerClassQualifiedFunctionCall() throws Exception {
|
||||||
|
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/super/innerClassQualifiedFunctionCall.kt");
|
||||||
|
doTest(fileName);
|
||||||
|
}
|
||||||
|
|
||||||
|
@TestMetadata("innerClassQualifiedPropertyAccess.kt")
|
||||||
|
public void testInnerClassQualifiedPropertyAccess() throws Exception {
|
||||||
|
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/super/innerClassQualifiedPropertyAccess.kt");
|
||||||
|
doTest(fileName);
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("kt3492ClassFun.kt")
|
@TestMetadata("kt3492ClassFun.kt")
|
||||||
public void testKt3492ClassFun() throws Exception {
|
public void testKt3492ClassFun() throws Exception {
|
||||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/super/kt3492ClassFun.kt");
|
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/super/kt3492ClassFun.kt");
|
||||||
|
|||||||
Reference in New Issue
Block a user