Files
kotlin-fork/compiler/testData/diagnostics/testsWithStdLib/purelyImplementedCollection/customClassMutableList.fir.kt
T
Mikhail Glukhikh 7dca4d2fee [FIR TEST] Update test data for purely implements case (NB: broken)
In this case Java super type arguments should be not null, not flexible
2020-02-03 16:45:21 +03:00

42 lines
714 B
Kotlin
Vendored

// !DIAGNOSTICS: -UNUSED_VARIABLE
// !WITH_NEW_INFERENCE
// JAVAC_EXPECTED_FILE
import java.util.*;
// FILE: A.java
@kotlin.jvm.PurelyImplements("kotlin.collections.MutableList")
class A<T> extends AbstractList<T> {
@Override
public T get(int index) {
return null;
}
@Override
public int size() {
return 0;
}
}
// FILE: b.kt
fun bar(): String? = null
fun foo() {
var x = A<String>()
x.add(null)
x.add(bar())
x.add("")
x[0] = null
x[0] = bar()
x[0] = ""
val b1: MutableList<String?> = x
val b2: MutableList<String> = x
val b3: List<String?> = x
val b4: Collection<String?> = x
val b6: MutableCollection<String?> = x
}