Regression tests #KT-8168 Obsolete
This commit is contained in:
@@ -0,0 +1,17 @@
|
||||
// FILE: P.java
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class P {
|
||||
public List<Integer> getList() {
|
||||
return new ArrayList<Integer>();
|
||||
}
|
||||
}
|
||||
|
||||
// FILE: Test.kt
|
||||
|
||||
fun foo(c: P): MutableList<Int> {
|
||||
// Error should be here: see KT-8168 Typechecker fails for platform collection type
|
||||
return c.getList() ?: <!TYPE_INFERENCE_EXPECTED_TYPE_MISMATCH, TYPE_MISMATCH!>listOf()<!>
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
package
|
||||
|
||||
public fun foo(/*0*/ c: P): kotlin.collections.MutableList<kotlin.Int>
|
||||
|
||||
public open class P {
|
||||
public constructor P()
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open fun getList(): kotlin.collections.(Mutable)List<kotlin.Int!>!
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
// FILE: Java.java
|
||||
|
||||
import java.util.List;
|
||||
|
||||
class Java {
|
||||
public static List<Integer> get(List<Integer> o) { return o; }
|
||||
}
|
||||
|
||||
// FILE: test.kt
|
||||
|
||||
import java.util.ArrayList
|
||||
|
||||
fun call(): List<Int> {
|
||||
// No errors should be here
|
||||
return Java.get(if (true) ArrayList<Int>() else listOf(0))
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
package
|
||||
|
||||
public fun call(): kotlin.collections.List<kotlin.Int>
|
||||
|
||||
public/*package*/ open class Java {
|
||||
public/*package*/ constructor Java()
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
|
||||
// Static members
|
||||
public open operator fun get(/*0*/ o: kotlin.collections.(Mutable)List<kotlin.Int!>!): kotlin.collections.(Mutable)List<kotlin.Int!>!
|
||||
}
|
||||
@@ -65,12 +65,24 @@ public class DiagnosticsTestWithStdLibGenerated extends AbstractDiagnosticsTestW
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("elvisOnJavaList.kt")
|
||||
public void testElvisOnJavaList() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/diagnostics/testsWithStdLib/elvisOnJavaList.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("elvisOnUnitInLet.kt")
|
||||
public void testElvisOnUnitInLet() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/diagnostics/testsWithStdLib/elvisOnUnitInLet.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("ifElseJavaList.kt")
|
||||
public void testIfElseJavaList() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/diagnostics/testsWithStdLib/ifElseJavaList.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("implicitCastToAny.kt")
|
||||
public void testImplicitCastToAny() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/diagnostics/testsWithStdLib/implicitCastToAny.kt");
|
||||
|
||||
Reference in New Issue
Block a user