[LL FIR] do not treat declarations from object literal as non-local

^KTIJ-25437 Fixed
This commit is contained in:
Dmitrii Gridin
2023-05-08 15:44:12 +02:00
committed by Space Team
parent 6d7dc45ce6
commit d3043b6f1c
8 changed files with 894 additions and 9 deletions
@@ -121,7 +121,12 @@ internal fun PsiElement.getNonLocalContainingOrThisDeclaration(predicate: (KtDec
for (parent in parentsWithSelf) {
candidate?.let { notNullCandidate ->
if (parent is KtEnumEntry || parent is KtCallableDeclaration && !notNullCandidate.isPartOf(parent) || parent is KtClassInitializer) {
if (parent is KtEnumEntry ||
parent is KtCallableDeclaration &&
!notNullCandidate.isPartOf(parent) ||
parent is KtClassInitializer ||
parent is KtObjectLiteralExpression
) {
// Candidate turned out to be local. Let's find another one.
candidate = null
}
@@ -27,7 +27,7 @@ import org.jetbrains.kotlin.psi.psiUtil.parameterIndex
internal fun KtDeclaration.findSourceNonLocalFirDeclaration(
firFileBuilder: LLFirFileBuilder,
provider: FirProvider,
containerFirFile: FirFile? = null
containerFirFile: FirFile? = null,
): FirDeclaration {
//TODO test what way faster
findSourceNonLocalFirDeclarationByProvider(firFileBuilder, provider, containerFirFile)?.let { return it }
@@ -78,7 +78,7 @@ internal fun KtElement.findSourceByTraversingWholeTree(
private fun KtDeclaration.findSourceNonLocalFirDeclarationByProvider(
firFileBuilder: LLFirFileBuilder,
provider: FirProvider,
containerFirFile: FirFile?
containerFirFile: FirFile?,
): FirDeclaration? {
val candidate = when {
this is KtClassOrObject -> findFir(provider)
@@ -118,11 +118,11 @@ private fun KtDeclaration.findSourceNonLocalFirDeclarationByProvider(
}
this is KtScript -> containerFirFile?.declarations?.singleOrNull { it is FirScript }
this is KtPropertyAccessor -> {
val firPropertyDeclaration = property.findSourceNonLocalFirDeclaration(
val firPropertyDeclaration = property.nonLocalFirDeclaration<FirVariable>(
firFileBuilder,
provider,
containerFirFile,
) as FirVariable
)
if (isGetter) {
firPropertyDeclaration.getter
@@ -134,11 +134,11 @@ private fun KtDeclaration.findSourceNonLocalFirDeclarationByProvider(
val ownerFunction = ownerFunction
?: errorWithFirSpecificEntries("Containing function should be not null for KtParameter", psi = this)
val firFunctionDeclaration = ownerFunction.findSourceNonLocalFirDeclarationByProvider(
val firFunctionDeclaration = ownerFunction.nonLocalFirDeclaration<FirFunction>(
firFileBuilder,
provider,
containerFirFile,
) as FirFunction
)
firFunctionDeclaration.valueParameters[parameterIndex()]
}
@@ -146,11 +146,11 @@ private fun KtDeclaration.findSourceNonLocalFirDeclarationByProvider(
val declaration = containingDeclaration
?: errorWithFirSpecificEntries("Containing declaration should be not null for KtTypeParameter", psi = this)
val firTypeParameterOwner = declaration.findSourceNonLocalFirDeclarationByProvider(
val firTypeParameterOwner = declaration.nonLocalFirDeclaration<FirTypeParameterRefsOwner>(
firFileBuilder,
provider,
containerFirFile,
) as FirTypeParameterRefsOwner
)
val index = (parent as KtTypeParameterList).parameters.indexOf(this)
firTypeParameterOwner.typeParameters[index] as FirDeclaration
@@ -160,6 +160,28 @@ private fun KtDeclaration.findSourceNonLocalFirDeclarationByProvider(
return candidate?.takeIf { it.realPsi == this }
}
private inline fun <reified T> KtDeclaration.nonLocalFirDeclaration(
firFileBuilder: LLFirFileBuilder,
provider: FirProvider,
containerFirFile: FirFile?,
): T {
val firResult = findSourceNonLocalFirDeclarationByProvider(
firFileBuilder,
provider,
containerFirFile,
)
if (firResult !is T) {
errorWithFirSpecificEntries(
"${T::class.simpleName} for ${this::class.simpleName} declaration is not found",
psi = this,
fir = firResult,
)
}
return firResult
}
fun FirAnonymousInitializer.containingClass(): FirRegularClass {
val dispatchReceiverType = this.dispatchReceiverType as? ConeLookupTagBasedType
?: error("dispatchReceiverType for FirAnonymousInitializer modifier cannot be null")
@@ -0,0 +1,12 @@
package one
interface Interface {
fun foo(param: String)
}
open class ClassWithParameter(i: Interface)
class TopLevelClass : ClassWithParameter(object : Interface {
override fun fo<caret>o(param: String) {
}
})
@@ -0,0 +1,405 @@
RAW_FIR:
FILE: [ResolvedTo(IMPORTS)] localFunctionInsideSuperEntryCall.kt
[ResolvedTo(RAW_FIR)] annotations container
public abstract [ResolvedTo(STATUS)] interface Interface : R|kotlin/Any| {
public abstract [ResolvedTo(STATUS)] fun foo([ResolvedTo(STATUS)] param: R|kotlin/String|): R|kotlin/Unit|
}
public open [ResolvedTo(STATUS)] class ClassWithParameter : R|kotlin/Any| {
public [ResolvedTo(STATUS)] [ContainingClassKey=ClassWithParameter] constructor([ResolvedTo(STATUS)] i: R|one/Interface|): R|one/ClassWithParameter| {
LAZY_super<R|kotlin/Any|>
}
}
public final [ResolvedTo(BODY_RESOLVE)] class TopLevelClass : R|one/ClassWithParameter| {
public [ResolvedTo(BODY_RESOLVE)] [ContainingClassKey=TopLevelClass] constructor(): R|one/TopLevelClass| {
super<R|one/ClassWithParameter|>(object : R|one/Interface| {
private [ResolvedTo(RAW_FIR)] [ContainingClassKey=<anonymous>] constructor(): R|<anonymous>| {
super<R|kotlin/Any|>()
}
public open override [ResolvedTo(RAW_FIR)] fun foo([ResolvedTo(RAW_FIR)] param: R|kotlin/String|): R|kotlin/Unit| {
}
}
)
}
}
IMPORTS:
FILE: [ResolvedTo(IMPORTS)] localFunctionInsideSuperEntryCall.kt
[ResolvedTo(RAW_FIR)] annotations container
public abstract [ResolvedTo(STATUS)] interface Interface : R|kotlin/Any| {
public abstract [ResolvedTo(STATUS)] fun foo([ResolvedTo(STATUS)] param: R|kotlin/String|): R|kotlin/Unit|
}
public open [ResolvedTo(STATUS)] class ClassWithParameter : R|kotlin/Any| {
public [ResolvedTo(STATUS)] [ContainingClassKey=ClassWithParameter] constructor([ResolvedTo(STATUS)] i: R|one/Interface|): R|one/ClassWithParameter| {
LAZY_super<R|kotlin/Any|>
}
}
public final [ResolvedTo(BODY_RESOLVE)] class TopLevelClass : R|one/ClassWithParameter| {
public [ResolvedTo(BODY_RESOLVE)] [ContainingClassKey=TopLevelClass] constructor(): R|one/TopLevelClass| {
super<R|one/ClassWithParameter|>(object : R|one/Interface| {
private [ResolvedTo(RAW_FIR)] [ContainingClassKey=<anonymous>] constructor(): R|<anonymous>| {
super<R|kotlin/Any|>()
}
public open override [ResolvedTo(RAW_FIR)] fun foo([ResolvedTo(RAW_FIR)] param: R|kotlin/String|): R|kotlin/Unit| {
}
}
)
}
}
COMPILER_REQUIRED_ANNOTATIONS:
FILE: [ResolvedTo(IMPORTS)] localFunctionInsideSuperEntryCall.kt
[ResolvedTo(RAW_FIR)] annotations container
public abstract [ResolvedTo(STATUS)] interface Interface : R|kotlin/Any| {
public abstract [ResolvedTo(STATUS)] fun foo([ResolvedTo(STATUS)] param: R|kotlin/String|): R|kotlin/Unit|
}
public open [ResolvedTo(STATUS)] class ClassWithParameter : R|kotlin/Any| {
public [ResolvedTo(STATUS)] [ContainingClassKey=ClassWithParameter] constructor([ResolvedTo(STATUS)] i: R|one/Interface|): R|one/ClassWithParameter| {
LAZY_super<R|kotlin/Any|>
}
}
public final [ResolvedTo(BODY_RESOLVE)] class TopLevelClass : R|one/ClassWithParameter| {
public [ResolvedTo(BODY_RESOLVE)] [ContainingClassKey=TopLevelClass] constructor(): R|one/TopLevelClass| {
super<R|one/ClassWithParameter|>(object : R|one/Interface| {
private [ResolvedTo(RAW_FIR)] [ContainingClassKey=<anonymous>] constructor(): R|<anonymous>| {
super<R|kotlin/Any|>()
}
public open override [ResolvedTo(RAW_FIR)] fun foo([ResolvedTo(RAW_FIR)] param: R|kotlin/String|): R|kotlin/Unit| {
}
}
)
}
}
COMPANION_GENERATION:
FILE: [ResolvedTo(IMPORTS)] localFunctionInsideSuperEntryCall.kt
[ResolvedTo(RAW_FIR)] annotations container
public abstract [ResolvedTo(STATUS)] interface Interface : R|kotlin/Any| {
public abstract [ResolvedTo(STATUS)] fun foo([ResolvedTo(STATUS)] param: R|kotlin/String|): R|kotlin/Unit|
}
public open [ResolvedTo(STATUS)] class ClassWithParameter : R|kotlin/Any| {
public [ResolvedTo(STATUS)] [ContainingClassKey=ClassWithParameter] constructor([ResolvedTo(STATUS)] i: R|one/Interface|): R|one/ClassWithParameter| {
LAZY_super<R|kotlin/Any|>
}
}
public final [ResolvedTo(BODY_RESOLVE)] class TopLevelClass : R|one/ClassWithParameter| {
public [ResolvedTo(BODY_RESOLVE)] [ContainingClassKey=TopLevelClass] constructor(): R|one/TopLevelClass| {
super<R|one/ClassWithParameter|>(object : R|one/Interface| {
private [ResolvedTo(RAW_FIR)] [ContainingClassKey=<anonymous>] constructor(): R|<anonymous>| {
super<R|kotlin/Any|>()
}
public open override [ResolvedTo(RAW_FIR)] fun foo([ResolvedTo(RAW_FIR)] param: R|kotlin/String|): R|kotlin/Unit| {
}
}
)
}
}
SUPER_TYPES:
FILE: [ResolvedTo(IMPORTS)] localFunctionInsideSuperEntryCall.kt
[ResolvedTo(RAW_FIR)] annotations container
public abstract [ResolvedTo(STATUS)] interface Interface : R|kotlin/Any| {
public abstract [ResolvedTo(STATUS)] fun foo([ResolvedTo(STATUS)] param: R|kotlin/String|): R|kotlin/Unit|
}
public open [ResolvedTo(STATUS)] class ClassWithParameter : R|kotlin/Any| {
public [ResolvedTo(STATUS)] [ContainingClassKey=ClassWithParameter] constructor([ResolvedTo(STATUS)] i: R|one/Interface|): R|one/ClassWithParameter| {
LAZY_super<R|kotlin/Any|>
}
}
public final [ResolvedTo(BODY_RESOLVE)] class TopLevelClass : R|one/ClassWithParameter| {
public [ResolvedTo(BODY_RESOLVE)] [ContainingClassKey=TopLevelClass] constructor(): R|one/TopLevelClass| {
super<R|one/ClassWithParameter|>(object : R|one/Interface| {
private [ResolvedTo(RAW_FIR)] [ContainingClassKey=<anonymous>] constructor(): R|<anonymous>| {
super<R|kotlin/Any|>()
}
public open override [ResolvedTo(RAW_FIR)] fun foo([ResolvedTo(RAW_FIR)] param: R|kotlin/String|): R|kotlin/Unit| {
}
}
)
}
}
TYPES:
FILE: [ResolvedTo(IMPORTS)] localFunctionInsideSuperEntryCall.kt
[ResolvedTo(RAW_FIR)] annotations container
public abstract [ResolvedTo(STATUS)] interface Interface : R|kotlin/Any| {
public abstract [ResolvedTo(STATUS)] fun foo([ResolvedTo(STATUS)] param: R|kotlin/String|): R|kotlin/Unit|
}
public open [ResolvedTo(STATUS)] class ClassWithParameter : R|kotlin/Any| {
public [ResolvedTo(STATUS)] [ContainingClassKey=ClassWithParameter] constructor([ResolvedTo(STATUS)] i: R|one/Interface|): R|one/ClassWithParameter| {
LAZY_super<R|kotlin/Any|>
}
}
public final [ResolvedTo(BODY_RESOLVE)] class TopLevelClass : R|one/ClassWithParameter| {
public [ResolvedTo(BODY_RESOLVE)] [ContainingClassKey=TopLevelClass] constructor(): R|one/TopLevelClass| {
super<R|one/ClassWithParameter|>(object : R|one/Interface| {
private [ResolvedTo(RAW_FIR)] [ContainingClassKey=<anonymous>] constructor(): R|<anonymous>| {
super<R|kotlin/Any|>()
}
public open override [ResolvedTo(RAW_FIR)] fun foo([ResolvedTo(RAW_FIR)] param: R|kotlin/String|): R|kotlin/Unit| {
}
}
)
}
}
STATUS:
FILE: [ResolvedTo(IMPORTS)] localFunctionInsideSuperEntryCall.kt
[ResolvedTo(RAW_FIR)] annotations container
public abstract [ResolvedTo(STATUS)] interface Interface : R|kotlin/Any| {
public abstract [ResolvedTo(STATUS)] fun foo([ResolvedTo(STATUS)] param: R|kotlin/String|): R|kotlin/Unit|
}
public open [ResolvedTo(STATUS)] class ClassWithParameter : R|kotlin/Any| {
public [ResolvedTo(STATUS)] [ContainingClassKey=ClassWithParameter] constructor([ResolvedTo(STATUS)] i: R|one/Interface|): R|one/ClassWithParameter| {
LAZY_super<R|kotlin/Any|>
}
}
public final [ResolvedTo(BODY_RESOLVE)] class TopLevelClass : R|one/ClassWithParameter| {
public [ResolvedTo(BODY_RESOLVE)] [ContainingClassKey=TopLevelClass] constructor(): R|one/TopLevelClass| {
super<R|one/ClassWithParameter|>(object : R|one/Interface| {
private [ResolvedTo(RAW_FIR)] [ContainingClassKey=<anonymous>] constructor(): R|<anonymous>| {
super<R|kotlin/Any|>()
}
public open override [ResolvedTo(RAW_FIR)] fun foo([ResolvedTo(RAW_FIR)] param: R|kotlin/String|): R|kotlin/Unit| {
}
}
)
}
}
EXPECT_ACTUAL_MATCHING:
FILE: [ResolvedTo(IMPORTS)] localFunctionInsideSuperEntryCall.kt
[ResolvedTo(RAW_FIR)] annotations container
public abstract [ResolvedTo(STATUS)] interface Interface : R|kotlin/Any| {
public abstract [ResolvedTo(STATUS)] fun foo([ResolvedTo(STATUS)] param: R|kotlin/String|): R|kotlin/Unit|
}
public open [ResolvedTo(STATUS)] class ClassWithParameter : R|kotlin/Any| {
public [ResolvedTo(STATUS)] [ContainingClassKey=ClassWithParameter] constructor([ResolvedTo(STATUS)] i: R|one/Interface|): R|one/ClassWithParameter| {
LAZY_super<R|kotlin/Any|>
}
}
public final [ResolvedTo(BODY_RESOLVE)] class TopLevelClass : R|one/ClassWithParameter| {
public [ResolvedTo(BODY_RESOLVE)] [ContainingClassKey=TopLevelClass] constructor(): R|one/TopLevelClass| {
super<R|one/ClassWithParameter|>(object : R|one/Interface| {
private [ResolvedTo(RAW_FIR)] [ContainingClassKey=<anonymous>] constructor(): R|<anonymous>| {
super<R|kotlin/Any|>()
}
public open override [ResolvedTo(RAW_FIR)] fun foo([ResolvedTo(RAW_FIR)] param: R|kotlin/String|): R|kotlin/Unit| {
}
}
)
}
}
ARGUMENTS_OF_ANNOTATIONS:
FILE: [ResolvedTo(IMPORTS)] localFunctionInsideSuperEntryCall.kt
[ResolvedTo(RAW_FIR)] annotations container
public abstract [ResolvedTo(STATUS)] interface Interface : R|kotlin/Any| {
public abstract [ResolvedTo(STATUS)] fun foo([ResolvedTo(STATUS)] param: R|kotlin/String|): R|kotlin/Unit|
}
public open [ResolvedTo(STATUS)] class ClassWithParameter : R|kotlin/Any| {
public [ResolvedTo(STATUS)] [ContainingClassKey=ClassWithParameter] constructor([ResolvedTo(STATUS)] i: R|one/Interface|): R|one/ClassWithParameter| {
LAZY_super<R|kotlin/Any|>
}
}
public final [ResolvedTo(BODY_RESOLVE)] class TopLevelClass : R|one/ClassWithParameter| {
public [ResolvedTo(BODY_RESOLVE)] [ContainingClassKey=TopLevelClass] constructor(): R|one/TopLevelClass| {
super<R|one/ClassWithParameter|>(object : R|one/Interface| {
private [ResolvedTo(RAW_FIR)] [ContainingClassKey=<anonymous>] constructor(): R|<anonymous>| {
super<R|kotlin/Any|>()
}
public open override [ResolvedTo(RAW_FIR)] fun foo([ResolvedTo(RAW_FIR)] param: R|kotlin/String|): R|kotlin/Unit| {
}
}
)
}
}
CONTRACTS:
FILE: [ResolvedTo(IMPORTS)] localFunctionInsideSuperEntryCall.kt
[ResolvedTo(RAW_FIR)] annotations container
public abstract [ResolvedTo(STATUS)] interface Interface : R|kotlin/Any| {
public abstract [ResolvedTo(STATUS)] fun foo([ResolvedTo(STATUS)] param: R|kotlin/String|): R|kotlin/Unit|
}
public open [ResolvedTo(STATUS)] class ClassWithParameter : R|kotlin/Any| {
public [ResolvedTo(STATUS)] [ContainingClassKey=ClassWithParameter] constructor([ResolvedTo(STATUS)] i: R|one/Interface|): R|one/ClassWithParameter| {
LAZY_super<R|kotlin/Any|>
}
}
public final [ResolvedTo(BODY_RESOLVE)] class TopLevelClass : R|one/ClassWithParameter| {
public [ResolvedTo(BODY_RESOLVE)] [ContainingClassKey=TopLevelClass] constructor(): R|one/TopLevelClass| {
super<R|one/ClassWithParameter|>(object : R|one/Interface| {
private [ResolvedTo(RAW_FIR)] [ContainingClassKey=<anonymous>] constructor(): R|<anonymous>| {
super<R|kotlin/Any|>()
}
public open override [ResolvedTo(RAW_FIR)] fun foo([ResolvedTo(RAW_FIR)] param: R|kotlin/String|): R|kotlin/Unit| {
}
}
)
}
}
IMPLICIT_TYPES_BODY_RESOLVE:
FILE: [ResolvedTo(IMPORTS)] localFunctionInsideSuperEntryCall.kt
[ResolvedTo(RAW_FIR)] annotations container
public abstract [ResolvedTo(STATUS)] interface Interface : R|kotlin/Any| {
public abstract [ResolvedTo(STATUS)] fun foo([ResolvedTo(STATUS)] param: R|kotlin/String|): R|kotlin/Unit|
}
public open [ResolvedTo(STATUS)] class ClassWithParameter : R|kotlin/Any| {
public [ResolvedTo(STATUS)] [ContainingClassKey=ClassWithParameter] constructor([ResolvedTo(STATUS)] i: R|one/Interface|): R|one/ClassWithParameter| {
LAZY_super<R|kotlin/Any|>
}
}
public final [ResolvedTo(BODY_RESOLVE)] class TopLevelClass : R|one/ClassWithParameter| {
public [ResolvedTo(BODY_RESOLVE)] [ContainingClassKey=TopLevelClass] constructor(): R|one/TopLevelClass| {
super<R|one/ClassWithParameter|>(object : R|one/Interface| {
private [ResolvedTo(RAW_FIR)] [ContainingClassKey=<anonymous>] constructor(): R|<anonymous>| {
super<R|kotlin/Any|>()
}
public open override [ResolvedTo(RAW_FIR)] fun foo([ResolvedTo(RAW_FIR)] param: R|kotlin/String|): R|kotlin/Unit| {
}
}
)
}
}
ANNOTATIONS_ARGUMENTS_MAPPING:
FILE: [ResolvedTo(IMPORTS)] localFunctionInsideSuperEntryCall.kt
[ResolvedTo(RAW_FIR)] annotations container
public abstract [ResolvedTo(STATUS)] interface Interface : R|kotlin/Any| {
public abstract [ResolvedTo(STATUS)] fun foo([ResolvedTo(STATUS)] param: R|kotlin/String|): R|kotlin/Unit|
}
public open [ResolvedTo(STATUS)] class ClassWithParameter : R|kotlin/Any| {
public [ResolvedTo(STATUS)] [ContainingClassKey=ClassWithParameter] constructor([ResolvedTo(STATUS)] i: R|one/Interface|): R|one/ClassWithParameter| {
LAZY_super<R|kotlin/Any|>
}
}
public final [ResolvedTo(BODY_RESOLVE)] class TopLevelClass : R|one/ClassWithParameter| {
public [ResolvedTo(BODY_RESOLVE)] [ContainingClassKey=TopLevelClass] constructor(): R|one/TopLevelClass| {
super<R|one/ClassWithParameter|>(object : R|one/Interface| {
private [ResolvedTo(RAW_FIR)] [ContainingClassKey=<anonymous>] constructor(): R|<anonymous>| {
super<R|kotlin/Any|>()
}
public open override [ResolvedTo(RAW_FIR)] fun foo([ResolvedTo(RAW_FIR)] param: R|kotlin/String|): R|kotlin/Unit| {
}
}
)
}
}
BODY_RESOLVE:
FILE: [ResolvedTo(IMPORTS)] localFunctionInsideSuperEntryCall.kt
[ResolvedTo(RAW_FIR)] annotations container
public abstract [ResolvedTo(STATUS)] interface Interface : R|kotlin/Any| {
public abstract [ResolvedTo(STATUS)] fun foo([ResolvedTo(STATUS)] param: R|kotlin/String|): R|kotlin/Unit|
}
public open [ResolvedTo(STATUS)] class ClassWithParameter : R|kotlin/Any| {
public [ResolvedTo(STATUS)] [ContainingClassKey=ClassWithParameter] constructor([ResolvedTo(STATUS)] i: R|one/Interface|): R|one/ClassWithParameter| {
LAZY_super<R|kotlin/Any|>
}
}
public final [ResolvedTo(BODY_RESOLVE)] class TopLevelClass : R|one/ClassWithParameter| {
public [ResolvedTo(BODY_RESOLVE)] [ContainingClassKey=TopLevelClass] constructor(): R|one/TopLevelClass| {
super<R|one/ClassWithParameter|>(object : R|one/Interface| {
private [ResolvedTo(RAW_FIR)] [ContainingClassKey=<anonymous>] constructor(): R|<anonymous>| {
super<R|kotlin/Any|>()
}
public open override [ResolvedTo(RAW_FIR)] fun foo([ResolvedTo(RAW_FIR)] param: R|kotlin/String|): R|kotlin/Unit| {
}
}
)
}
}
FILE RAW TO BODY:
FILE: [ResolvedTo(IMPORTS)] localFunctionInsideSuperEntryCall.kt
[ResolvedTo(BODY_RESOLVE)] annotations container
public abstract [ResolvedTo(BODY_RESOLVE)] interface Interface : R|kotlin/Any| {
public abstract [ResolvedTo(BODY_RESOLVE)] fun foo([ResolvedTo(BODY_RESOLVE)] param: R|kotlin/String|): R|kotlin/Unit|
}
public open [ResolvedTo(BODY_RESOLVE)] class ClassWithParameter : R|kotlin/Any| {
public [ResolvedTo(BODY_RESOLVE)] [ContainingClassKey=ClassWithParameter] constructor([ResolvedTo(BODY_RESOLVE)] i: R|one/Interface|): R|one/ClassWithParameter| {
super<R|kotlin/Any|>()
}
}
public final [ResolvedTo(BODY_RESOLVE)] class TopLevelClass : R|one/ClassWithParameter| {
public [ResolvedTo(BODY_RESOLVE)] [ContainingClassKey=TopLevelClass] constructor(): R|one/TopLevelClass| {
super<R|one/ClassWithParameter|>(object : R|one/Interface| {
private [ResolvedTo(RAW_FIR)] [ContainingClassKey=<anonymous>] constructor(): R|<anonymous>| {
super<R|kotlin/Any|>()
}
public open override [ResolvedTo(RAW_FIR)] fun foo([ResolvedTo(RAW_FIR)] param: R|kotlin/String|): R|kotlin/Unit| {
}
}
)
}
}
@@ -0,0 +1,12 @@
package one
interface Interface {
fun foo(param: String)
}
open class ClassWithParameter(i: Interface)
class TopLevelClass : ClassWithParameter(object : Interface {
override fun foo(pa<caret>ram: String) {
}
})
@@ -0,0 +1,405 @@
RAW_FIR:
FILE: [ResolvedTo(IMPORTS)] localParameterInsideSuperEntryCall.kt
[ResolvedTo(RAW_FIR)] annotations container
public abstract [ResolvedTo(STATUS)] interface Interface : R|kotlin/Any| {
public abstract [ResolvedTo(STATUS)] fun foo([ResolvedTo(STATUS)] param: R|kotlin/String|): R|kotlin/Unit|
}
public open [ResolvedTo(STATUS)] class ClassWithParameter : R|kotlin/Any| {
public [ResolvedTo(STATUS)] [ContainingClassKey=ClassWithParameter] constructor([ResolvedTo(STATUS)] i: R|one/Interface|): R|one/ClassWithParameter| {
LAZY_super<R|kotlin/Any|>
}
}
public final [ResolvedTo(BODY_RESOLVE)] class TopLevelClass : R|one/ClassWithParameter| {
public [ResolvedTo(BODY_RESOLVE)] [ContainingClassKey=TopLevelClass] constructor(): R|one/TopLevelClass| {
super<R|one/ClassWithParameter|>(object : R|one/Interface| {
private [ResolvedTo(RAW_FIR)] [ContainingClassKey=<anonymous>] constructor(): R|<anonymous>| {
super<R|kotlin/Any|>()
}
public open override [ResolvedTo(RAW_FIR)] fun foo([ResolvedTo(RAW_FIR)] param: R|kotlin/String|): R|kotlin/Unit| {
}
}
)
}
}
IMPORTS:
FILE: [ResolvedTo(IMPORTS)] localParameterInsideSuperEntryCall.kt
[ResolvedTo(RAW_FIR)] annotations container
public abstract [ResolvedTo(STATUS)] interface Interface : R|kotlin/Any| {
public abstract [ResolvedTo(STATUS)] fun foo([ResolvedTo(STATUS)] param: R|kotlin/String|): R|kotlin/Unit|
}
public open [ResolvedTo(STATUS)] class ClassWithParameter : R|kotlin/Any| {
public [ResolvedTo(STATUS)] [ContainingClassKey=ClassWithParameter] constructor([ResolvedTo(STATUS)] i: R|one/Interface|): R|one/ClassWithParameter| {
LAZY_super<R|kotlin/Any|>
}
}
public final [ResolvedTo(BODY_RESOLVE)] class TopLevelClass : R|one/ClassWithParameter| {
public [ResolvedTo(BODY_RESOLVE)] [ContainingClassKey=TopLevelClass] constructor(): R|one/TopLevelClass| {
super<R|one/ClassWithParameter|>(object : R|one/Interface| {
private [ResolvedTo(RAW_FIR)] [ContainingClassKey=<anonymous>] constructor(): R|<anonymous>| {
super<R|kotlin/Any|>()
}
public open override [ResolvedTo(RAW_FIR)] fun foo([ResolvedTo(RAW_FIR)] param: R|kotlin/String|): R|kotlin/Unit| {
}
}
)
}
}
COMPILER_REQUIRED_ANNOTATIONS:
FILE: [ResolvedTo(IMPORTS)] localParameterInsideSuperEntryCall.kt
[ResolvedTo(RAW_FIR)] annotations container
public abstract [ResolvedTo(STATUS)] interface Interface : R|kotlin/Any| {
public abstract [ResolvedTo(STATUS)] fun foo([ResolvedTo(STATUS)] param: R|kotlin/String|): R|kotlin/Unit|
}
public open [ResolvedTo(STATUS)] class ClassWithParameter : R|kotlin/Any| {
public [ResolvedTo(STATUS)] [ContainingClassKey=ClassWithParameter] constructor([ResolvedTo(STATUS)] i: R|one/Interface|): R|one/ClassWithParameter| {
LAZY_super<R|kotlin/Any|>
}
}
public final [ResolvedTo(BODY_RESOLVE)] class TopLevelClass : R|one/ClassWithParameter| {
public [ResolvedTo(BODY_RESOLVE)] [ContainingClassKey=TopLevelClass] constructor(): R|one/TopLevelClass| {
super<R|one/ClassWithParameter|>(object : R|one/Interface| {
private [ResolvedTo(RAW_FIR)] [ContainingClassKey=<anonymous>] constructor(): R|<anonymous>| {
super<R|kotlin/Any|>()
}
public open override [ResolvedTo(RAW_FIR)] fun foo([ResolvedTo(RAW_FIR)] param: R|kotlin/String|): R|kotlin/Unit| {
}
}
)
}
}
COMPANION_GENERATION:
FILE: [ResolvedTo(IMPORTS)] localParameterInsideSuperEntryCall.kt
[ResolvedTo(RAW_FIR)] annotations container
public abstract [ResolvedTo(STATUS)] interface Interface : R|kotlin/Any| {
public abstract [ResolvedTo(STATUS)] fun foo([ResolvedTo(STATUS)] param: R|kotlin/String|): R|kotlin/Unit|
}
public open [ResolvedTo(STATUS)] class ClassWithParameter : R|kotlin/Any| {
public [ResolvedTo(STATUS)] [ContainingClassKey=ClassWithParameter] constructor([ResolvedTo(STATUS)] i: R|one/Interface|): R|one/ClassWithParameter| {
LAZY_super<R|kotlin/Any|>
}
}
public final [ResolvedTo(BODY_RESOLVE)] class TopLevelClass : R|one/ClassWithParameter| {
public [ResolvedTo(BODY_RESOLVE)] [ContainingClassKey=TopLevelClass] constructor(): R|one/TopLevelClass| {
super<R|one/ClassWithParameter|>(object : R|one/Interface| {
private [ResolvedTo(RAW_FIR)] [ContainingClassKey=<anonymous>] constructor(): R|<anonymous>| {
super<R|kotlin/Any|>()
}
public open override [ResolvedTo(RAW_FIR)] fun foo([ResolvedTo(RAW_FIR)] param: R|kotlin/String|): R|kotlin/Unit| {
}
}
)
}
}
SUPER_TYPES:
FILE: [ResolvedTo(IMPORTS)] localParameterInsideSuperEntryCall.kt
[ResolvedTo(RAW_FIR)] annotations container
public abstract [ResolvedTo(STATUS)] interface Interface : R|kotlin/Any| {
public abstract [ResolvedTo(STATUS)] fun foo([ResolvedTo(STATUS)] param: R|kotlin/String|): R|kotlin/Unit|
}
public open [ResolvedTo(STATUS)] class ClassWithParameter : R|kotlin/Any| {
public [ResolvedTo(STATUS)] [ContainingClassKey=ClassWithParameter] constructor([ResolvedTo(STATUS)] i: R|one/Interface|): R|one/ClassWithParameter| {
LAZY_super<R|kotlin/Any|>
}
}
public final [ResolvedTo(BODY_RESOLVE)] class TopLevelClass : R|one/ClassWithParameter| {
public [ResolvedTo(BODY_RESOLVE)] [ContainingClassKey=TopLevelClass] constructor(): R|one/TopLevelClass| {
super<R|one/ClassWithParameter|>(object : R|one/Interface| {
private [ResolvedTo(RAW_FIR)] [ContainingClassKey=<anonymous>] constructor(): R|<anonymous>| {
super<R|kotlin/Any|>()
}
public open override [ResolvedTo(RAW_FIR)] fun foo([ResolvedTo(RAW_FIR)] param: R|kotlin/String|): R|kotlin/Unit| {
}
}
)
}
}
TYPES:
FILE: [ResolvedTo(IMPORTS)] localParameterInsideSuperEntryCall.kt
[ResolvedTo(RAW_FIR)] annotations container
public abstract [ResolvedTo(STATUS)] interface Interface : R|kotlin/Any| {
public abstract [ResolvedTo(STATUS)] fun foo([ResolvedTo(STATUS)] param: R|kotlin/String|): R|kotlin/Unit|
}
public open [ResolvedTo(STATUS)] class ClassWithParameter : R|kotlin/Any| {
public [ResolvedTo(STATUS)] [ContainingClassKey=ClassWithParameter] constructor([ResolvedTo(STATUS)] i: R|one/Interface|): R|one/ClassWithParameter| {
LAZY_super<R|kotlin/Any|>
}
}
public final [ResolvedTo(BODY_RESOLVE)] class TopLevelClass : R|one/ClassWithParameter| {
public [ResolvedTo(BODY_RESOLVE)] [ContainingClassKey=TopLevelClass] constructor(): R|one/TopLevelClass| {
super<R|one/ClassWithParameter|>(object : R|one/Interface| {
private [ResolvedTo(RAW_FIR)] [ContainingClassKey=<anonymous>] constructor(): R|<anonymous>| {
super<R|kotlin/Any|>()
}
public open override [ResolvedTo(RAW_FIR)] fun foo([ResolvedTo(RAW_FIR)] param: R|kotlin/String|): R|kotlin/Unit| {
}
}
)
}
}
STATUS:
FILE: [ResolvedTo(IMPORTS)] localParameterInsideSuperEntryCall.kt
[ResolvedTo(RAW_FIR)] annotations container
public abstract [ResolvedTo(STATUS)] interface Interface : R|kotlin/Any| {
public abstract [ResolvedTo(STATUS)] fun foo([ResolvedTo(STATUS)] param: R|kotlin/String|): R|kotlin/Unit|
}
public open [ResolvedTo(STATUS)] class ClassWithParameter : R|kotlin/Any| {
public [ResolvedTo(STATUS)] [ContainingClassKey=ClassWithParameter] constructor([ResolvedTo(STATUS)] i: R|one/Interface|): R|one/ClassWithParameter| {
LAZY_super<R|kotlin/Any|>
}
}
public final [ResolvedTo(BODY_RESOLVE)] class TopLevelClass : R|one/ClassWithParameter| {
public [ResolvedTo(BODY_RESOLVE)] [ContainingClassKey=TopLevelClass] constructor(): R|one/TopLevelClass| {
super<R|one/ClassWithParameter|>(object : R|one/Interface| {
private [ResolvedTo(RAW_FIR)] [ContainingClassKey=<anonymous>] constructor(): R|<anonymous>| {
super<R|kotlin/Any|>()
}
public open override [ResolvedTo(RAW_FIR)] fun foo([ResolvedTo(RAW_FIR)] param: R|kotlin/String|): R|kotlin/Unit| {
}
}
)
}
}
EXPECT_ACTUAL_MATCHING:
FILE: [ResolvedTo(IMPORTS)] localParameterInsideSuperEntryCall.kt
[ResolvedTo(RAW_FIR)] annotations container
public abstract [ResolvedTo(STATUS)] interface Interface : R|kotlin/Any| {
public abstract [ResolvedTo(STATUS)] fun foo([ResolvedTo(STATUS)] param: R|kotlin/String|): R|kotlin/Unit|
}
public open [ResolvedTo(STATUS)] class ClassWithParameter : R|kotlin/Any| {
public [ResolvedTo(STATUS)] [ContainingClassKey=ClassWithParameter] constructor([ResolvedTo(STATUS)] i: R|one/Interface|): R|one/ClassWithParameter| {
LAZY_super<R|kotlin/Any|>
}
}
public final [ResolvedTo(BODY_RESOLVE)] class TopLevelClass : R|one/ClassWithParameter| {
public [ResolvedTo(BODY_RESOLVE)] [ContainingClassKey=TopLevelClass] constructor(): R|one/TopLevelClass| {
super<R|one/ClassWithParameter|>(object : R|one/Interface| {
private [ResolvedTo(RAW_FIR)] [ContainingClassKey=<anonymous>] constructor(): R|<anonymous>| {
super<R|kotlin/Any|>()
}
public open override [ResolvedTo(RAW_FIR)] fun foo([ResolvedTo(RAW_FIR)] param: R|kotlin/String|): R|kotlin/Unit| {
}
}
)
}
}
ARGUMENTS_OF_ANNOTATIONS:
FILE: [ResolvedTo(IMPORTS)] localParameterInsideSuperEntryCall.kt
[ResolvedTo(RAW_FIR)] annotations container
public abstract [ResolvedTo(STATUS)] interface Interface : R|kotlin/Any| {
public abstract [ResolvedTo(STATUS)] fun foo([ResolvedTo(STATUS)] param: R|kotlin/String|): R|kotlin/Unit|
}
public open [ResolvedTo(STATUS)] class ClassWithParameter : R|kotlin/Any| {
public [ResolvedTo(STATUS)] [ContainingClassKey=ClassWithParameter] constructor([ResolvedTo(STATUS)] i: R|one/Interface|): R|one/ClassWithParameter| {
LAZY_super<R|kotlin/Any|>
}
}
public final [ResolvedTo(BODY_RESOLVE)] class TopLevelClass : R|one/ClassWithParameter| {
public [ResolvedTo(BODY_RESOLVE)] [ContainingClassKey=TopLevelClass] constructor(): R|one/TopLevelClass| {
super<R|one/ClassWithParameter|>(object : R|one/Interface| {
private [ResolvedTo(RAW_FIR)] [ContainingClassKey=<anonymous>] constructor(): R|<anonymous>| {
super<R|kotlin/Any|>()
}
public open override [ResolvedTo(RAW_FIR)] fun foo([ResolvedTo(RAW_FIR)] param: R|kotlin/String|): R|kotlin/Unit| {
}
}
)
}
}
CONTRACTS:
FILE: [ResolvedTo(IMPORTS)] localParameterInsideSuperEntryCall.kt
[ResolvedTo(RAW_FIR)] annotations container
public abstract [ResolvedTo(STATUS)] interface Interface : R|kotlin/Any| {
public abstract [ResolvedTo(STATUS)] fun foo([ResolvedTo(STATUS)] param: R|kotlin/String|): R|kotlin/Unit|
}
public open [ResolvedTo(STATUS)] class ClassWithParameter : R|kotlin/Any| {
public [ResolvedTo(STATUS)] [ContainingClassKey=ClassWithParameter] constructor([ResolvedTo(STATUS)] i: R|one/Interface|): R|one/ClassWithParameter| {
LAZY_super<R|kotlin/Any|>
}
}
public final [ResolvedTo(BODY_RESOLVE)] class TopLevelClass : R|one/ClassWithParameter| {
public [ResolvedTo(BODY_RESOLVE)] [ContainingClassKey=TopLevelClass] constructor(): R|one/TopLevelClass| {
super<R|one/ClassWithParameter|>(object : R|one/Interface| {
private [ResolvedTo(RAW_FIR)] [ContainingClassKey=<anonymous>] constructor(): R|<anonymous>| {
super<R|kotlin/Any|>()
}
public open override [ResolvedTo(RAW_FIR)] fun foo([ResolvedTo(RAW_FIR)] param: R|kotlin/String|): R|kotlin/Unit| {
}
}
)
}
}
IMPLICIT_TYPES_BODY_RESOLVE:
FILE: [ResolvedTo(IMPORTS)] localParameterInsideSuperEntryCall.kt
[ResolvedTo(RAW_FIR)] annotations container
public abstract [ResolvedTo(STATUS)] interface Interface : R|kotlin/Any| {
public abstract [ResolvedTo(STATUS)] fun foo([ResolvedTo(STATUS)] param: R|kotlin/String|): R|kotlin/Unit|
}
public open [ResolvedTo(STATUS)] class ClassWithParameter : R|kotlin/Any| {
public [ResolvedTo(STATUS)] [ContainingClassKey=ClassWithParameter] constructor([ResolvedTo(STATUS)] i: R|one/Interface|): R|one/ClassWithParameter| {
LAZY_super<R|kotlin/Any|>
}
}
public final [ResolvedTo(BODY_RESOLVE)] class TopLevelClass : R|one/ClassWithParameter| {
public [ResolvedTo(BODY_RESOLVE)] [ContainingClassKey=TopLevelClass] constructor(): R|one/TopLevelClass| {
super<R|one/ClassWithParameter|>(object : R|one/Interface| {
private [ResolvedTo(RAW_FIR)] [ContainingClassKey=<anonymous>] constructor(): R|<anonymous>| {
super<R|kotlin/Any|>()
}
public open override [ResolvedTo(RAW_FIR)] fun foo([ResolvedTo(RAW_FIR)] param: R|kotlin/String|): R|kotlin/Unit| {
}
}
)
}
}
ANNOTATIONS_ARGUMENTS_MAPPING:
FILE: [ResolvedTo(IMPORTS)] localParameterInsideSuperEntryCall.kt
[ResolvedTo(RAW_FIR)] annotations container
public abstract [ResolvedTo(STATUS)] interface Interface : R|kotlin/Any| {
public abstract [ResolvedTo(STATUS)] fun foo([ResolvedTo(STATUS)] param: R|kotlin/String|): R|kotlin/Unit|
}
public open [ResolvedTo(STATUS)] class ClassWithParameter : R|kotlin/Any| {
public [ResolvedTo(STATUS)] [ContainingClassKey=ClassWithParameter] constructor([ResolvedTo(STATUS)] i: R|one/Interface|): R|one/ClassWithParameter| {
LAZY_super<R|kotlin/Any|>
}
}
public final [ResolvedTo(BODY_RESOLVE)] class TopLevelClass : R|one/ClassWithParameter| {
public [ResolvedTo(BODY_RESOLVE)] [ContainingClassKey=TopLevelClass] constructor(): R|one/TopLevelClass| {
super<R|one/ClassWithParameter|>(object : R|one/Interface| {
private [ResolvedTo(RAW_FIR)] [ContainingClassKey=<anonymous>] constructor(): R|<anonymous>| {
super<R|kotlin/Any|>()
}
public open override [ResolvedTo(RAW_FIR)] fun foo([ResolvedTo(RAW_FIR)] param: R|kotlin/String|): R|kotlin/Unit| {
}
}
)
}
}
BODY_RESOLVE:
FILE: [ResolvedTo(IMPORTS)] localParameterInsideSuperEntryCall.kt
[ResolvedTo(RAW_FIR)] annotations container
public abstract [ResolvedTo(STATUS)] interface Interface : R|kotlin/Any| {
public abstract [ResolvedTo(STATUS)] fun foo([ResolvedTo(STATUS)] param: R|kotlin/String|): R|kotlin/Unit|
}
public open [ResolvedTo(STATUS)] class ClassWithParameter : R|kotlin/Any| {
public [ResolvedTo(STATUS)] [ContainingClassKey=ClassWithParameter] constructor([ResolvedTo(STATUS)] i: R|one/Interface|): R|one/ClassWithParameter| {
LAZY_super<R|kotlin/Any|>
}
}
public final [ResolvedTo(BODY_RESOLVE)] class TopLevelClass : R|one/ClassWithParameter| {
public [ResolvedTo(BODY_RESOLVE)] [ContainingClassKey=TopLevelClass] constructor(): R|one/TopLevelClass| {
super<R|one/ClassWithParameter|>(object : R|one/Interface| {
private [ResolvedTo(RAW_FIR)] [ContainingClassKey=<anonymous>] constructor(): R|<anonymous>| {
super<R|kotlin/Any|>()
}
public open override [ResolvedTo(RAW_FIR)] fun foo([ResolvedTo(RAW_FIR)] param: R|kotlin/String|): R|kotlin/Unit| {
}
}
)
}
}
FILE RAW TO BODY:
FILE: [ResolvedTo(IMPORTS)] localParameterInsideSuperEntryCall.kt
[ResolvedTo(BODY_RESOLVE)] annotations container
public abstract [ResolvedTo(BODY_RESOLVE)] interface Interface : R|kotlin/Any| {
public abstract [ResolvedTo(BODY_RESOLVE)] fun foo([ResolvedTo(BODY_RESOLVE)] param: R|kotlin/String|): R|kotlin/Unit|
}
public open [ResolvedTo(BODY_RESOLVE)] class ClassWithParameter : R|kotlin/Any| {
public [ResolvedTo(BODY_RESOLVE)] [ContainingClassKey=ClassWithParameter] constructor([ResolvedTo(BODY_RESOLVE)] i: R|one/Interface|): R|one/ClassWithParameter| {
super<R|kotlin/Any|>()
}
}
public final [ResolvedTo(BODY_RESOLVE)] class TopLevelClass : R|one/ClassWithParameter| {
public [ResolvedTo(BODY_RESOLVE)] [ContainingClassKey=TopLevelClass] constructor(): R|one/TopLevelClass| {
super<R|one/ClassWithParameter|>(object : R|one/Interface| {
private [ResolvedTo(RAW_FIR)] [ContainingClassKey=<anonymous>] constructor(): R|<anonymous>| {
super<R|kotlin/Any|>()
}
public open override [ResolvedTo(RAW_FIR)] fun foo([ResolvedTo(RAW_FIR)] param: R|kotlin/String|): R|kotlin/Unit| {
}
}
)
}
}
@@ -198,12 +198,24 @@ public class FirOutOfContentRootLazyDeclarationResolveTestGenerated extends Abst
runTest("analysis/low-level-api-fir/testdata/lazyResolve/lazyProperty.kt");
}
@Test
@TestMetadata("localFunctionInsideSuperEntryCall.kt")
public void testLocalFunctionInsideSuperEntryCall() throws Exception {
runTest("analysis/low-level-api-fir/testdata/lazyResolve/localFunctionInsideSuperEntryCall.kt");
}
@Test
@TestMetadata("localNestedClass.kt")
public void testLocalNestedClass() throws Exception {
runTest("analysis/low-level-api-fir/testdata/lazyResolve/localNestedClass.kt");
}
@Test
@TestMetadata("localParameterInsideSuperEntryCall.kt")
public void testLocalParameterInsideSuperEntryCall() throws Exception {
runTest("analysis/low-level-api-fir/testdata/lazyResolve/localParameterInsideSuperEntryCall.kt");
}
@Test
@TestMetadata("nestedTypeAlias.kt")
public void testNestedTypeAlias() throws Exception {
@@ -198,12 +198,24 @@ public class FirSourceLazyDeclarationResolveTestGenerated extends AbstractFirSou
runTest("analysis/low-level-api-fir/testdata/lazyResolve/lazyProperty.kt");
}
@Test
@TestMetadata("localFunctionInsideSuperEntryCall.kt")
public void testLocalFunctionInsideSuperEntryCall() throws Exception {
runTest("analysis/low-level-api-fir/testdata/lazyResolve/localFunctionInsideSuperEntryCall.kt");
}
@Test
@TestMetadata("localNestedClass.kt")
public void testLocalNestedClass() throws Exception {
runTest("analysis/low-level-api-fir/testdata/lazyResolve/localNestedClass.kt");
}
@Test
@TestMetadata("localParameterInsideSuperEntryCall.kt")
public void testLocalParameterInsideSuperEntryCall() throws Exception {
runTest("analysis/low-level-api-fir/testdata/lazyResolve/localParameterInsideSuperEntryCall.kt");
}
@Test
@TestMetadata("nestedTypeAlias.kt")
public void testNestedTypeAlias() throws Exception {