Add a test

This commit is contained in:
Georgy Bronnikov
2019-02-04 17:03:38 +03:00
parent 3531f47bfb
commit 67656a447a
5 changed files with 119 additions and 2 deletions
@@ -1,5 +1,3 @@
// KT-4145
interface A {
fun foo(): Any
}
+104
View File
@@ -0,0 +1,104 @@
// TARGET_BACKEND: JVM
// IGNORE_BACKEND: JVM_IR
// FILE: J.java
import java.util.*;
public class J {
public static String foo() {
List list = new KList();
if (!list.remove(0).equals("OK")) return "fail";
return "OK";
}
}
// FILE: test.kt
class KList : MutableList<String> {
override val size: Int
get() = throw UnsupportedOperationException()
override fun isEmpty(): Boolean {
throw UnsupportedOperationException()
}
override fun contains(o: String): Boolean {
throw UnsupportedOperationException()
}
override fun containsAll(c: Collection<String>): Boolean {
throw UnsupportedOperationException()
}
override fun get(index: Int): String {
throw UnsupportedOperationException()
}
override fun indexOf(o: String): Int {
throw UnsupportedOperationException()
}
override fun lastIndexOf(o: String): Int {
throw UnsupportedOperationException()
}
override fun iterator(): MutableIterator<String> {
throw UnsupportedOperationException()
}
override fun add(e: String): Boolean {
throw UnsupportedOperationException()
}
override fun remove(o: String): Boolean {
throw UnsupportedOperationException()
}
override fun addAll(c: Collection<String>): Boolean {
throw UnsupportedOperationException()
}
override fun addAll(index: Int, c: Collection<String>): Boolean {
throw UnsupportedOperationException()
}
override fun removeAll(c: Collection<String>): Boolean {
throw UnsupportedOperationException()
}
override fun retainAll(c: Collection<String>): Boolean {
throw UnsupportedOperationException()
}
override fun clear() {
throw UnsupportedOperationException()
}
override fun set(index: Int, element: String): String {
throw UnsupportedOperationException()
}
override fun add(index: Int, element: String) {
throw UnsupportedOperationException()
}
override fun removeAt(index: Int): String {
return "OK"
}
override fun listIterator(): MutableListIterator<String> {
throw UnsupportedOperationException()
}
override fun listIterator(index: Int): MutableListIterator<String> {
throw UnsupportedOperationException()
}
override fun subList(fromIndex: Int, toIndex: Int): MutableList<String> {
throw UnsupportedOperationException()
}
}
fun box() = J.foo()
@@ -1411,6 +1411,11 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest {
runTest("compiler/testData/codegen/box/bridges/strListContains.kt");
}
@TestMetadata("strListRemove.kt")
public void testStrListRemove() throws Exception {
runTest("compiler/testData/codegen/box/bridges/strListRemove.kt");
}
@TestMetadata("traitImplInheritsTraitImpl.kt")
public void testTraitImplInheritsTraitImpl() throws Exception {
runTest("compiler/testData/codegen/box/bridges/traitImplInheritsTraitImpl.kt");
@@ -1411,6 +1411,11 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes
runTest("compiler/testData/codegen/box/bridges/strListContains.kt");
}
@TestMetadata("strListRemove.kt")
public void testStrListRemove() throws Exception {
runTest("compiler/testData/codegen/box/bridges/strListRemove.kt");
}
@TestMetadata("traitImplInheritsTraitImpl.kt")
public void testTraitImplInheritsTraitImpl() throws Exception {
runTest("compiler/testData/codegen/box/bridges/traitImplInheritsTraitImpl.kt");
@@ -1411,6 +1411,11 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes
runTest("compiler/testData/codegen/box/bridges/strListContains.kt");
}
@TestMetadata("strListRemove.kt")
public void testStrListRemove() throws Exception {
runTest("compiler/testData/codegen/box/bridges/strListRemove.kt");
}
@TestMetadata("traitImplInheritsTraitImpl.kt")
public void testTraitImplInheritsTraitImpl() throws Exception {
runTest("compiler/testData/codegen/box/bridges/traitImplInheritsTraitImpl.kt");