AA: take into account type arguments if available
...when computing receiver type for double colon expression
This commit is contained in:
committed by
Space Team
parent
2429d09edd
commit
42e8245007
+12
@@ -76,6 +76,18 @@ public class Fe10IdeNormalAnalysisSourceModuleDoubleColonReceiverTypeTestGenerat
|
||||
runTest("analysis/analysis-api/testData/components/typeInfoProvider/doubleColonReceiverType/methodReference_type.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("methodReference_typeArgument.kt")
|
||||
public void testMethodReference_typeArgument() throws Exception {
|
||||
runTest("analysis/analysis-api/testData/components/typeInfoProvider/doubleColonReceiverType/methodReference_typeArgument.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("methodReference_typeArgument_startProjection.kt")
|
||||
public void testMethodReference_typeArgument_startProjection() throws Exception {
|
||||
runTest("analysis/analysis-api/testData/components/typeInfoProvider/doubleColonReceiverType/methodReference_typeArgument_startProjection.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("methodReference_variable.kt")
|
||||
public void testMethodReference_variable() throws Exception {
|
||||
|
||||
+4
-2
@@ -7,7 +7,6 @@ package org.jetbrains.kotlin.analysis.api.fir.components
|
||||
|
||||
import org.jetbrains.kotlin.analysis.api.components.KtBuiltinTypes
|
||||
import org.jetbrains.kotlin.analysis.api.components.KtTypeProvider
|
||||
import org.jetbrains.kotlin.analysis.api.components.buildClassType
|
||||
import org.jetbrains.kotlin.analysis.api.fir.KtFirAnalysisSession
|
||||
import org.jetbrains.kotlin.analysis.api.fir.symbols.KtFirNamedClassOrObjectSymbol
|
||||
import org.jetbrains.kotlin.analysis.api.fir.symbols.KtFirSymbol
|
||||
@@ -197,7 +196,10 @@ internal class KtFirTypeProvider(
|
||||
explicitReceiver.resolvedType.asKtType()
|
||||
}
|
||||
is FirResolvedQualifier -> {
|
||||
explicitReceiver.classId?.let { analysisSession.buildClassType(it) }
|
||||
explicitReceiver.symbol?.toLookupTag()?.constructType(
|
||||
explicitReceiver.typeArguments.map { it.toConeTypeProjection() }.toTypedArray(),
|
||||
isNullable = false
|
||||
)?.asKtType()
|
||||
?: fir.resolvedType.getReceiverOfReflectionType()?.asKtType()
|
||||
}
|
||||
else -> {
|
||||
|
||||
+12
@@ -76,6 +76,18 @@ public class FirIdeDependentAnalysisSourceModuleDoubleColonReceiverTypeTestGener
|
||||
runTest("analysis/analysis-api/testData/components/typeInfoProvider/doubleColonReceiverType/methodReference_type.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("methodReference_typeArgument.kt")
|
||||
public void testMethodReference_typeArgument() throws Exception {
|
||||
runTest("analysis/analysis-api/testData/components/typeInfoProvider/doubleColonReceiverType/methodReference_typeArgument.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("methodReference_typeArgument_startProjection.kt")
|
||||
public void testMethodReference_typeArgument_startProjection() throws Exception {
|
||||
runTest("analysis/analysis-api/testData/components/typeInfoProvider/doubleColonReceiverType/methodReference_typeArgument_startProjection.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("methodReference_variable.kt")
|
||||
public void testMethodReference_variable() throws Exception {
|
||||
|
||||
+12
@@ -76,6 +76,18 @@ public class FirIdeNormalAnalysisSourceModuleDoubleColonReceiverTypeTestGenerate
|
||||
runTest("analysis/analysis-api/testData/components/typeInfoProvider/doubleColonReceiverType/methodReference_type.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("methodReference_typeArgument.kt")
|
||||
public void testMethodReference_typeArgument() throws Exception {
|
||||
runTest("analysis/analysis-api/testData/components/typeInfoProvider/doubleColonReceiverType/methodReference_typeArgument.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("methodReference_typeArgument_startProjection.kt")
|
||||
public void testMethodReference_typeArgument_startProjection() throws Exception {
|
||||
runTest("analysis/analysis-api/testData/components/typeInfoProvider/doubleColonReceiverType/methodReference_typeArgument_startProjection.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("methodReference_variable.kt")
|
||||
public void testMethodReference_variable() throws Exception {
|
||||
|
||||
+12
@@ -76,6 +76,18 @@ public class FirStandaloneNormalAnalysisSourceModuleDoubleColonReceiverTypeTestG
|
||||
runTest("analysis/analysis-api/testData/components/typeInfoProvider/doubleColonReceiverType/methodReference_type.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("methodReference_typeArgument.kt")
|
||||
public void testMethodReference_typeArgument() throws Exception {
|
||||
runTest("analysis/analysis-api/testData/components/typeInfoProvider/doubleColonReceiverType/methodReference_typeArgument.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("methodReference_typeArgument_startProjection.kt")
|
||||
public void testMethodReference_typeArgument_startProjection() throws Exception {
|
||||
runTest("analysis/analysis-api/testData/components/typeInfoProvider/doubleColonReceiverType/methodReference_typeArgument_startProjection.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("methodReference_variable.kt")
|
||||
public void testMethodReference_variable() throws Exception {
|
||||
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
// FILE: MyInterface.kt
|
||||
|
||||
package test.pkg
|
||||
|
||||
interface MyInterface<T> {
|
||||
fun sam(): T
|
||||
}
|
||||
|
||||
// FILE: main.kt
|
||||
|
||||
import test.pkg.MyInterface
|
||||
|
||||
fun test() = MyInterface<String>:<caret>:sam
|
||||
+2
@@ -0,0 +1,2 @@
|
||||
expression: MyInterface<String>::sam
|
||||
receiver:: type: test.pkg.MyInterface<kotlin.String>
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
// FILE: MyInterface.kt
|
||||
|
||||
package test.pkg
|
||||
|
||||
interface MyInterface<T> {
|
||||
fun sam(): T
|
||||
}
|
||||
|
||||
// FILE: main.kt
|
||||
|
||||
import test.pkg.MyInterface
|
||||
|
||||
fun test() = MyInterface<*>:<caret>:sam
|
||||
+2
@@ -0,0 +1,2 @@
|
||||
expression: MyInterface<*>::sam
|
||||
receiver:: type: test.pkg.MyInterface<*>
|
||||
Reference in New Issue
Block a user