Closed konsumlamm closed 4 months ago
This is a bug in isProperSubmapOfBy
.
When the first tree is in the left/right child of the second tree, and the first tree and the left/right child compare equal, the EQ
should be updated to LT
since it's a proper submap.
I tried to trace the source of the error and looks like it has been there since the commit which introduced IntMap
bbbba97cbcf12039810533e3a2daf2eefdefe7f0.
whoa, indeed.
when translating the textual description to a property, with leancheck I get
ghci> checkFor 100000 $ \ f a b -> I.isProperSubmapOfBy f a b == (S.isProperSubsetOf (I.keysSet a ) (I.keysSet b) && and (I.intersectionWith f a b))
*** Failed! Falsifiable (after 4652 tests):
(\_ _ -> True) (fromList [(0,()),(1,())]) (fromList [(-1,()),(0,()),(1,())])
Also,
ghci> I.isProperSubmapOf (I.fromList [(0,()),(1,())]) (I.fromList [(-1,()),(0,()),(1,())])
False
This bug was fixed for IntSet
in 71fe15fec4da46f3f0ee51742fa6b5b338d88f98 GHC #1762. Unfortunately they missed IntMap
.
That's an incredibly old bug. Wow.
I got the following test failure for
isProperSubmapOfBy
inintmap-properties
: