Commit 5026cfd 1 parent 2319143 commit 5026cfd Copy full SHA for 5026cfd
File tree 1 file changed +8
-6
lines changed
arrow-libs/optics/arrow-optics-ksp-plugin/src/main/kotlin/arrow/optics/plugin
1 file changed +8
-6
lines changed Original file line number Diff line number Diff line change @@ -15,6 +15,7 @@ import com.google.devtools.ksp.processing.Resolver
15
15
import com.google.devtools.ksp.processing.SymbolProcessor
16
16
import com.google.devtools.ksp.symbol.KSAnnotated
17
17
import com.google.devtools.ksp.symbol.KSClassDeclaration
18
+ import com.google.devtools.ksp.validate
18
19
19
20
class OpticsProcessor (
20
21
private val codegen : CodeGenerator ,
@@ -23,15 +24,16 @@ class OpticsProcessor(
23
24
) :
24
25
SymbolProcessor {
25
26
override fun process (resolver : Resolver ): List <KSAnnotated > {
26
- resolver
27
+ val (resolved, deferred) = resolver
27
28
.getSymbolsWithAnnotation(" arrow.optics.optics" )
28
29
.filterIsInstance<KSClassDeclaration >()
29
- .forEach(::processClass)
30
+ .partition { it.validate() }
31
+ resolved.forEach(::processClass)
30
32
31
- // the docs say that [process] should return
32
- // "deferred symbols that the processor can't process"
33
- // and in theory we have none
34
- return emptyList()
33
+ // If types used by the annotated class are by other processors,
34
+ // such class will fail the validation. In that case, we need to
35
+ // defer the code generation for the class to the next round
36
+ return deferred
35
37
}
36
38
37
39
private fun processClass (klass : KSClassDeclaration ) {
You can’t perform that action at this time.
0 commit comments