[AA] include inferred types in functional exp expected type
Fixed for K2 only, k1 remains as is ^KT-62466 fixed
This commit is contained in:
+6
@@ -184,6 +184,12 @@ public class Fe10IdeNormalAnalysisSourceModuleExpectedExpressionTypeTestGenerate
|
||||
runTest("analysis/analysis-api/testData/components/expressionTypeProvider/expectedExpressionType/functionPositionalParamQualified.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("functionalTypeSubstitution.kt")
|
||||
public void testFunctionalTypeSubstitution() throws Exception {
|
||||
runTest("analysis/analysis-api/testData/components/expressionTypeProvider/expectedExpressionType/functionalTypeSubstitution.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("ifCondition.kt")
|
||||
public void testIfCondition() throws Exception {
|
||||
|
||||
+4
-1
@@ -223,7 +223,10 @@ internal class KtFirExpressionTypeProvider(
|
||||
|
||||
val callee = (firCall.calleeReference as? FirResolvedNamedReference)?.resolvedSymbol
|
||||
if (callee?.fir?.origin == FirDeclarationOrigin.SamConstructor) {
|
||||
return (callee.fir as FirSimpleFunction).returnTypeRef.coneType.asKtType()
|
||||
val substitutor = (firCall as? FirQualifiedAccessExpression)
|
||||
?.createConeSubstitutorFromTypeArguments(discardErrorTypes = true)
|
||||
?: ConeSubstitutor.Empty
|
||||
return substitutor.substituteOrSelf((callee.fir as FirSimpleFunction).returnTypeRef.coneType).asKtType()
|
||||
}
|
||||
|
||||
val argumentsToParameters = firCall.argumentsToSubstitutedValueParameters(substituteWithErrorTypes = false) ?: return null
|
||||
|
||||
+6
@@ -184,6 +184,12 @@ public class FirIdeDependentAnalysisSourceModuleExpectedExpressionTypeTestGenera
|
||||
runTest("analysis/analysis-api/testData/components/expressionTypeProvider/expectedExpressionType/functionPositionalParamQualified.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("functionalTypeSubstitution.kt")
|
||||
public void testFunctionalTypeSubstitution() throws Exception {
|
||||
runTest("analysis/analysis-api/testData/components/expressionTypeProvider/expectedExpressionType/functionalTypeSubstitution.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("ifCondition.kt")
|
||||
public void testIfCondition() throws Exception {
|
||||
|
||||
+6
@@ -184,6 +184,12 @@ public class FirIdeNormalAnalysisSourceModuleExpectedExpressionTypeTestGenerated
|
||||
runTest("analysis/analysis-api/testData/components/expressionTypeProvider/expectedExpressionType/functionPositionalParamQualified.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("functionalTypeSubstitution.kt")
|
||||
public void testFunctionalTypeSubstitution() throws Exception {
|
||||
runTest("analysis/analysis-api/testData/components/expressionTypeProvider/expectedExpressionType/functionalTypeSubstitution.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("ifCondition.kt")
|
||||
public void testIfCondition() throws Exception {
|
||||
|
||||
+6
@@ -184,6 +184,12 @@ public class FirStandaloneNormalAnalysisSourceModuleExpectedExpressionTypeTestGe
|
||||
runTest("analysis/analysis-api/testData/components/expressionTypeProvider/expectedExpressionType/functionPositionalParamQualified.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("functionalTypeSubstitution.kt")
|
||||
public void testFunctionalTypeSubstitution() throws Exception {
|
||||
runTest("analysis/analysis-api/testData/components/expressionTypeProvider/expectedExpressionType/functionalTypeSubstitution.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("ifCondition.kt")
|
||||
public void testIfCondition() throws Exception {
|
||||
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
expression: {
|
||||
s: String -> 0
|
||||
}
|
||||
expected type: KtUsualClassType:
|
||||
annotationsList: []
|
||||
ownTypeArguments: [
|
||||
KtTypeParameterType:
|
||||
annotationsList: []
|
||||
type: T
|
||||
]
|
||||
type: java/lang/Comparable<T>
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
fun <K> test(f: java.lang.Comparable<K>) {}
|
||||
|
||||
fun f() {
|
||||
test(java.lang.Comparable {<caret>
|
||||
s: String -> 0
|
||||
})
|
||||
}
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
expression: {
|
||||
s: String -> 0
|
||||
}
|
||||
expected type: KtUsualClassType:
|
||||
annotationsList: []
|
||||
ownTypeArguments: [
|
||||
KtFlexibleType:
|
||||
annotationsList: []
|
||||
type: kotlin/String!
|
||||
]
|
||||
type: java/lang/Comparable<kotlin/String!>
|
||||
Reference in New Issue
Block a user