-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add opportunity to generate types lists for sealed subtypes
- Loading branch information
1 parent
b400974
commit 6d0e262
Showing
7 changed files
with
122 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 12 additions & 0 deletions
12
ksp/sealed/generator/test/src/commonMain/kotlin/TestSealedTypesWorkaround.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
// THIS CODE HAVE BEEN GENERATED AUTOMATICALLY | ||
// TO REGENERATE IT JUST DELETE FILE | ||
// ORIGINAL FILE: Test.kt | ||
package dev.inmo.micro_utils.ksp.`sealed`.generator.test | ||
|
||
import kotlin.collections.Set | ||
import kotlin.reflect.KClass | ||
|
||
private val subtypes: Set<KClass<out Test>> = setOf(Test.C::class, | ||
Test.A::class) | ||
|
||
public fun Test.Companion.subtypes(): Set<KClass<out Test>> = subtypes |
15 changes: 15 additions & 0 deletions
15
ksp/sealed/src/commonMain/kotlin/GenerateSealedTypesWorkaround.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
package dev.inmo.micro_utils.ksp.sealed | ||
|
||
@Retention(AnnotationRetention.BINARY) | ||
@Target(AnnotationTarget.CLASS) | ||
annotation class GenerateSealedTypesWorkaround( | ||
val prefix: String = "", | ||
val includeNonSealedSubTypes: Boolean = false, | ||
) { | ||
@Retention(AnnotationRetention.BINARY) | ||
@Target(AnnotationTarget.CLASS) | ||
annotation class Order(val order: Int) | ||
@Retention(AnnotationRetention.BINARY) | ||
@Target(AnnotationTarget.CLASS) | ||
annotation class Exclude | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters