[Analysis API] add diagnostic tests for unresolved reference inside primary constructor
^KT-62437
This commit is contained in:
committed by
Space Team
parent
45a59f0a55
commit
1a01dd4dd4
+13
@@ -0,0 +1,13 @@
|
||||
// LOOK_UP_FOR_ELEMENT_OF_TYPE: org.jetbrains.kotlin.psi.KtAnnotationEntry
|
||||
|
||||
<expr>@Anno</expr>
|
||||
enum class MyClass(val i: Int = foo()) {
|
||||
ENTRY1,
|
||||
ENTRY2(42);
|
||||
|
||||
fun boo(a: String) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
fun foo() = 42
|
||||
+32
@@ -0,0 +1,32 @@
|
||||
KT element: KtAnnotationEntry
|
||||
FIR element: FirAnnotationCallImpl
|
||||
FIR source kind: KtRealSourceElementKind
|
||||
|
||||
FIR element rendered:
|
||||
@<ERROR TYPE REF: Symbol not found for Anno>[Types]()
|
||||
|
||||
FIR FILE:
|
||||
FILE: [ResolvedTo(IMPORTS)] annotationOnEnumClass.kt
|
||||
@<ERROR TYPE REF: Symbol not found for Anno>[Types]() public final [ResolvedTo(ANNOTATIONS_ARGUMENTS_MAPPING)] enum class MyClass : R|kotlin/Enum<MyClass>| {
|
||||
private [ResolvedTo(RAW_FIR)] [ContainingClassKey=MyClass] constructor([ResolvedTo(RAW_FIR)] [CorrespondingProperty=/MyClass.i] i: Int = LAZY_EXPRESSION): R|MyClass| {
|
||||
LAZY_super<R|kotlin/Enum<MyClass>|>
|
||||
}
|
||||
|
||||
public? final? [ResolvedTo(RAW_FIR)] [IsFromPrimaryConstructor=true] val i: Int = R|<local>/i|
|
||||
public? [ResolvedTo(RAW_FIR)] [ContainingClassKey=MyClass] get(): Int
|
||||
|
||||
public final static [ResolvedTo(RAW_FIR)] [ContainingClassKey=MyClass] enum entry ENTRY1: R|MyClass| = LAZY_EXPRESSION
|
||||
public final static [ResolvedTo(RAW_FIR)] [ContainingClassKey=MyClass] enum entry ENTRY2: R|MyClass| = LAZY_EXPRESSION
|
||||
public? final? [ResolvedTo(RAW_FIR)] fun boo([ResolvedTo(RAW_FIR)] a: String): R|kotlin/Unit| { LAZY_BLOCK }
|
||||
|
||||
public final static [ResolvedTo(RAW_FIR)] [ContainingClassKey=MyClass] fun values(): R|kotlin/Array<MyClass>| {
|
||||
}
|
||||
|
||||
public final static [ResolvedTo(RAW_FIR)] [ContainingClassKey=MyClass] fun valueOf([ResolvedTo(RAW_FIR)] value: R|kotlin/String|): R|MyClass| {
|
||||
}
|
||||
|
||||
public final static [ResolvedTo(RAW_FIR)] [ContainingClassKey=MyClass] val entries: R|kotlin/enums/EnumEntries<MyClass>|
|
||||
public [ResolvedTo(RAW_FIR)] get(): R|kotlin/enums/EnumEntries<MyClass>|
|
||||
|
||||
}
|
||||
public? final? [ResolvedTo(RAW_FIR)] fun foo(): <implicit> { LAZY_BLOCK }
|
||||
+1
-1
@@ -2,7 +2,7 @@
|
||||
|
||||
open class B(x: () -> Unit)
|
||||
|
||||
class A() : B(1, {
|
||||
class A(val f: String = "${42}") : B(1, {
|
||||
<expr>foo()</expr>
|
||||
})
|
||||
|
||||
|
||||
+5
-2
@@ -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| {
|
||||
}
|
||||
}
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
open class IJProject(val init: () -> Unit = {})
|
||||
|
||||
class KotlinIDE : IJProject(init = {
|
||||
fun foo() {
|
||||
<expr>anySymbols</expr>
|
||||
}
|
||||
})
|
||||
+30
@@ -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>#
|
||||
}
|
||||
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
}
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
// LOOK_UP_FOR_ELEMENT_OF_TYPE: org.jetbrains.kotlin.psi.KtTypeReference
|
||||
open class A
|
||||
|
||||
class B(val prop: String = "${foo()}"): <expr>A</expr>()
|
||||
|
||||
fun foo() = 42
|
||||
+27
@@ -0,0 +1,27 @@
|
||||
KT element: KtTypeReference
|
||||
FIR element: FirResolvedTypeRefImpl
|
||||
FIR source kind: KtRealSourceElementKind
|
||||
|
||||
FIR element rendered:
|
||||
R|A|
|
||||
|
||||
FIR FILE:
|
||||
FILE: [ResolvedTo(IMPORTS)] superTypeAndGeneratedProperty.kt
|
||||
public open [ResolvedTo(STATUS)] class A : R|kotlin/Any| {
|
||||
public [ResolvedTo(STATUS)] [ContainingClassKey=A] constructor(): R|A| {
|
||||
LAZY_super<R|kotlin/Any|>
|
||||
}
|
||||
|
||||
}
|
||||
public final [ResolvedTo(BODY_RESOLVE)] class B : R|A| {
|
||||
public [ResolvedTo(BODY_RESOLVE)] [ContainingClassKey=B] constructor([ResolvedTo(BODY_RESOLVE)] [CorrespondingProperty=/B.prop] prop: R|kotlin/String| = <strcat>(R|/foo|())): R|B| {
|
||||
super<R|A|>()
|
||||
}
|
||||
|
||||
public final [ResolvedTo(BODY_RESOLVE)] [IsFromPrimaryConstructor=true] val prop: R|kotlin/String| = R|<local>/prop|
|
||||
public [ResolvedTo(BODY_RESOLVE)] [ContainingClassKey=B] get(): R|kotlin/String|
|
||||
|
||||
}
|
||||
public final [ResolvedTo(IMPLICIT_TYPES_BODY_RESOLVE)] fun foo(): R|kotlin/Int| {
|
||||
^foo Int(42)
|
||||
}
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
// LOOK_UP_FOR_ELEMENT_OF_TYPE: KtUserType
|
||||
|
||||
enum class MyClass(val i: Int = foo()) : <expr>UnresolvedInterface</expr> {
|
||||
ENTRY1,
|
||||
ENTRY2(42);
|
||||
|
||||
fun boo(a: String) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
fun foo() = 42
|
||||
+34
@@ -0,0 +1,34 @@
|
||||
KT element: KtUserType
|
||||
FIR element: FirErrorTypeRefImpl
|
||||
FIR source kind: KtRealSourceElementKind
|
||||
|
||||
FIR element rendered:
|
||||
<ERROR TYPE REF: Symbol not found for UnresolvedInterface>
|
||||
|
||||
FIR FILE:
|
||||
FILE: [ResolvedTo(IMPORTS)] superTypeOnEnumClass.kt
|
||||
public final [ResolvedTo(BODY_RESOLVE)] enum class MyClass : <ERROR TYPE REF: Symbol not found for UnresolvedInterface>, R|kotlin/Enum<MyClass>| {
|
||||
private [ResolvedTo(BODY_RESOLVE)] [ContainingClassKey=MyClass] constructor([ResolvedTo(BODY_RESOLVE)] [CorrespondingProperty=/MyClass.i] i: R|kotlin/Int| = R|/foo|()): R|MyClass| {
|
||||
super<R|kotlin/Enum<MyClass>|>()
|
||||
}
|
||||
|
||||
public final [ResolvedTo(BODY_RESOLVE)] [IsFromPrimaryConstructor=true] val i: R|kotlin/Int| = R|<local>/i|
|
||||
public [ResolvedTo(BODY_RESOLVE)] [ContainingClassKey=MyClass] get(): R|kotlin/Int|
|
||||
|
||||
public final static [ResolvedTo(STATUS)] [ContainingClassKey=MyClass] enum entry ENTRY1: R|MyClass| = LAZY_EXPRESSION
|
||||
public final static [ResolvedTo(STATUS)] [ContainingClassKey=MyClass] enum entry ENTRY2: R|MyClass| = LAZY_EXPRESSION
|
||||
public final [ResolvedTo(STATUS)] fun boo([ResolvedTo(STATUS)] a: R|kotlin/String|): R|kotlin/Unit| { LAZY_BLOCK }
|
||||
|
||||
public final static [ResolvedTo(STATUS)] [ContainingClassKey=MyClass] fun values(): R|kotlin/Array<MyClass>| {
|
||||
}
|
||||
|
||||
public final static [ResolvedTo(STATUS)] [ContainingClassKey=MyClass] fun valueOf([ResolvedTo(STATUS)] value: R|kotlin/String|): R|MyClass| {
|
||||
}
|
||||
|
||||
public final static [ResolvedTo(STATUS)] [ContainingClassKey=MyClass] val entries: R|kotlin/enums/EnumEntries<MyClass>|
|
||||
public [ResolvedTo(STATUS)] get(): R|kotlin/enums/EnumEntries<MyClass>|
|
||||
|
||||
}
|
||||
public final [ResolvedTo(IMPLICIT_TYPES_BODY_RESOLVE)] fun foo(): R|kotlin/Int| {
|
||||
^foo Int(42)
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
<expr>
|
||||
enum class MyClass(val i: Int = foo()) : UnresolvedInterface {
|
||||
ENTRY1,
|
||||
ENTRY2(42);
|
||||
|
||||
fun boo(a: String) {
|
||||
|
||||
}
|
||||
}
|
||||
</expr>
|
||||
|
||||
fun foo() = 42
|
||||
@@ -0,0 +1,55 @@
|
||||
KT element: KtClass
|
||||
FIR element: FirRegularClassImpl
|
||||
FIR source kind: KtRealSourceElementKind
|
||||
|
||||
FIR element rendered:
|
||||
public final [ResolvedTo(BODY_RESOLVE)] enum class MyClass : <ERROR TYPE REF: Symbol not found for UnresolvedInterface>, R|kotlin/Enum<MyClass>| {
|
||||
private [ResolvedTo(BODY_RESOLVE)] [ContainingClassKey=MyClass] constructor([ResolvedTo(BODY_RESOLVE)] [CorrespondingProperty=/MyClass.i] i: R|kotlin/Int| = R|/foo|()): R|MyClass| {
|
||||
super<R|kotlin/Enum<MyClass>|>()
|
||||
}
|
||||
|
||||
public final [ResolvedTo(BODY_RESOLVE)] [IsFromPrimaryConstructor=true] val i: R|kotlin/Int| = R|<local>/i|
|
||||
public [ResolvedTo(BODY_RESOLVE)] [ContainingClassKey=MyClass] get(): R|kotlin/Int|
|
||||
|
||||
public final static [ResolvedTo(STATUS)] [ContainingClassKey=MyClass] enum entry ENTRY1: R|MyClass| = LAZY_EXPRESSION
|
||||
public final static [ResolvedTo(STATUS)] [ContainingClassKey=MyClass] enum entry ENTRY2: R|MyClass| = LAZY_EXPRESSION
|
||||
public final [ResolvedTo(STATUS)] fun boo([ResolvedTo(STATUS)] a: R|kotlin/String|): R|kotlin/Unit| { LAZY_BLOCK }
|
||||
|
||||
public final static [ResolvedTo(STATUS)] [ContainingClassKey=MyClass] fun values(): R|kotlin/Array<MyClass>| {
|
||||
}
|
||||
|
||||
public final static [ResolvedTo(STATUS)] [ContainingClassKey=MyClass] fun valueOf([ResolvedTo(STATUS)] value: R|kotlin/String|): R|MyClass| {
|
||||
}
|
||||
|
||||
public final static [ResolvedTo(STATUS)] [ContainingClassKey=MyClass] val entries: R|kotlin/enums/EnumEntries<MyClass>|
|
||||
public [ResolvedTo(STATUS)] get(): R|kotlin/enums/EnumEntries<MyClass>|
|
||||
|
||||
}
|
||||
|
||||
FIR FILE:
|
||||
FILE: [ResolvedTo(IMPORTS)] enum.kt
|
||||
public final [ResolvedTo(BODY_RESOLVE)] enum class MyClass : <ERROR TYPE REF: Symbol not found for UnresolvedInterface>, R|kotlin/Enum<MyClass>| {
|
||||
private [ResolvedTo(BODY_RESOLVE)] [ContainingClassKey=MyClass] constructor([ResolvedTo(BODY_RESOLVE)] [CorrespondingProperty=/MyClass.i] i: R|kotlin/Int| = R|/foo|()): R|MyClass| {
|
||||
super<R|kotlin/Enum<MyClass>|>()
|
||||
}
|
||||
|
||||
public final [ResolvedTo(BODY_RESOLVE)] [IsFromPrimaryConstructor=true] val i: R|kotlin/Int| = R|<local>/i|
|
||||
public [ResolvedTo(BODY_RESOLVE)] [ContainingClassKey=MyClass] get(): R|kotlin/Int|
|
||||
|
||||
public final static [ResolvedTo(STATUS)] [ContainingClassKey=MyClass] enum entry ENTRY1: R|MyClass| = LAZY_EXPRESSION
|
||||
public final static [ResolvedTo(STATUS)] [ContainingClassKey=MyClass] enum entry ENTRY2: R|MyClass| = LAZY_EXPRESSION
|
||||
public final [ResolvedTo(STATUS)] fun boo([ResolvedTo(STATUS)] a: R|kotlin/String|): R|kotlin/Unit| { LAZY_BLOCK }
|
||||
|
||||
public final static [ResolvedTo(STATUS)] [ContainingClassKey=MyClass] fun values(): R|kotlin/Array<MyClass>| {
|
||||
}
|
||||
|
||||
public final static [ResolvedTo(STATUS)] [ContainingClassKey=MyClass] fun valueOf([ResolvedTo(STATUS)] value: R|kotlin/String|): R|MyClass| {
|
||||
}
|
||||
|
||||
public final static [ResolvedTo(STATUS)] [ContainingClassKey=MyClass] val entries: R|kotlin/enums/EnumEntries<MyClass>|
|
||||
public [ResolvedTo(STATUS)] get(): R|kotlin/enums/EnumEntries<MyClass>|
|
||||
|
||||
}
|
||||
public final [ResolvedTo(IMPLICIT_TYPES_BODY_RESOLVE)] fun foo(): R|kotlin/Int| {
|
||||
^foo Int(42)
|
||||
}
|
||||
Reference in New Issue
Block a user