[Analysis API] add diagnostic tests for unresolved reference inside primary constructor

^KT-62437
This commit is contained in:
Dmitrii Gridin
2023-10-10 13:13:18 +02:00
committed by Space Team
parent 45a59f0a55
commit 1a01dd4dd4
32 changed files with 489 additions and 3 deletions
@@ -2,7 +2,7 @@
open class B(x: () -> Unit)
class A() : B(1, {
class A(val f: String = "${42}") : B(1, {
<expr>foo()</expr>
})
@@ -14,13 +14,16 @@ FILE: [ResolvedTo(IMPORTS)] callInsideLambdaInsideSuperCallAndExplicitConstructo
}
public final [ResolvedTo(STATUS)] class A : R|B| {
public [ResolvedTo(BODY_RESOLVE)] [ContainingClassKey=A] constructor(): R|A| {
public [ResolvedTo(BODY_RESOLVE)] [ContainingClassKey=A] constructor([ResolvedTo(BODY_RESOLVE)] [CorrespondingProperty=/A.f] f: R|kotlin/String| = <strcat>(Int(42))): R|A| {
super<R|B|>(Int(1), [ResolvedTo(RAW_FIR)] fun <anonymous>(): R|kotlin/Unit| <inline=Unknown> {
R|/foo|()
}
)
}
public final [ResolvedTo(BODY_RESOLVE)] [IsFromPrimaryConstructor=true] val f: R|kotlin/String| = R|<local>/f|
public [ResolvedTo(BODY_RESOLVE)] [ContainingClassKey=A] get(): R|kotlin/String|
}
public final [ResolvedTo(CONTRACTS)] fun foo(): R|kotlin/Unit| {
}
}
@@ -0,0 +1,7 @@
open class IJProject(val init: () -> Unit = {})
class KotlinIDE : IJProject(init = {
fun foo() {
<expr>anySymbols</expr>
}
})
@@ -0,0 +1,30 @@
KT element: KtNameReferenceExpression
FIR element: FirPropertyAccessExpressionImpl
FIR source kind: KtRealSourceElementKind
FIR element rendered:
<Unresolved name: anySymbols>#
FIR FILE:
FILE: [ResolvedTo(IMPORTS)] callInsideLambdaInsideSuperCallInsideImplicitConstructor.kt
public open [ResolvedTo(STATUS)] class IJProject : R|kotlin/Any| {
public [ResolvedTo(STATUS)] [ContainingClassKey=IJProject] constructor([ResolvedTo(STATUS)] [CorrespondingProperty=/IJProject.init] init: R|() -> kotlin/Unit| = LAZY_EXPRESSION): R|IJProject| {
LAZY_super<R|kotlin/Any|>
}
public final [ResolvedTo(STATUS)] [IsFromPrimaryConstructor=true] val init: R|() -> kotlin/Unit| = R|<local>/init|
public [ResolvedTo(STATUS)] [ContainingClassKey=IJProject] get(): R|() -> kotlin/Unit|
}
public final [ResolvedTo(BODY_RESOLVE)] class KotlinIDE : R|IJProject| {
public [ResolvedTo(BODY_RESOLVE)] [ContainingClassKey=KotlinIDE] constructor(): R|KotlinIDE| {
super<R|IJProject|>(init = [ResolvedTo(RAW_FIR)] fun <anonymous>(): R|kotlin/Unit| <inline=Unknown> {
local final [ResolvedTo(RAW_FIR)] fun foo(): R|kotlin/Unit| {
<Unresolved name: anySymbols>#
}
}
)
}
}