[LL FIR] add test on implicit type for local property
^KT-63042
This commit is contained in:
committed by
Space Team
parent
5161b3b7d8
commit
143f86cc1c
+18
@@ -0,0 +1,18 @@
|
||||
// WITH_STDLIB
|
||||
|
||||
package foo
|
||||
|
||||
@Target(AnnotationTarget.TYPE, AnnotationTarget.LOCAL_VARIABLE)
|
||||
annotation class Anno(val position: String)
|
||||
const val constant = 0
|
||||
|
||||
fun explicitType(): @Anno("return type: $constant") List<@Anno("nested return type: $constant") Collection<@Anno("nested nested return type: $constant") String>> = 0
|
||||
|
||||
fun resolveMe() {
|
||||
<expr>
|
||||
@Anno("property $secondConstant")
|
||||
val localProperty by lazy { explicitType() }
|
||||
</expr>
|
||||
}
|
||||
|
||||
const val secondConstant = "str"
|
||||
+36
@@ -0,0 +1,36 @@
|
||||
KT element: KtProperty
|
||||
FIR element: FirPropertyImpl
|
||||
FIR source kind: KtRealSourceElementKind
|
||||
|
||||
FIR element rendered:
|
||||
@R|foo/Anno|[Types](position = <strcat>(String(property ), R|foo/secondConstant|)) [ResolvedTo(BODY_RESOLVE)] lval localProperty: <ERROR TYPE REF: Unresolved name: getValue>by <Unresolved name: lazy>#(<L> = [ResolvedTo(BODY_RESOLVE)] lazy@fun <anonymous>(): R|@R|foo/Anno|(<strcat>(String(return type: ), constant#)) kotlin/collections/List<@R|foo/Anno|(<strcat>(String(nested return type: ), constant#)) kotlin/collections/Collection<@R|foo/Anno|(<strcat>(String(nested nested return type: ), constant#)) kotlin/String>>| <inline=Unknown> {
|
||||
^ R|foo/explicitType|()
|
||||
}
|
||||
)
|
||||
|
||||
FIR FILE:
|
||||
FILE: [ResolvedTo(IMPORTS)] localDelegatedPropertyWithPropagatedType.kt
|
||||
package foo
|
||||
|
||||
@R|kotlin/annotation/Target|[Types](Q|kotlin/annotation/AnnotationTarget|.R|kotlin/annotation/AnnotationTarget.TYPE|, Q|kotlin/annotation/AnnotationTarget|.R|kotlin/annotation/AnnotationTarget.LOCAL_VARIABLE|) public final [ResolvedTo(STATUS)] annotation class Anno : R|kotlin/Annotation| {
|
||||
public [ResolvedTo(STATUS)] [ContainingClassKey=Anno] constructor([ResolvedTo(STATUS)] [CorrespondingProperty=foo/Anno.position] position: R|kotlin/String|): R|foo/Anno| {
|
||||
LAZY_super<R|kotlin/Any|>
|
||||
}
|
||||
|
||||
public final [ResolvedTo(STATUS)] [IsFromPrimaryConstructor=true] val position: R|kotlin/String| = R|<local>/position|
|
||||
public [ResolvedTo(STATUS)] [ContainingClassKey=Anno] get(): R|kotlin/String|
|
||||
|
||||
}
|
||||
public? final? const [ResolvedTo(RAW_FIR)] val constant: <implicit> = LAZY_EXPRESSION
|
||||
public? [ResolvedTo(RAW_FIR)] get(): <implicit>
|
||||
public final [ResolvedTo(CONTRACTS)] fun explicitType(): R|@R|foo/Anno|(<strcat>(String(return type: ), constant#)) kotlin/collections/List<@R|foo/Anno|(<strcat>(String(nested return type: ), constant#)) kotlin/collections/Collection<@R|foo/Anno|(<strcat>(String(nested nested return type: ), constant#)) kotlin/String>>| {
|
||||
^explicitType IntegerLiteral(0)
|
||||
}
|
||||
public final [ResolvedTo(BODY_RESOLVE)] fun resolveMe(): R|kotlin/Unit| {
|
||||
@R|foo/Anno|[Types](position = <strcat>(String(property ), R|foo/secondConstant|)) [ResolvedTo(BODY_RESOLVE)] lval localProperty: <ERROR TYPE REF: Unresolved name: getValue>by <Unresolved name: lazy>#(<L> = [ResolvedTo(BODY_RESOLVE)] lazy@fun <anonymous>(): R|@R|foo/Anno|(<strcat>(String(return type: ), constant#)) kotlin/collections/List<@R|foo/Anno|(<strcat>(String(nested return type: ), constant#)) kotlin/collections/Collection<@R|foo/Anno|(<strcat>(String(nested nested return type: ), constant#)) kotlin/String>>| <inline=Unknown> {
|
||||
^ R|foo/explicitType|()
|
||||
}
|
||||
)
|
||||
}
|
||||
public final const [ResolvedTo(IMPLICIT_TYPES_BODY_RESOLVE)] val secondConstant: R|kotlin/String| = String(str)
|
||||
public [ResolvedTo(IMPLICIT_TYPES_BODY_RESOLVE)] get(): R|kotlin/String|
|
||||
+36
@@ -0,0 +1,36 @@
|
||||
KT element: KtProperty
|
||||
FIR element: FirPropertyImpl
|
||||
FIR source kind: KtRealSourceElementKind
|
||||
|
||||
FIR element rendered:
|
||||
@R|foo/Anno|[Types](position = <strcat>(String(property ), R|foo/secondConstant|)) [ResolvedTo(BODY_RESOLVE)] lval localProperty: R|@R|foo/Anno|(<strcat>(String(return type: ), constant#)) kotlin/collections/List<@R|foo/Anno|(<strcat>(String(nested return type: ), constant#)) kotlin/collections/Collection<@R|foo/Anno|(<strcat>(String(nested nested return type: ), constant#)) kotlin/String>>|by R|kotlin/lazy|<R|@R|foo/Anno|(<strcat>(String(return type: ), constant#)) kotlin/collections/List<@R|foo/Anno|(<strcat>(String(nested return type: ), constant#)) kotlin/collections/Collection<@R|foo/Anno|(<strcat>(String(nested nested return type: ), constant#)) kotlin/String>>|>(<L> = [ResolvedTo(BODY_RESOLVE)] [MatchingParameterFunctionTypeKey=kotlin/Function0<T>] lazy@fun <anonymous>(): R|@R|foo/Anno|(<strcat>(String(return type: ), constant#)) kotlin/collections/List<@R|foo/Anno|(<strcat>(String(nested return type: ), constant#)) kotlin/collections/Collection<@R|foo/Anno|(<strcat>(String(nested nested return type: ), constant#)) kotlin/String>>| <inline=NoInline> {
|
||||
^ R|foo/explicitType|()
|
||||
}
|
||||
)
|
||||
|
||||
FIR FILE:
|
||||
FILE: [ResolvedTo(IMPORTS)] localDelegatedPropertyWithPropagatedType.kt
|
||||
package foo
|
||||
|
||||
@R|kotlin/annotation/Target|[Types](Q|kotlin/annotation/AnnotationTarget|.R|kotlin/annotation/AnnotationTarget.TYPE|, Q|kotlin/annotation/AnnotationTarget|.R|kotlin/annotation/AnnotationTarget.LOCAL_VARIABLE|) public final [ResolvedTo(STATUS)] annotation class Anno : R|kotlin/Annotation| {
|
||||
public [ResolvedTo(STATUS)] [ContainingClassKey=Anno] constructor([ResolvedTo(STATUS)] [CorrespondingProperty=foo/Anno.position] position: R|kotlin/String|): R|foo/Anno| {
|
||||
LAZY_super<R|kotlin/Any|>
|
||||
}
|
||||
|
||||
public final [ResolvedTo(STATUS)] [IsFromPrimaryConstructor=true] val position: R|kotlin/String| = R|<local>/position|
|
||||
public [ResolvedTo(STATUS)] [ContainingClassKey=Anno] get(): R|kotlin/String|
|
||||
|
||||
}
|
||||
public? final? const [ResolvedTo(RAW_FIR)] val constant: <implicit> = LAZY_EXPRESSION
|
||||
public? [ResolvedTo(RAW_FIR)] get(): <implicit>
|
||||
public final [ResolvedTo(CONTRACTS)] fun explicitType(): R|@R|foo/Anno|(<strcat>(String(return type: ), constant#)) kotlin/collections/List<@R|foo/Anno|(<strcat>(String(nested return type: ), constant#)) kotlin/collections/Collection<@R|foo/Anno|(<strcat>(String(nested nested return type: ), constant#)) kotlin/String>>| {
|
||||
^explicitType IntegerLiteral(0)
|
||||
}
|
||||
public final [ResolvedTo(BODY_RESOLVE)] fun resolveMe(): R|kotlin/Unit| {
|
||||
@R|foo/Anno|[Types](position = <strcat>(String(property ), R|foo/secondConstant|)) [ResolvedTo(BODY_RESOLVE)] lval localProperty: R|@R|foo/Anno|(<strcat>(String(return type: ), constant#)) kotlin/collections/List<@R|foo/Anno|(<strcat>(String(nested return type: ), constant#)) kotlin/collections/Collection<@R|foo/Anno|(<strcat>(String(nested nested return type: ), constant#)) kotlin/String>>|by R|kotlin/lazy|<R|@R|foo/Anno|(<strcat>(String(return type: ), constant#)) kotlin/collections/List<@R|foo/Anno|(<strcat>(String(nested return type: ), constant#)) kotlin/collections/Collection<@R|foo/Anno|(<strcat>(String(nested nested return type: ), constant#)) kotlin/String>>|>(<L> = [ResolvedTo(BODY_RESOLVE)] [MatchingParameterFunctionTypeKey=kotlin/Function0<T>] lazy@fun <anonymous>(): R|@R|foo/Anno|(<strcat>(String(return type: ), constant#)) kotlin/collections/List<@R|foo/Anno|(<strcat>(String(nested return type: ), constant#)) kotlin/collections/Collection<@R|foo/Anno|(<strcat>(String(nested nested return type: ), constant#)) kotlin/String>>| <inline=NoInline> {
|
||||
^ R|foo/explicitType|()
|
||||
}
|
||||
)
|
||||
}
|
||||
public final const [ResolvedTo(IMPLICIT_TYPES_BODY_RESOLVE)] val secondConstant: R|kotlin/String| = String(str)
|
||||
public [ResolvedTo(IMPLICIT_TYPES_BODY_RESOLVE)] get(): R|kotlin/String|
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
package foo
|
||||
|
||||
@Target(AnnotationTarget.TYPE, AnnotationTarget.LOCAL_VARIABLE)
|
||||
annotation class Anno(val position: String)
|
||||
const val constant = 0
|
||||
|
||||
fun explicitType(): @Anno("return type: $constant") List<@Anno("nested return type: $constant") Collection<@Anno("nested nested return type: $constant") String>> = 0
|
||||
|
||||
fun resolveMe() {
|
||||
<expr>
|
||||
@Anno("property $secondConstant")
|
||||
val localProperty = explicitType()
|
||||
</expr>
|
||||
}
|
||||
|
||||
const val secondConstant = "str"
|
||||
+30
@@ -0,0 +1,30 @@
|
||||
KT element: KtProperty
|
||||
FIR element: FirPropertyImpl
|
||||
FIR source kind: KtRealSourceElementKind
|
||||
|
||||
FIR element rendered:
|
||||
@R|foo/Anno|[Types](position = <strcat>(String(property ), R|foo/secondConstant|)) [ResolvedTo(BODY_RESOLVE)] lval localProperty: R|@R|foo/Anno|(<strcat>(String(return type: ), constant#)) kotlin/collections/List<@R|foo/Anno|(<strcat>(String(nested return type: ), constant#)) kotlin/collections/Collection<@R|foo/Anno|(<strcat>(String(nested nested return type: ), constant#)) kotlin/String>>| = R|foo/explicitType|()
|
||||
|
||||
FIR FILE:
|
||||
FILE: [ResolvedTo(IMPORTS)] localPropertyWithPropagatedType.kt
|
||||
package foo
|
||||
|
||||
@R|kotlin/annotation/Target|[Types](Q|kotlin/annotation/AnnotationTarget|.R|kotlin/annotation/AnnotationTarget.TYPE|, Q|kotlin/annotation/AnnotationTarget|.R|kotlin/annotation/AnnotationTarget.LOCAL_VARIABLE|) public final [ResolvedTo(STATUS)] annotation class Anno : R|kotlin/Annotation| {
|
||||
public [ResolvedTo(STATUS)] [ContainingClassKey=Anno] constructor([ResolvedTo(STATUS)] [CorrespondingProperty=foo/Anno.position] position: R|kotlin/String|): R|foo/Anno| {
|
||||
LAZY_super<R|kotlin/Any|>
|
||||
}
|
||||
|
||||
public final [ResolvedTo(STATUS)] [IsFromPrimaryConstructor=true] val position: R|kotlin/String| = R|<local>/position|
|
||||
public [ResolvedTo(STATUS)] [ContainingClassKey=Anno] get(): R|kotlin/String|
|
||||
|
||||
}
|
||||
public? final? const [ResolvedTo(RAW_FIR)] val constant: <implicit> = LAZY_EXPRESSION
|
||||
public? [ResolvedTo(RAW_FIR)] get(): <implicit>
|
||||
public final [ResolvedTo(CONTRACTS)] fun explicitType(): R|@R|foo/Anno|(<strcat>(String(return type: ), constant#)) kotlin/collections/List<@R|foo/Anno|(<strcat>(String(nested return type: ), constant#)) kotlin/collections/Collection<@R|foo/Anno|(<strcat>(String(nested nested return type: ), constant#)) kotlin/String>>| {
|
||||
^explicitType IntegerLiteral(0)
|
||||
}
|
||||
public final [ResolvedTo(BODY_RESOLVE)] fun resolveMe(): R|kotlin/Unit| {
|
||||
@R|foo/Anno|[Types](position = <strcat>(String(property ), R|foo/secondConstant|)) [ResolvedTo(BODY_RESOLVE)] lval localProperty: R|@R|foo/Anno|(<strcat>(String(return type: ), constant#)) kotlin/collections/List<@R|foo/Anno|(<strcat>(String(nested return type: ), constant#)) kotlin/collections/Collection<@R|foo/Anno|(<strcat>(String(nested nested return type: ), constant#)) kotlin/String>>| = R|foo/explicitType|()
|
||||
}
|
||||
public final const [ResolvedTo(IMPLICIT_TYPES_BODY_RESOLVE)] val secondConstant: R|kotlin/String| = String(str)
|
||||
public [ResolvedTo(IMPLICIT_TYPES_BODY_RESOLVE)] get(): R|kotlin/String|
|
||||
+12
@@ -1277,6 +1277,12 @@ public class OutOfContentRootGetOrBuildFirTestGenerated extends AbstractOutOfCon
|
||||
runTest("analysis/low-level-api-fir/testData/getOrBuildFir/wholeDeclaration/localClass.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("localDelegatedPropertyWithPropagatedType.kt")
|
||||
public void testLocalDelegatedPropertyWithPropagatedType() throws Exception {
|
||||
runTest("analysis/low-level-api-fir/testData/getOrBuildFir/wholeDeclaration/localDelegatedPropertyWithPropagatedType.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("localFunction.kt")
|
||||
public void testLocalFunction() throws Exception {
|
||||
@@ -1289,6 +1295,12 @@ public class OutOfContentRootGetOrBuildFirTestGenerated extends AbstractOutOfCon
|
||||
runTest("analysis/low-level-api-fir/testData/getOrBuildFir/wholeDeclaration/localProperty.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("localPropertyWithPropagatedType.kt")
|
||||
public void testLocalPropertyWithPropagatedType() throws Exception {
|
||||
runTest("analysis/low-level-api-fir/testData/getOrBuildFir/wholeDeclaration/localPropertyWithPropagatedType.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("memberFunction.kt")
|
||||
public void testMemberFunction() throws Exception {
|
||||
|
||||
+12
@@ -1277,6 +1277,12 @@ public class SourceGetOrBuildFirTestGenerated extends AbstractSourceGetOrBuildFi
|
||||
runTest("analysis/low-level-api-fir/testData/getOrBuildFir/wholeDeclaration/localClass.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("localDelegatedPropertyWithPropagatedType.kt")
|
||||
public void testLocalDelegatedPropertyWithPropagatedType() throws Exception {
|
||||
runTest("analysis/low-level-api-fir/testData/getOrBuildFir/wholeDeclaration/localDelegatedPropertyWithPropagatedType.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("localFunction.kt")
|
||||
public void testLocalFunction() throws Exception {
|
||||
@@ -1289,6 +1295,12 @@ public class SourceGetOrBuildFirTestGenerated extends AbstractSourceGetOrBuildFi
|
||||
runTest("analysis/low-level-api-fir/testData/getOrBuildFir/wholeDeclaration/localProperty.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("localPropertyWithPropagatedType.kt")
|
||||
public void testLocalPropertyWithPropagatedType() throws Exception {
|
||||
runTest("analysis/low-level-api-fir/testData/getOrBuildFir/wholeDeclaration/localPropertyWithPropagatedType.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("memberFunction.kt")
|
||||
public void testMemberFunction() throws Exception {
|
||||
|
||||
Reference in New Issue
Block a user