[AA] support qualified type in incomplete code

^ KTIJ-24373
when resolving selector expr of a dot qualified expression,
parent qualified expression is resolved
see `KtFirCallResolver.getContainingDotQualifiedExpressionForSelectorExpression`,
Fir is filled with the data. Then,
during final mapping from Fir -> psi, one need to perform the opposite:
take `selectionExpression` to get the initial KtCallExpression
This commit is contained in:
Anna Kozlova
2023-01-24 10:39:25 +01:00
committed by teamcity
parent 92d39f0b1d
commit fd52cc4224
7 changed files with 39 additions and 6 deletions
@@ -917,6 +917,12 @@ public class Fe10IdeNormalAnalysisSourceModuleResolveCallTestGenerated extends A
runTest("analysis/analysis-api/testData/components/callResolver/resolveCall/invalidCode/incompleteCodeNoParenthesis.kt");
}
@Test
@TestMetadata("incompleteCodeNoParenthesisDotQualifier.kt")
public void testIncompleteCodeNoParenthesisDotQualifier() throws Exception {
runTest("analysis/analysis-api/testData/components/callResolver/resolveCall/invalidCode/incompleteCodeNoParenthesisDotQualifier.kt");
}
@Test
@TestMetadata("incompleteCodeWithAmbiguity.kt")
public void testIncompleteCodeWithAmbiguity() throws Exception {
@@ -149,12 +149,15 @@ internal class KtFirCallResolver(
createGenericTypeQualifierCallIfApplicable(this, psi)?.let { return it }
if (this is FirResolvedQualifier && psi is KtCallExpression) {
val constructors = findQualifierConstructors()
val calls = toKtCalls(constructors)
return when (calls.size) {
0 -> KtErrorCallInfo(listOf(KtQualifierCall(token, psi)), inapplicableCandidateDiagnostic(), token)
else -> KtErrorCallInfo(calls, inapplicableCandidateDiagnostic(), token)
if (this is FirResolvedQualifier) {
val callExpression = (psi as? KtExpression)?.getPossiblyQualifiedCallExpression()
if (callExpression != null) {
val constructors = findQualifierConstructors()
val calls = toKtCalls(constructors)
return when (calls.size) {
0 -> KtErrorCallInfo(listOf(KtQualifierCall(token, callExpression)), inapplicableCandidateDiagnostic(), token)
else -> KtErrorCallInfo(calls, inapplicableCandidateDiagnostic(), token)
}
}
}
@@ -917,6 +917,12 @@ public class FirIdeNormalAnalysisSourceModuleResolveCallTestGenerated extends Ab
runTest("analysis/analysis-api/testData/components/callResolver/resolveCall/invalidCode/incompleteCodeNoParenthesis.kt");
}
@Test
@TestMetadata("incompleteCodeNoParenthesisDotQualifier.kt")
public void testIncompleteCodeNoParenthesisDotQualifier() throws Exception {
runTest("analysis/analysis-api/testData/components/callResolver/resolveCall/invalidCode/incompleteCodeNoParenthesisDotQualifier.kt");
}
@Test
@TestMetadata("incompleteCodeWithAmbiguity.kt")
public void testIncompleteCodeWithAmbiguity() throws Exception {
@@ -917,6 +917,12 @@ public class FirStandaloneNormalAnalysisSourceModuleResolveCallTestGenerated ext
runTest("analysis/analysis-api/testData/components/callResolver/resolveCall/invalidCode/incompleteCodeNoParenthesis.kt");
}
@Test
@TestMetadata("incompleteCodeNoParenthesisDotQualifier.kt")
public void testIncompleteCodeNoParenthesisDotQualifier() throws Exception {
runTest("analysis/analysis-api/testData/components/callResolver/resolveCall/invalidCode/incompleteCodeNoParenthesisDotQualifier.kt");
}
@Test
@TestMetadata("incompleteCodeWithAmbiguity.kt")
public void testIncompleteCodeWithAmbiguity() throws Exception {
@@ -0,0 +1,3 @@
KtSuccessCallInfo:
call = KtGenericTypeQualifier:
qualifier = kotlin.collections.List<String>
@@ -0,0 +1,3 @@
fun main() {
kotlin.collections.<expr>List<String></expr>
}
@@ -0,0 +1,6 @@
KtErrorCallInfo:
candidateCalls = [
KtQualifierCall:
qualifier = List<String>
]
diagnostic = ERROR<null: Inapplicable candidate>