[AA] don't treat incomplete function as anonymous
^KTIJ-23672 sync anonymous function predicate with RawFirBuilder/DeclarationsConverter
This commit is contained in:
+6
@@ -58,6 +58,12 @@ public class Fe10IdeNormalAnalysisSourceModuleDeclarationReturnTypeTestGenerated
|
||||
runTest("analysis/analysis-api/testData/components/expressionTypeProvider/declarationReturnType/delegateProperties.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("functionWithoutParameterList.kt")
|
||||
public void testFunctionWithoutParameterList() throws Exception {
|
||||
runTest("analysis/analysis-api/testData/components/expressionTypeProvider/declarationReturnType/functionWithoutParameterList.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("funtionType.kt")
|
||||
public void testFuntionType() throws Exception {
|
||||
|
||||
+1
-1
@@ -119,7 +119,7 @@ internal class KtFirExpressionTypeProvider(
|
||||
contract {
|
||||
returns(true) implies (ktDeclaration is KtNamedFunction)
|
||||
}
|
||||
return ktDeclaration is KtFunction && ktDeclaration.name == null
|
||||
return ktDeclaration is KtNamedFunction && ktDeclaration.isAnonymous
|
||||
}
|
||||
|
||||
private fun KtFunction.toFirAnonymousFunction(): FirAnonymousFunction {
|
||||
|
||||
+6
@@ -58,6 +58,12 @@ public class FirIdeDependentAnalysisSourceModuleDeclarationReturnTypeTestGenerat
|
||||
runTest("analysis/analysis-api/testData/components/expressionTypeProvider/declarationReturnType/delegateProperties.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("functionWithoutParameterList.kt")
|
||||
public void testFunctionWithoutParameterList() throws Exception {
|
||||
runTest("analysis/analysis-api/testData/components/expressionTypeProvider/declarationReturnType/functionWithoutParameterList.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("funtionType.kt")
|
||||
public void testFuntionType() throws Exception {
|
||||
|
||||
+6
@@ -58,6 +58,12 @@ public class FirIdeNormalAnalysisSourceModuleDeclarationReturnTypeTestGenerated
|
||||
runTest("analysis/analysis-api/testData/components/expressionTypeProvider/declarationReturnType/delegateProperties.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("functionWithoutParameterList.kt")
|
||||
public void testFunctionWithoutParameterList() throws Exception {
|
||||
runTest("analysis/analysis-api/testData/components/expressionTypeProvider/declarationReturnType/functionWithoutParameterList.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("funtionType.kt")
|
||||
public void testFuntionType() throws Exception {
|
||||
|
||||
+6
@@ -58,6 +58,12 @@ public class FirStandaloneNormalAnalysisSourceModuleDeclarationReturnTypeTestGen
|
||||
runTest("analysis/analysis-api/testData/components/expressionTypeProvider/declarationReturnType/delegateProperties.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("functionWithoutParameterList.kt")
|
||||
public void testFunctionWithoutParameterList() throws Exception {
|
||||
runTest("analysis/analysis-api/testData/components/expressionTypeProvider/declarationReturnType/functionWithoutParameterList.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("funtionType.kt")
|
||||
public void testFuntionType() throws Exception {
|
||||
|
||||
+1
@@ -0,0 +1 @@
|
||||
inline fun <reified A, reified B> Pair<*,*>.
|
||||
+1
@@ -0,0 +1 @@
|
||||
KtNamedFunction@(1,1) : kotlin.Unit
|
||||
@@ -1313,7 +1313,7 @@ open class RawFirBuilder(
|
||||
val receiverType = function.receiverTypeReference.convertSafe<FirTypeRef>()
|
||||
|
||||
val labelName: String?
|
||||
val isAnonymousFunction = function.name == null && !function.parent.let { it is KtFile || it is KtClassBody }
|
||||
val isAnonymousFunction = function.isAnonymous
|
||||
val functionSymbol: FirFunctionSymbol<*>
|
||||
val functionBuilder = if (isAnonymousFunction) {
|
||||
FirAnonymousFunctionBuilder().apply {
|
||||
|
||||
@@ -242,6 +242,10 @@ public class KtNamedFunction extends KtTypeParameterListOwnerStub<KotlinFunction
|
||||
return !(parent instanceof KtFile || parent instanceof KtClassBody);
|
||||
}
|
||||
|
||||
public boolean isAnonymous() {
|
||||
return getName() == null && isLocal();
|
||||
}
|
||||
|
||||
public boolean isTopLevel() {
|
||||
KotlinFunctionStub stub = getStub();
|
||||
if (stub != null) {
|
||||
|
||||
Reference in New Issue
Block a user