Support flexible types in DataFlowValues
This commit is contained in:
+1
-1
@@ -80,7 +80,7 @@ public class DataFlowValueFactory {
|
|||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
private static Nullability getImmanentNullability(@NotNull JetType type) {
|
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 {
|
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);
|
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")
|
@TestMetadata("compiler/testData/diagnostics/tests/platformTypes/methodCall")
|
||||||
@TestDataPath("$PROJECT_ROOT")
|
@TestDataPath("$PROJECT_ROOT")
|
||||||
@RunWith(org.jetbrains.jet.JUnit3RunnerWithInners.class)
|
@RunWith(org.jetbrains.jet.JUnit3RunnerWithInners.class)
|
||||||
|
|||||||
@@ -21,6 +21,8 @@ public trait FlexibleType : JetType {
|
|||||||
val upperBound: JetType
|
val upperBound: JetType
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public fun JetType.isFlexible(): Boolean = this is FlexibleType
|
||||||
|
|
||||||
public open class DelegatingFlexibleType(
|
public open class DelegatingFlexibleType(
|
||||||
override val lowerBound: JetType,
|
override val lowerBound: JetType,
|
||||||
override val upperBound: JetType
|
override val upperBound: JetType
|
||||||
|
|||||||
Reference in New Issue
Block a user