Skip to content

Commit

Permalink
Fix parsing data objects schema modifiers. (#1786)
Browse files Browse the repository at this point in the history
  • Loading branch information
colinrtwhite authored Jan 26, 2024
1 parent 3373f8f commit 46e2056
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -367,7 +367,9 @@ private fun parseModifier(
"@Modifier $memberFqType must have at least one scope."
}

val properties = if (memberType.isData) {
val properties = if (memberType.objectInstance != null) {
emptyList()
} else if (memberType.isData) {
memberType.primaryConstructor!!.parameters.map { parameter ->
val kProperty = memberType.memberProperties.single { it.name == parameter.name }
val name = kProperty.name
Expand All @@ -390,8 +392,6 @@ private fun parseModifier(
deprecation = deprecation,
)
}
} else if (memberType.objectInstance != null) {
emptyList()
} else {
throw IllegalArgumentException(
"@Modifier ${memberType.qualifiedName} must be 'data' class or 'object'",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ import kotlin.time.Duration
CustomTypeStateless::class,
CustomTypeWithDefault::class,
CustomTypeWithMultipleScopes::class,
CustomTypeDataObject::class,
Text::class,
Button::class,
Button2::class,
Expand Down Expand Up @@ -136,3 +137,6 @@ public data class CustomTypeWithDefault(

@Modifier(6, TestScope::class, SecondaryTestScope::class)
public object CustomTypeWithMultipleScopes

@Modifier(7, TestScope::class)
public data object CustomTypeDataObject

0 comments on commit 46e2056

Please sign in to comment.