FIR: Support java array in type argument

^KT-37321 Fixed
This commit is contained in:
Denis Zharkov
2020-05-20 16:13:35 +03:00
parent 164b4dd439
commit 4d484dd971
16 changed files with 105 additions and 44 deletions
@@ -1,15 +0,0 @@
// FILE: Inv.java
public class Inv<T> {}
// FILE: A.java
public class A {
public static Inv<String[]> KEY = new Inv<>();
}
// FILE: main.kt
fun test() {
val key = A.KEY
}
@@ -1,4 +0,0 @@
FILE: main.kt
public final fun test(): R|kotlin/Unit| {
lval key: R|ft<Inv<<error>>, Inv<<error>>?>!| = Q|A|.R|/A.KEY|
}
@@ -0,0 +1,19 @@
// FILE: DataKey.java
public class DataKey<T> {}
// FILE: Keys.java
public class Keys {
public static final DataKey<String[]> X = null;
public static final DataKey<String> Y = null;
public static <T> T getData(DataKey<T> key) {
return null;
}
}
// FILE: main.kt
fun main() {
// Keys.X type loaded as DataKey<error>
Keys.getData(Keys.X)[0].length
Keys.getData(Keys.Y).length
}
@@ -0,0 +1,5 @@
FILE: main.kt
public final fun main(): R|kotlin/Unit| {
Q|Keys|.R|/Keys.getData|<R|ft<kotlin/Array<ft<kotlin/String, kotlin/String?>!>, kotlin/Array<out ft<kotlin/String, kotlin/String?>!>?>!|>(Q|Keys|.R|/Keys.X|).R|FakeOverride<kotlin/Array.get: R|ft<kotlin/String, kotlin/String?>!|>|(Int(0)).R|kotlin/String.length|
Q|Keys|.R|/Keys.getData|<R|ft<kotlin/String, kotlin/String?>!|>(Q|Keys|.R|/Keys.Y|).R|kotlin/String.length|
}
@@ -1669,11 +1669,6 @@ public class FirDiagnosticsTestGenerated extends AbstractFirDiagnosticsTest {
runTest("compiler/fir/analysis-tests/testData/resolve/problems/javaAccessorConversion.kt");
}
@TestMetadata("javaArrayInGeneric.kt")
public void testJavaArrayInGeneric() throws Exception {
runTest("compiler/fir/analysis-tests/testData/resolve/problems/javaArrayInGeneric.kt");
}
@TestMetadata("javaQualifier.kt")
public void testJavaQualifier() throws Exception {
runTest("compiler/fir/analysis-tests/testData/resolve/problems/javaQualifier.kt");
@@ -2194,6 +2189,11 @@ public class FirDiagnosticsTestGenerated extends AbstractFirDiagnosticsTest {
KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/fir/analysis-tests/testData/resolve/stdlib/j+k"), Pattern.compile("^([^.]+)\\.kt$"), null, true);
}
@TestMetadata("ArrayInGenericArguments.kt")
public void testArrayInGenericArguments() throws Exception {
runTest("compiler/fir/analysis-tests/testData/resolve/stdlib/j+k/ArrayInGenericArguments.kt");
}
@TestMetadata("flexibleWildcard.kt")
public void testFlexibleWildcard() throws Exception {
runTest("compiler/fir/analysis-tests/testData/resolve/stdlib/j+k/flexibleWildcard.kt");
@@ -1669,11 +1669,6 @@ public class FirDiagnosticsWithLightTreeTestGenerated extends AbstractFirDiagnos
runTest("compiler/fir/analysis-tests/testData/resolve/problems/javaAccessorConversion.kt");
}
@TestMetadata("javaArrayInGeneric.kt")
public void testJavaArrayInGeneric() throws Exception {
runTest("compiler/fir/analysis-tests/testData/resolve/problems/javaArrayInGeneric.kt");
}
@TestMetadata("javaQualifier.kt")
public void testJavaQualifier() throws Exception {
runTest("compiler/fir/analysis-tests/testData/resolve/problems/javaQualifier.kt");
@@ -2194,6 +2189,11 @@ public class FirDiagnosticsWithLightTreeTestGenerated extends AbstractFirDiagnos
KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/fir/analysis-tests/testData/resolve/stdlib/j+k"), Pattern.compile("^([^.]+)\\.kt$"), null, true);
}
@TestMetadata("ArrayInGenericArguments.kt")
public void testArrayInGenericArguments() throws Exception {
runTest("compiler/fir/analysis-tests/testData/resolve/stdlib/j+k/ArrayInGenericArguments.kt");
}
@TestMetadata("flexibleWildcard.kt")
public void testFlexibleWildcard() throws Exception {
runTest("compiler/fir/analysis-tests/testData/resolve/stdlib/j+k/flexibleWildcard.kt");
@@ -28,6 +28,11 @@ public class FirTypeEnhancementTestGenerated extends AbstractFirTypeEnhancementT
KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/loadJava/compiledJava"), Pattern.compile("^(.+)\\.java$"), null, true);
}
@TestMetadata("ArrayInGenericArguments.java")
public void testArrayInGenericArguments() throws Exception {
runTest("compiler/testData/loadJava/compiledJava/ArrayInGenericArguments.java");
}
@TestMetadata("ArrayTypeVariance.java")
public void testArrayTypeVariance() throws Exception {
runTest("compiler/testData/loadJava/compiledJava/ArrayTypeVariance.java");