Skip to content

Commit

Permalink
Fix issue with synchronizedIteration
Browse files Browse the repository at this point in the history
  • Loading branch information
jurmous committed Feb 14, 2024
1 parent da519cf commit 202e59c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ interface IsDefinitionWithDataModel<out DM : IsTypedDataModel<*>> {
return false
}

return when (val migrationStatus = (this.dataModel as? IsStorableDataModel<*>)?.isMigrationNeeded(definition.dataModel as IsStorableDataModel<*>, checkedDataModelNames = checkedDataModelNames)) {
return when (val migrationStatus = (this.dataModel as? IsStorableDataModel<*>)?.isMigrationNeeded(comparisonDataModel, checkedDataModelNames = checkedDataModelNames)) {
null -> {
addIncompatibilityReason?.invoke("current DataModel not Serializable")
false
Expand Down
6 changes: 3 additions & 3 deletions lib/src/commonMain/kotlin/maryk/lib/synchronizedIteration.kt
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ fun <T> synchronizedIteration(
iterator1: Iterator<T>,
iterator2: Iterator<T>,
comparator: Comparator<T>,
processBoth: (T, T) -> Unit = { _, _ -> Unit},
processBoth: (T, T) -> Unit = { _, _ -> },
processOnlyOnIterator1: (T) -> Unit = {},
processOnlyOnIterator2: (T) -> Unit = {}
) {
Expand Down Expand Up @@ -41,9 +41,9 @@ fun <T> synchronizedIteration(
val result = comparator.compare(val1, val2)
when {
result == 0 -> {
processBoth(val2, val1)
value2 = if (iterator2.hasNext()) iterator2.next() else null
processBoth(val1, val2)
value1 = if (iterator1.hasNext()) iterator1.next() else null
value2 = if (iterator2.hasNext()) iterator2.next() else null
}
result > 0 ->
if (iterator1.hasNext()) process1(val1) else process2(val2)
Expand Down

0 comments on commit 202e59c

Please sign in to comment.