Support flexible types in DataFlowValues

This commit is contained in:
Andrey Breslav
2014-06-25 15:10:36 +04:00
parent f7de0e274c
commit 45c1fa3741
4 changed files with 36 additions and 1 deletions
@@ -80,7 +80,7 @@ public class DataFlowValueFactory {
@NotNull
private static Nullability getImmanentNullability(@NotNull JetType type) {
return type.isNullable() || TypeUtils.hasNullableSuperType(type) ? Nullability.UNKNOWN : Nullability.NOT_NULL;
return TypeUtils.isNullableType(type) ? Nullability.UNKNOWN : Nullability.NOT_NULL;
}
private static class IdentifierInfo {
@@ -0,0 +1,28 @@
// FILE: p/J.java
package p;
public class J {
public J j() {return null;}
public <T> T foo() {return null;}
public <T extends J> T foo1() {return null;}
}
// FILE: k.kt
import p.*
fun test(j: J) {
j.j() : J
j.j().j()
j.j()!!.j()
val ann = j.foo<String>()
ann!!.length
ann.length
val a = j.foo<J>()
a!!.j()
a.j()
}
@@ -7695,6 +7695,11 @@ public class JetDiagnosticsTestGenerated extends AbstractJetDiagnosticsTest {
JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/diagnostics/tests/platformTypes"), Pattern.compile("^(.+)\\.kt$"), true);
}
@TestMetadata("dereference.kt")
public void testDereference() throws Exception {
doTest("compiler/testData/diagnostics/tests/platformTypes/dereference.kt");
}
@TestMetadata("compiler/testData/diagnostics/tests/platformTypes/methodCall")
@TestDataPath("$PROJECT_ROOT")
@RunWith(org.jetbrains.jet.JUnit3RunnerWithInners.class)
@@ -21,6 +21,8 @@ public trait FlexibleType : JetType {
val upperBound: JetType
}
public fun JetType.isFlexible(): Boolean = this is FlexibleType
public open class DelegatingFlexibleType(
override val lowerBound: JetType,
override val upperBound: JetType