You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We can use Dependencies or CodeGenerator.associateWithClasses() to associate CodeGenerator to enclosing files or classes for most elements, but we can't find any for top-level functions and properties from compiled classes. Both KSDeclaration.parentDeclaration and KSNode.containingFile return null. We may need a way to associate these top-level elements.
The text was updated successfully, but these errors were encountered:
XElement.originatingElementForPoet() fails when the underlying ksDeclaration is not a class. This CL fixes that by making this function cover all subtypes of XElement except top-level functions and properties.
We can't yet support top-level functions and properties from compiled classes in KSP due to google/ksp#1704.
Test: OriginatingElementsTest.kt
Bug: 322539430
Change-Id: I36fee2a4ece66bd542b6da8062c5d942c9e77552
Introduced CodeGenerator.associateWithFunctions() and CodeGenerator.associateWithProperties() in #1707.
N.B. because how top level functions and properties are implemented in libraries is backend / platform specific, there is no simple way to invalidate them individually or in a finer granular. This implementation treats the outputs that are associated by these 2 APIs as aggregating. Further optimizations will be done in the future.
We can use
Dependencies
orCodeGenerator.associateWithClasses()
to associate CodeGenerator to enclosing files or classes for most elements, but we can't find any for top-level functions and properties from compiled classes. BothKSDeclaration.parentDeclaration
andKSNode.containingFile
returnnull
. We may need a way to associate these top-level elements.The text was updated successfully, but these errors were encountered: