[AA] keep nullability for the recreated type

...when computing receiver type for double colon expression

^KT-65930 fixed
This commit is contained in:
Anna Kozlova
2024-02-19 14:21:37 +01:00
committed by Space Team
parent d50b02adaf
commit c628382b29
7 changed files with 30 additions and 1 deletions
@@ -94,6 +94,12 @@ public class Fe10IdeNormalAnalysisSourceModuleDoubleColonReceiverTypeTestGenerat
runTest("analysis/analysis-api/testData/components/typeInfoProvider/doubleColonReceiverType/methodReference_variable.kt");
}
@Test
@TestMetadata("nullableType.kt")
public void testNullableType() {
runTest("analysis/analysis-api/testData/components/typeInfoProvider/doubleColonReceiverType/nullableType.kt");
}
@Test
@TestMetadata("outerThisReceiver.kt")
public void testOuterThisReceiver() {
@@ -201,7 +201,7 @@ internal class KtFirTypeProvider(
is FirResolvedQualifier -> {
explicitReceiver.symbol?.toLookupTag()?.constructType(
explicitReceiver.typeArguments.map { it.toConeTypeProjection() }.toTypedArray(),
isNullable = false
isNullable = explicitReceiver.isNullableLHSForCallableReference
)?.asKtType()
?: fir.resolvedType.getReceiverOfReflectionType()?.asKtType()
}
@@ -94,6 +94,12 @@ public class FirIdeDependentAnalysisSourceModuleDoubleColonReceiverTypeTestGener
runTest("analysis/analysis-api/testData/components/typeInfoProvider/doubleColonReceiverType/methodReference_variable.kt");
}
@Test
@TestMetadata("nullableType.kt")
public void testNullableType() {
runTest("analysis/analysis-api/testData/components/typeInfoProvider/doubleColonReceiverType/nullableType.kt");
}
@Test
@TestMetadata("outerThisReceiver.kt")
public void testOuterThisReceiver() {
@@ -94,6 +94,12 @@ public class FirIdeNormalAnalysisSourceModuleDoubleColonReceiverTypeTestGenerate
runTest("analysis/analysis-api/testData/components/typeInfoProvider/doubleColonReceiverType/methodReference_variable.kt");
}
@Test
@TestMetadata("nullableType.kt")
public void testNullableType() {
runTest("analysis/analysis-api/testData/components/typeInfoProvider/doubleColonReceiverType/nullableType.kt");
}
@Test
@TestMetadata("outerThisReceiver.kt")
public void testOuterThisReceiver() {
@@ -94,6 +94,12 @@ public class FirStandaloneNormalAnalysisSourceModuleDoubleColonReceiverTypeTestG
runTest("analysis/analysis-api/testData/components/typeInfoProvider/doubleColonReceiverType/methodReference_variable.kt");
}
@Test
@TestMetadata("nullableType.kt")
public void testNullableType() {
runTest("analysis/analysis-api/testData/components/typeInfoProvider/doubleColonReceiverType/nullableType.kt");
}
@Test
@TestMetadata("outerThisReceiver.kt")
public void testOuterThisReceiver() {
@@ -0,0 +1,3 @@
fun Int?.foo() = this?.hashCode() ?: 0
val x = Int?:<caret>:foo
@@ -0,0 +1,2 @@
expression: Int?::foo
receiver:: type: kotlin.Int?