[FIR] Set source of smart-cast expressions automatically

#KT-55835
This commit is contained in:
Kirill Rakhman
2023-06-27 16:06:09 +03:00
committed by Space Team
parent 9288a96f6d
commit 91dad7b952
7 changed files with 20 additions and 8 deletions
@@ -452,6 +452,10 @@ object ImplementationConfigurator : AbstractFirTreeImplementationConfigurator()
value = "smartcastStability == SmartcastStability.STABLE_VALUE"
withGetter = true
}
default("source") {
value = "originalExpression.source?.fakeElement(KtFakeSourceElementKind.SmartCastExpression)"
}
useTypes(fakeElementImport, fakeSourceElementKindImport)
}
impl(resolvedNamedReference)
@@ -15,3 +15,6 @@ val resolvedDeclarationStatusImport = ArbitraryImportable("org.jetbrains.kotlin.
val buildResolvedTypeRefImport = ArbitraryImportable("org.jetbrains.kotlin.fir.types.builder", "buildResolvedTypeRef")
val constructClassTypeImport = ArbitraryImportable("org.jetbrains.kotlin.fir.types", "constructClassType")
val toLookupTagImport = ArbitraryImportable("org.jetbrains.kotlin.fir.types", "toLookupTag")
val fakeSourceElementKindImport = ArbitraryImportable("org.jetbrains.kotlin", "KtFakeSourceElementKind")
val fakeElementImport = ArbitraryImportable("org.jetbrains.kotlin", "fakeElement")