FIR IDE: add more tests about resolving reference to type parameters

This commit is contained in:
Jinseong Jeon
2021-11-12 12:04:06 -08:00
committed by Ilya Kirillov
parent 7f5eb3f5ff
commit d91170ed2c
17 changed files with 78 additions and 12 deletions
@@ -624,18 +624,6 @@ public class FirReferenceResolveTestGenerated extends AbstractFirReferenceResolv
runTest("analysis/analysis-api/testData/referenceResolve/TypeArgumentWrongNumber.kt");
}
@Test
@TestMetadata("TypeParameterInAnonymousObject.kt")
public void testTypeParameterInAnonymousObject() throws Exception {
runTest("analysis/analysis-api/testData/referenceResolve/TypeParameterInAnonymousObject.kt");
}
@Test
@TestMetadata("TypeParameterInFunctionLiteral.kt")
public void testTypeParameterInFunctionLiteral() throws Exception {
runTest("analysis/analysis-api/testData/referenceResolve/TypeParameterInFunctionLiteral.kt");
}
@Test
@TestMetadata("ValueParameter.kt")
public void testValueParameter() throws Exception {
@@ -1201,4 +1189,62 @@ public class FirReferenceResolveTestGenerated extends AbstractFirReferenceResolv
runTest("analysis/analysis-api/testData/referenceResolve/qualifiedAccess/ResolvePackageOfFullyQualifiedReference.kt");
}
}
@Nested
@TestMetadata("analysis/analysis-api/testData/referenceResolve/typeParameter")
@TestDataPath("$PROJECT_ROOT")
public class TypeParameter {
@Test
public void testAllFilesPresentInTypeParameter() throws Exception {
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("analysis/analysis-api/testData/referenceResolve/typeParameter"), Pattern.compile("^([^.]+)\\.kt$"), null, true);
}
@Test
@TestMetadata("multipleBounds.kt")
public void testMultipleBounds() throws Exception {
runTest("analysis/analysis-api/testData/referenceResolve/typeParameter/multipleBounds.kt");
}
@Test
@TestMetadata("reified_argumentInFunctionalType.kt")
public void testReified_argumentInFunctionalType() throws Exception {
runTest("analysis/analysis-api/testData/referenceResolve/typeParameter/reified_argumentInFunctionalType.kt");
}
@Test
@TestMetadata("reified_extensionReceiver.kt")
public void testReified_extensionReceiver() throws Exception {
runTest("analysis/analysis-api/testData/referenceResolve/typeParameter/reified_extensionReceiver.kt");
}
@Test
@TestMetadata("reified_returnType.kt")
public void testReified_returnType() throws Exception {
runTest("analysis/analysis-api/testData/referenceResolve/typeParameter/reified_returnType.kt");
}
@Test
@TestMetadata("reified_valueParameter.kt")
public void testReified_valueParameter() throws Exception {
runTest("analysis/analysis-api/testData/referenceResolve/typeParameter/reified_valueParameter.kt");
}
@Test
@TestMetadata("reified_valueParameter_vararg.kt")
public void testReified_valueParameter_vararg() throws Exception {
runTest("analysis/analysis-api/testData/referenceResolve/typeParameter/reified_valueParameter_vararg.kt");
}
@Test
@TestMetadata("TypeParameterInAnonymousObject.kt")
public void testTypeParameterInAnonymousObject() throws Exception {
runTest("analysis/analysis-api/testData/referenceResolve/typeParameter/TypeParameterInAnonymousObject.kt");
}
@Test
@TestMetadata("TypeParameterInFunctionLiteral.kt")
public void testTypeParameterInFunctionLiteral() throws Exception {
runTest("analysis/analysis-api/testData/referenceResolve/typeParameter/TypeParameterInFunctionLiteral.kt");
}
}
}
@@ -0,0 +1 @@
fun <T> function(t: <caret>T) where T : Int, T : Long = TODO()
@@ -0,0 +1,2 @@
Resolved to:
0: <T : kotlin.Int & kotlin.Long>
@@ -0,0 +1 @@
inline fun <reified T> functionWithLambda(t: T, process: (<caret>T) -> Int): Int = process(t)
@@ -0,0 +1,2 @@
Resolved to:
0: <reified T>
@@ -0,0 +1,3 @@
inline fun <reified T : Any> foo(init: <caret>T.() -> Unit = {}): T {
TODO("message")
}
@@ -0,0 +1,2 @@
Resolved to:
0: <reified T : kotlin.Any>
@@ -0,0 +1 @@
inline fun <reified T> function2(t: T, i: Int, s: String): <caret>T = t
@@ -0,0 +1,2 @@
Resolved to:
0: <reified T>
@@ -0,0 +1 @@
inline fun <reified T> functionWithLambda(t: <caret>T, process: (T) -> Int): Int = process(t)
@@ -0,0 +1,2 @@
Resolved to:
0: <reified T>
@@ -0,0 +1 @@
inline fun <reified T> functionWithVararg(i: Int?, vararg t: <caret>T): T = t[0]
@@ -0,0 +1,2 @@
Resolved to:
0: <reified T>