Skip to content

Commit

Permalink
Fix StaticType.flatten() on AnyOfType of AnyType
Browse files Browse the repository at this point in the history
  • Loading branch information
alancai98 committed Mar 20, 2024
1 parent a18e8e0 commit 16a5220
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ Thank you to all who have contributed!
### Deprecated

### Fixed
- `StaticType.flatten()` on an `AnyOfType` with `AnyType` will return `AnyType`

### Removed

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -630,7 +630,7 @@ public data class AnyOfType(val types: Set<StaticType>, override val metas: Map<
types = this.types.flatMap {
when (it) {
is SingleType -> listOf(it)
is AnyType -> listOf(it)
is AnyType -> return@flatten it // if `AnyType`, return `AnyType`
is AnyOfType -> it.types
}
}.toSet()
Expand Down

0 comments on commit 16a5220

Please sign in to comment.