add more tests for bridge methods (fake override)
This commit is contained in:
@@ -0,0 +1,26 @@
|
|||||||
|
trait A<T> {
|
||||||
|
fun foo(t: T): String
|
||||||
|
}
|
||||||
|
|
||||||
|
trait B {
|
||||||
|
fun foo(t: Int) = "B"
|
||||||
|
}
|
||||||
|
|
||||||
|
class Z1 : A<Int>, B
|
||||||
|
|
||||||
|
class Z2 : B, A<Int>
|
||||||
|
|
||||||
|
fun box(): String {
|
||||||
|
val z1 = Z1()
|
||||||
|
val z2 = Z2()
|
||||||
|
|
||||||
|
return when {
|
||||||
|
z1.foo( 0) != "B" -> "Fail #1"
|
||||||
|
(z1 : A<Int>).foo( 0) != "B" -> "Fail #2"
|
||||||
|
(z1 : B).foo( 0) != "B" -> "Fail #3"
|
||||||
|
z2.foo( 0) != "B" -> "Fail #4"
|
||||||
|
(z2 : A<Int>).foo( 0) != "B" -> "Fail #5"
|
||||||
|
(z2 : B).foo( 0) != "B" -> "Fail #6"
|
||||||
|
else -> "OK"
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,26 @@
|
|||||||
|
trait A<T> {
|
||||||
|
fun foo(t: T): String
|
||||||
|
}
|
||||||
|
|
||||||
|
trait B<T : Number> {
|
||||||
|
fun foo(a: T) = "B"
|
||||||
|
}
|
||||||
|
|
||||||
|
class Z1 : A<Int>, B<Int>
|
||||||
|
|
||||||
|
class Z2 : B<Int>, A<Int>
|
||||||
|
|
||||||
|
fun box(): String {
|
||||||
|
val z1 = Z1()
|
||||||
|
val z2 = Z2()
|
||||||
|
|
||||||
|
return when {
|
||||||
|
z1.foo( 0) != "B" -> "Fail #1"
|
||||||
|
(z1 : A<Int>).foo( 0) != "B" -> "Fail #2"
|
||||||
|
(z1 : B<Int>).foo( 0) != "B" -> "Fail #3"
|
||||||
|
z2.foo( 0) != "B" -> "Fail #4"
|
||||||
|
(z2 : A<Int>).foo( 0) != "B" -> "Fail #5"
|
||||||
|
(z2 : B<Int>).foo( 0) != "B" -> "Fail #6"
|
||||||
|
else -> "OK"
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,28 @@
|
|||||||
|
trait A<T> {
|
||||||
|
fun foo(t: T): String
|
||||||
|
}
|
||||||
|
|
||||||
|
trait B {
|
||||||
|
fun foo(t: Int) = "B"
|
||||||
|
}
|
||||||
|
|
||||||
|
class Z : B
|
||||||
|
|
||||||
|
class Z1 : A<Int>, B by Z()
|
||||||
|
|
||||||
|
class Z2 : B by Z(), A<Int>
|
||||||
|
|
||||||
|
fun box(): String {
|
||||||
|
val z1 = Z1()
|
||||||
|
val z2 = Z2()
|
||||||
|
|
||||||
|
return when {
|
||||||
|
z1.foo( 0) != "B" -> "Fail #1"
|
||||||
|
(z1 : A<Int>).foo( 0) != "B" -> "Fail #2"
|
||||||
|
(z1 : B).foo( 0) != "B" -> "Fail #3"
|
||||||
|
z2.foo( 0) != "B" -> "Fail #4"
|
||||||
|
(z2 : A<Int>).foo( 0) != "B" -> "Fail #5"
|
||||||
|
(z2 : B).foo( 0) != "B" -> "Fail #6"
|
||||||
|
else -> "OK"
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -6,17 +6,24 @@ trait B<T, U> {
|
|||||||
fun foo(t: T, u: U) = "B"
|
fun foo(t: T, u: U) = "B"
|
||||||
}
|
}
|
||||||
|
|
||||||
class Z : A<String>, B<String, Int> {
|
class Z1 : A<String>, B<String, Int> {
|
||||||
override fun foo(t: String, u: Int) = "Z"
|
override fun foo(t: String, u: Int) = "Z1"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class Z2 : B<String, Int>, A<String> {
|
||||||
|
override fun foo(t: String, u: Int) = "Z2"
|
||||||
|
}
|
||||||
|
|
||||||
fun box(): String {
|
fun box(): String {
|
||||||
val z = Z()
|
val z1 = Z1()
|
||||||
|
val z2 = Z2()
|
||||||
return when {
|
return when {
|
||||||
z.foo("", 0) != "Z" -> "Fail #1"
|
z1.foo("", 0) != "Z1" -> "Fail #1"
|
||||||
(z : A<String>).foo("", 0) != "Z" -> "Fail #2"
|
(z1 : A<String>).foo("", 0) != "Z1" -> "Fail #2"
|
||||||
(z : B<String, Int>).foo("", 0) != "Z" -> "Fail #3"
|
(z1 : B<String, Int>).foo("", 0) != "Z1" -> "Fail #3"
|
||||||
|
z2.foo("", 0) != "Z2" -> "Fail #4"
|
||||||
|
(z2 : A<String>).foo("", 0) != "Z2" -> "Fail #5"
|
||||||
|
(z2 : B<String, Int>).foo("", 0) != "Z2" -> "Fail #6"
|
||||||
else -> "OK"
|
else -> "OK"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -374,12 +374,30 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest {
|
|||||||
doTest(fileName);
|
doTest(fileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("fakeGenericContravariantOverride1.kt")
|
||||||
|
public void testFakeGenericContravariantOverride1() throws Exception {
|
||||||
|
String fileName = JetTestUtils.navigationMetadata("compiler/testData/codegen/box/bridges/fakeGenericContravariantOverride1.kt");
|
||||||
|
doTest(fileName);
|
||||||
|
}
|
||||||
|
|
||||||
|
@TestMetadata("fakeGenericContravariantOverride2.kt")
|
||||||
|
public void testFakeGenericContravariantOverride2() throws Exception {
|
||||||
|
String fileName = JetTestUtils.navigationMetadata("compiler/testData/codegen/box/bridges/fakeGenericContravariantOverride2.kt");
|
||||||
|
doTest(fileName);
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("fakeGenericCovariantOverride.kt")
|
@TestMetadata("fakeGenericCovariantOverride.kt")
|
||||||
public void testFakeGenericCovariantOverride() throws Exception {
|
public void testFakeGenericCovariantOverride() throws Exception {
|
||||||
String fileName = JetTestUtils.navigationMetadata("compiler/testData/codegen/box/bridges/fakeGenericCovariantOverride.kt");
|
String fileName = JetTestUtils.navigationMetadata("compiler/testData/codegen/box/bridges/fakeGenericCovariantOverride.kt");
|
||||||
doTest(fileName);
|
doTest(fileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("fakeGenericCovariantOverrideWithDelegation.kt")
|
||||||
|
public void testFakeGenericCovariantOverrideWithDelegation() throws Exception {
|
||||||
|
String fileName = JetTestUtils.navigationMetadata("compiler/testData/codegen/box/bridges/fakeGenericCovariantOverrideWithDelegation.kt");
|
||||||
|
doTest(fileName);
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("fakeOverrideInTraitWithRequiredFromTraitImpl.kt")
|
@TestMetadata("fakeOverrideInTraitWithRequiredFromTraitImpl.kt")
|
||||||
public void testFakeOverrideInTraitWithRequiredFromTraitImpl() throws Exception {
|
public void testFakeOverrideInTraitWithRequiredFromTraitImpl() throws Exception {
|
||||||
String fileName = JetTestUtils.navigationMetadata("compiler/testData/codegen/box/bridges/fakeOverrideInTraitWithRequiredFromTraitImpl.kt");
|
String fileName = JetTestUtils.navigationMetadata("compiler/testData/codegen/box/bridges/fakeOverrideInTraitWithRequiredFromTraitImpl.kt");
|
||||||
|
|||||||
@@ -81,12 +81,30 @@ public class BridgeTestGenerated extends AbstractBridgeTest {
|
|||||||
doTest(fileName);
|
doTest(fileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("fakeGenericContravariantOverride1.kt")
|
||||||
|
public void testFakeGenericContravariantOverride1() throws Exception {
|
||||||
|
String fileName = JetTestUtils.navigationMetadata("compiler/testData/codegen/box/bridges/fakeGenericContravariantOverride1.kt");
|
||||||
|
doTest(fileName);
|
||||||
|
}
|
||||||
|
|
||||||
|
@TestMetadata("fakeGenericContravariantOverride2.kt")
|
||||||
|
public void testFakeGenericContravariantOverride2() throws Exception {
|
||||||
|
String fileName = JetTestUtils.navigationMetadata("compiler/testData/codegen/box/bridges/fakeGenericContravariantOverride2.kt");
|
||||||
|
doTest(fileName);
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("fakeGenericCovariantOverride.kt")
|
@TestMetadata("fakeGenericCovariantOverride.kt")
|
||||||
public void testFakeGenericCovariantOverride() throws Exception {
|
public void testFakeGenericCovariantOverride() throws Exception {
|
||||||
String fileName = JetTestUtils.navigationMetadata("compiler/testData/codegen/box/bridges/fakeGenericCovariantOverride.kt");
|
String fileName = JetTestUtils.navigationMetadata("compiler/testData/codegen/box/bridges/fakeGenericCovariantOverride.kt");
|
||||||
doTest(fileName);
|
doTest(fileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("fakeGenericCovariantOverrideWithDelegation.kt")
|
||||||
|
public void testFakeGenericCovariantOverrideWithDelegation() throws Exception {
|
||||||
|
String fileName = JetTestUtils.navigationMetadata("compiler/testData/codegen/box/bridges/fakeGenericCovariantOverrideWithDelegation.kt");
|
||||||
|
doTest(fileName);
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("fakeOverrideInTraitWithRequiredFromTraitImpl.kt")
|
@TestMetadata("fakeOverrideInTraitWithRequiredFromTraitImpl.kt")
|
||||||
public void testFakeOverrideInTraitWithRequiredFromTraitImpl() throws Exception {
|
public void testFakeOverrideInTraitWithRequiredFromTraitImpl() throws Exception {
|
||||||
String fileName = JetTestUtils.navigationMetadata("compiler/testData/codegen/box/bridges/fakeOverrideInTraitWithRequiredFromTraitImpl.kt");
|
String fileName = JetTestUtils.navigationMetadata("compiler/testData/codegen/box/bridges/fakeOverrideInTraitWithRequiredFromTraitImpl.kt");
|
||||||
|
|||||||
Reference in New Issue
Block a user