Ahmed Mourad
04/18/2021, 3:26 AMfun KtClassOrObject.findSuperType(
bindingContext: BindingContext,
fqName: FqName
): KtSuperTypeListEntry? {
return this.superTypeListEntries.firstOrNull { entry ->
bindingContext.get(
BindingContext.TYPE,
entry.typeReference
)?.constructor?.declarationDescriptor?.fqNameSafe == fqName
}
}
It's called inside an AnalysisHandler's analysisCompleted
.
The problem is that bindingContext#get
always returns null, despite entry.typeReference
not being null, but why?raulraja
04/18/2021, 9:27 AMRetryWithAdditionalRoots
in the first analysis result in order to rewind and do a second pass over analysis.Ahmed Mourad
04/19/2021, 4:04 AMGC Overhead limit exceeded
failure.
Looking at different implementations on Github I came across this reoccurring pattern of keeping a local didRecompile
flag which seems to ensure retrying is only triggered once:
https://github.com/square/anvil/blob/9f05fa9714cdb238bb81960045d81b2e1d12e9bb/comp[…]/com/squareup/anvil/compiler/codegen/CodeGenerationExtension.kt
https://github.com/ShikaSD/kotlin-compiler-plugin-retry-with-additional-roots/blob/master/compiler-plugin/src/main/kotlin/Plugin.kt
This seems to be the reason for the given problem, but I'm now unsure what a prober AnalysisHandlerExtension
should look like.raulraja
04/19/2021, 1:11 PM