-
Notifications
You must be signed in to change notification settings - Fork 63
Ghost element when applying multiples minus operations on a PersistentHashSet #144
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
The reduced reproducer: import kotlinx.collections.immutable.minus
import kotlinx.collections.immutable.toPersistentHashSet
import kotlin.test.Test
import kotlin.test.assertEquals
public class KCI144 {
@Test
fun reproducer() {
val firstBatch = listOf(4554, 9380, 4260, 6602)
val secondBatch = listOf(1188, 14794)
val extraElement = 7450
val set = firstBatch.plus(secondBatch).plus(extraElement).toPersistentHashSet()
val result = set.minus(firstBatch.toPersistentHashSet()).minus(secondBatch)
assertEquals(1, result.size)
assertEquals(extraElement, result.first())
}
} |
Fixes in issues #198 and #204 mostly affected fixes inside the |
Hi everyone.
We have been using kotlinx collections immutable for some years and we finally found a bug 😟
I don't know exactly why it happens, but I can simulate it with the following code:
Basically, after two
minus
operations in a "large" PersistentHashSet, I get a PersistentSet with size 1 (as expected in this test). Still, when I try to get the element, the following exception is thrown:It long as I can tell, it is a bug exclusively on PersistentHashSet.
I've applied the same tests using
PersistentSet
,HashSet
, and Lists (immutable or not) and it worked just fine.Hope I have explained it successfully, please tell me if I can help more somehow.
The text was updated successfully, but these errors were encountered: