fixes in ksp sealed generator

This commit is contained in:
InsanusMokrassar 2024-07-26 17:17:11 +06:00
parent 4913e99c2e
commit ad401105a1
2 changed files with 6 additions and 1 deletions

View File

@ -2,6 +2,10 @@
## 0.21.6
* `KSP`:
* `Sealed`:
* Fixes in generation
## 0.21.5
* `KSP`:

View File

@ -26,7 +26,8 @@ class Processor(
private fun KSClassDeclaration.findSealedConnection(potentialSealedParent: KSClassDeclaration): Boolean {
val targetClassname = potentialSealedParent.qualifiedName ?.asString()
return superTypes.any {
targetClassname == ((it.resolve().declaration as? KSClassDeclaration) ?.qualifiedName ?.asString()) || (it is KSClassDeclaration && it.getSealedSubclasses().any() && it.findSealedConnection(potentialSealedParent))
val itAsDeclaration = it.resolve().declaration as? KSClassDeclaration ?: return@any false
targetClassname == (itAsDeclaration.qualifiedName ?.asString()) || (itAsDeclaration.getSealedSubclasses().any() && itAsDeclaration.findSealedConnection(potentialSealedParent))
}
}