[FIR] Resolve where subjects to corresponding type argument
^KTIJ-25295 fixed Merge-request: KT-MR-10044 Merged-by: Egor Kulikov <Egor.Kulikov@jetbrains.com>
This commit is contained in:
+1
-1
@@ -73,7 +73,7 @@ internal class KtFirExpressionTypeProvider(
|
||||
is FirExpression -> fir.typeRef.coneType.asKtType()
|
||||
is FirNamedReference -> fir.getReferencedElementType().asKtType()
|
||||
is FirStatement -> with(analysisSession) { builtinTypes.UNIT }
|
||||
is FirTypeRef, is FirImport, is FirPackageDirective, is FirLabel -> null
|
||||
is FirTypeRef, is FirImport, is FirPackageDirective, is FirLabel, is FirTypeParameterRef -> null
|
||||
// For invalid code like the following,
|
||||
// ```
|
||||
// when {
|
||||
|
||||
+8
@@ -218,6 +218,7 @@ internal object FirReferenceResolveHelper {
|
||||
is FirResolvable -> getSymbolsByResolvable(fir, expression, session, symbolBuilder)
|
||||
is FirNamedArgumentExpression -> getSymbolsByNameArgumentExpression(expression, analysisSession, symbolBuilder)
|
||||
is FirEqualityOperatorCall -> getSymbolsByEqualsName(fir, session, analysisSession, symbolBuilder)
|
||||
is FirTypeParameter -> getSybmolsByTypeParameter(symbolBuilder, fir)
|
||||
else -> handleUnknownFirElement(expression, analysisSession, session, symbolBuilder)
|
||||
}
|
||||
}
|
||||
@@ -430,6 +431,13 @@ internal object FirReferenceResolveHelper {
|
||||
return listOf(symbolBuilder.buildSymbol(fir.symbol))
|
||||
}
|
||||
|
||||
private fun getSybmolsByTypeParameter(
|
||||
symbolBuilder: KtSymbolByFirBuilder,
|
||||
fir: FirTypeParameter
|
||||
): List<KtSymbol> {
|
||||
return listOf(symbolBuilder.buildSymbol(fir.symbol))
|
||||
}
|
||||
|
||||
private fun getSymbolsByResolvedImport(
|
||||
expression: KtSimpleNameExpression,
|
||||
builder: KtSymbolByFirBuilder,
|
||||
|
||||
+12
@@ -1950,6 +1950,18 @@ public class FirIdeDependentAnalysisSourceModuleReferenceResolveTestGenerated ex
|
||||
public void testTypeParameterInFunctionLiteral() throws Exception {
|
||||
runTest("analysis/analysis-api/testData/referenceResolve/typeParameter/TypeParameterInFunctionLiteral.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("whereClause1.kt")
|
||||
public void testWhereClause1() throws Exception {
|
||||
runTest("analysis/analysis-api/testData/referenceResolve/typeParameter/whereClause1.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("whereClause2.kt")
|
||||
public void testWhereClause2() throws Exception {
|
||||
runTest("analysis/analysis-api/testData/referenceResolve/typeParameter/whereClause2.kt");
|
||||
}
|
||||
}
|
||||
|
||||
@Nested
|
||||
|
||||
+12
@@ -1834,5 +1834,17 @@ public class FirIdeNormalAnalysisLibrarySourceModuleReferenceResolveTestGenerate
|
||||
public void testTypeParameterInFunctionLiteral() throws Exception {
|
||||
runTest("analysis/analysis-api/testData/referenceResolve/typeParameter/TypeParameterInFunctionLiteral.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("whereClause1.kt")
|
||||
public void testWhereClause1() throws Exception {
|
||||
runTest("analysis/analysis-api/testData/referenceResolve/typeParameter/whereClause1.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("whereClause2.kt")
|
||||
public void testWhereClause2() throws Exception {
|
||||
runTest("analysis/analysis-api/testData/referenceResolve/typeParameter/whereClause2.kt");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+12
@@ -1950,6 +1950,18 @@ public class FirIdeNormalAnalysisSourceModuleReferenceResolveTestGenerated exten
|
||||
public void testTypeParameterInFunctionLiteral() throws Exception {
|
||||
runTest("analysis/analysis-api/testData/referenceResolve/typeParameter/TypeParameterInFunctionLiteral.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("whereClause1.kt")
|
||||
public void testWhereClause1() throws Exception {
|
||||
runTest("analysis/analysis-api/testData/referenceResolve/typeParameter/whereClause1.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("whereClause2.kt")
|
||||
public void testWhereClause2() throws Exception {
|
||||
runTest("analysis/analysis-api/testData/referenceResolve/typeParameter/whereClause2.kt");
|
||||
}
|
||||
}
|
||||
|
||||
@Nested
|
||||
|
||||
Reference in New Issue
Block a user