[K2] Instantiation of annotations having default values for properties
This commit adds missing pieces for the puzzle: Annotation instantiation feature uses IrProperty's initializer to instantiate properties from other modules that have default values which weren't specified on call site. To support this feature properly, Fir2IrVisitor should fill LazyIrProperty's backing field initializer with information from Fir. To get this information into Fir, FirMemberDeserializer should be able to read it from KotlinJvmBinaryClass with AnnotationLoaderVisitorImpl. (klibs are unsupported for now) There's a catch with enum entries references: we can't access session.SymbolProvider to resolve it because we're still at the deserialization stage, and it can cause StackOverflow if enum is nested in the same class (see RequiresOptIn.Level). To mitigate this, a new FirEnumEntryDeserializedAccessExpression is produced instead; it is later replaced with the correct reference in the Fir2IrVisitor. ^KT-58137 Fixed Also add test to loadJava folder with annotations default values that verifies metadata loading
This commit is contained in:
committed by
Space Team
parent
d757847ed6
commit
c4255f9a9e
Vendored
+2
-2
@@ -1,8 +1,8 @@
|
||||
public final annotation class Anno : R|kotlin/Annotation| {
|
||||
public final val value: R|kotlin/String|
|
||||
public final val value: R|kotlin/String| = String(0)
|
||||
public get(): R|kotlin/String|
|
||||
|
||||
public final val x: R|kotlin/Int|
|
||||
public final val x: R|kotlin/Int| = Int(0)
|
||||
public get(): R|kotlin/Int|
|
||||
|
||||
public constructor(value: R|kotlin/String| = STUB, x: R|kotlin/Int| = STUB): R|test/Anno|
|
||||
|
||||
Reference in New Issue
Block a user