Support getContainer for the synthetic it value parameter

Also fixed incorrect KtSymbolOrigin:
it was SOURCE instead of SOURCE_MEMBER_GENERATED
This commit is contained in:
Stanislav Erokhin
2021-01-22 10:56:02 +01:00
parent c24ad0ba51
commit d9be05fea8
3 changed files with 3 additions and 1 deletions
@@ -53,6 +53,7 @@ enum class KtSymbolOrigin {
* Declaration which do not have it's PSI source and was generated, they are:
* For data classes the `copy`, `component{N}`, `toString`, `equals`, `hashCode` functions are generated
* For enum classes the `valueOf` & `values` functions are generated
* For lambda the `it` property is generated
*/
SOURCE_MEMBER_GENERATED,
@@ -139,7 +139,7 @@ object FirIdeDeserializedDeclarationSourceProvider {
private fun KtElement.isCompiled(): Boolean = containingKtFile.isCompiled
private val allowedFakeElementKinds = setOf(FirFakeSourceElementKind.PropertyFromParameter)
private val allowedFakeElementKinds = setOf(FirFakeSourceElementKind.PropertyFromParameter, FirFakeSourceElementKind.ItLambdaParameter)
private fun FirElement.getAllowedPsi() = when (val source = source) {
null -> null
@@ -26,6 +26,7 @@ private tailrec fun FirDeclaration.ktSymbolOrigin(): KtSymbolOrigin = when (orig
FirDeclarationOrigin.Source -> {
if (source?.kind == FirFakeSourceElementKind.DataClassGeneratedMembers
|| source?.kind == FirFakeSourceElementKind.EnumGeneratedDeclaration
|| source?.kind == FirFakeSourceElementKind.ItLambdaParameter
) {
KtSymbolOrigin.SOURCE_MEMBER_GENERATED
} else KtSymbolOrigin.SOURCE