Fix K2 CodeGen annotation parameter resolution failure
When we have parameters of annotation like
```
// FILE: Anno.kt
package p3
@Target(AnnotationTarget.FUNCTION)
annotation class Anno(vararg val x: String)
// FILE: main.kt
import p3.Anno
@Anno("A", "B")
fun foo(): Int = 10
```
the K2 CodeGen causes an exception reporting the unresolved type
reference. A lazy resolution call fixes the issue.
In addition, FIR for the value parameter to IR conversion fails because
`Fir2IrLazyProperty` for the value parameter tries to resolve the
initializer before creating the `IrParameterSymbol`. When it checks the
`localStorage`, it reports an error for the missing `IrParameterSymbol`.
This commit adds `IrParameterSymbol` before resolving the initializer.
^KT-65099 Fixed
This commit is contained in:
+6
@@ -46,6 +46,12 @@ public class FirIdeNormalAnalysisLibrarySourceModuleCompilerFacilityTestGenerate
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("analysis/analysis-api/testData/components/compilerFacility/compilation"), Pattern.compile("^(.+)\\.(kt)$"), null, true);
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("annotationWithVararg.kt")
|
||||
public void testAnnotationWithVararg() {
|
||||
runTest("analysis/analysis-api/testData/components/compilerFacility/compilation/annotationWithVararg.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("classKinds.kt")
|
||||
public void testClassKinds() {
|
||||
|
||||
+6
@@ -46,6 +46,12 @@ public class FirIdeNormalAnalysisSourceModuleCompilerFacilityTestGenerated exten
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("analysis/analysis-api/testData/components/compilerFacility/compilation"), Pattern.compile("^(.+)\\.(kt)$"), null, true);
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("annotationWithVararg.kt")
|
||||
public void testAnnotationWithVararg() {
|
||||
runTest("analysis/analysis-api/testData/components/compilerFacility/compilation/annotationWithVararg.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("classKinds.kt")
|
||||
public void testClassKinds() {
|
||||
|
||||
Vendored
+12
@@ -0,0 +1,12 @@
|
||||
MODULE_FRAGMENT
|
||||
FILE fqName:<root> fileName:main.kt
|
||||
FUN name:foo visibility:public modality:FINAL <> () returnType:kotlin.Int
|
||||
annotations:
|
||||
Anno(x = ["A", "B"])
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing from='public final fun foo (): kotlin.Int declared in <root>'
|
||||
CONST Int type=kotlin.Int value=10
|
||||
FUN name:test visibility:public modality:FINAL <> () returnType:kotlin.Unit
|
||||
BLOCK_BODY
|
||||
VAR name:x type:kotlin.Int [val]
|
||||
CALL 'public final fun foo (): kotlin.Int declared in <root>' type=kotlin.Int origin=null
|
||||
Vendored
+15
@@ -0,0 +1,15 @@
|
||||
// FILE: Anno.kt
|
||||
package p3
|
||||
|
||||
@Target(AnnotationTarget.FUNCTION)
|
||||
annotation class Anno(vararg val x: String)
|
||||
|
||||
// FILE: main.kt
|
||||
import p3.Anno
|
||||
|
||||
@Anno("A", "B")
|
||||
fun foo(): Int = 10
|
||||
|
||||
fun test() {
|
||||
val x = foo()
|
||||
}
|
||||
Vendored
+5
@@ -0,0 +1,5 @@
|
||||
public final class MainKt {
|
||||
// source: 'main.kt'
|
||||
public final static method foo(): int
|
||||
public final static method test(): void
|
||||
}
|
||||
Reference in New Issue
Block a user