CommonSupertypes support for flexible types
This commit is contained in:
@@ -0,0 +1,41 @@
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER
|
||||
|
||||
// FILE: p/Super.java
|
||||
|
||||
package p;
|
||||
|
||||
public interface Super {
|
||||
|
||||
}
|
||||
|
||||
// FILE: p/Sub.java
|
||||
|
||||
package p;
|
||||
|
||||
public interface Sub extends Super {}
|
||||
|
||||
// FILE: p/Other.java
|
||||
|
||||
package p;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
public class Other {
|
||||
|
||||
public static Sub sub;
|
||||
|
||||
public static Collection<Sub> subs;
|
||||
public static Collection<Super> supers;
|
||||
}
|
||||
|
||||
// FILE: k.kt
|
||||
|
||||
import p.*
|
||||
|
||||
fun test() {
|
||||
val col = if (1 < 2) Other.subs else Other.supers
|
||||
col.foo()
|
||||
}
|
||||
|
||||
fun <T: Super> Collection<T>.foo(): T = null!!
|
||||
fun listOf<T>(t: T): List<T> = null!!
|
||||
@@ -7742,6 +7742,11 @@ public class JetDiagnosticsTestGenerated extends AbstractJetDiagnosticsTest {
|
||||
JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/diagnostics/tests/platformTypes/methodCall"), Pattern.compile("^(.+)\\.kt$"), true);
|
||||
}
|
||||
|
||||
@TestMetadata("inferenceWithBound.kt")
|
||||
public void testInferenceWithBound() throws Exception {
|
||||
doTest("compiler/testData/diagnostics/tests/platformTypes/methodCall/inferenceWithBound.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("int.kt")
|
||||
public void testInt() throws Exception {
|
||||
String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/platformTypes/methodCall/int.kt");
|
||||
|
||||
Reference in New Issue
Block a user