diff --git a/src/fable-library-dart/Map.fs b/src/fable-library-dart/Map.fs index a8423c25c2..050ec50915 100644 --- a/src/fable-library-dart/Map.fs +++ b/src/fable-library-dart/Map.fs @@ -123,7 +123,8 @@ module MapTree = else // rotate left mk (mk t1 k v t2'.Left) t2'.Key t2'.Value t2'.Right | _ -> failwith "internal error: Map.rebalance" - else if t1h > t2h + tolerance then // left is heavier than right + // left is heavier than right + else if t1h > t2h + tolerance then match t1.Value with | :? MapTreeNode<'Key, 'Value> as t1' -> // one of the nodes must have height > height t2 + 1 diff --git a/src/fable-library-dart/Set.fs b/src/fable-library-dart/Set.fs index 315b8e50bd..6d24568e3b 100644 --- a/src/fable-library-dart/Set.fs +++ b/src/fable-library-dart/Set.fs @@ -130,7 +130,8 @@ module SetTree = else // rotate left mk (mk t1 v t2'.Left) t2'.Key t2'.Right | _ -> failwith "internal error: Set.rebalance" - else if t1h > t2h + tolerance then // left is heavier than right + // left is heavier than right + else if t1h > t2h + tolerance then match t1.Value with | :? SetTreeNode<'T> as t1' -> // one of the nodes must have height > height t2 + 1 diff --git a/src/fable-library-py/fable_library/Map.fs b/src/fable-library-py/fable_library/Map.fs index 5747e113d8..6416366633 100644 --- a/src/fable-library-py/fable_library/Map.fs +++ b/src/fable-library-py/fable_library/Map.fs @@ -124,7 +124,8 @@ module MapTree = else // rotate left mk (mk t1 k v t2'.Left) t2'.Key t2'.Value t2'.Right | _ -> failwith "internal error: Map.rebalance" - else if t1h > t2h + tolerance then // left is heavier than right + // left is heavier than right + else if t1h > t2h + tolerance then match t1.Value with | :? MapTreeNode<'Key, 'Value> as t1' -> // one of the nodes must have height > height t2 + 1 diff --git a/src/fable-library-py/fable_library/Set.fs b/src/fable-library-py/fable_library/Set.fs index c25626a5f2..7398b1d7de 100644 --- a/src/fable-library-py/fable_library/Set.fs +++ b/src/fable-library-py/fable_library/Set.fs @@ -130,7 +130,8 @@ module SetTree = else // rotate left mk (mk t1 v t2'.Left) t2'.Key t2'.Right | _ -> failwith "internal error: Set.rebalance" - else if t1h > t2h + tolerance then // left is heavier than right + // left is heavier than right + else if t1h > t2h + tolerance then match t1.Value with | :? SetTreeNode<'T> as t1' -> // one of the nodes must have height > height t2 + 1 diff --git a/src/fable-library-rust/src/Map.fs b/src/fable-library-rust/src/Map.fs index 326ca7366c..fbf1858960 100644 --- a/src/fable-library-rust/src/Map.fs +++ b/src/fable-library-rust/src/Map.fs @@ -99,7 +99,8 @@ let rebalance t1 (k: 'K) (v: 'V) t2 : Map<'K, 'V> = mk (mk t1 k v t2l.Left) t2l.Key t2l.Value (mk t2l.Right t2'.Key t2'.Value t2'.Right) else // rotate left mk (mk t1 k v t2'.Left) t2'.Key t2'.Value t2'.Right - else if t1h > t2h + tolerance then // left is heavier than right + // left is heavier than right + else if t1h > t2h + tolerance then let t1' = (getRoot t1).Value // one of the nodes must have height > height t2 + 1 if height t1'.Right > t2h + 1 then diff --git a/src/fable-library-rust/src/Set.fs b/src/fable-library-rust/src/Set.fs index 81442dbb9e..da6fd60563 100644 --- a/src/fable-library-rust/src/Set.fs +++ b/src/fable-library-rust/src/Set.fs @@ -97,7 +97,8 @@ let rebalance (t1: Set<'T>) v (t2: Set<'T>) = mk (mk t1 v t2l.Left) t2l.Key (mk t2l.Right t2'.Key t2'.Right) else // rotate left mk (mk t1 v t2'.Left) t2'.Key t2'.Right - else if t1h > t2h + tolerance then // left is heavier than right + // left is heavier than right + else if t1h > t2h + tolerance then let t1' = (getRoot t1).Value // one of the nodes must have height > height t2 + 1 if height t1'.Right > t2h + 1 then diff --git a/src/fable-library-ts/Map.fs b/src/fable-library-ts/Map.fs index d6741543f7..ee52a22643 100644 --- a/src/fable-library-ts/Map.fs +++ b/src/fable-library-ts/Map.fs @@ -123,7 +123,8 @@ module MapTree = else // rotate left mk (mk t1 k v t2'.Left) t2'.Key t2'.Value t2'.Right | _ -> failwith "internal error: Map.rebalance" - else if t1h > t2h + tolerance then // left is heavier than right + // left is heavier than right + else if t1h > t2h + tolerance then match t1.Value with | :? MapTreeNode<'Key, 'Value> as t1' -> // one of the nodes must have height > height t2 + 1 diff --git a/src/fable-library-ts/Set.fs b/src/fable-library-ts/Set.fs index a96e6c36e0..4a39504015 100644 --- a/src/fable-library-ts/Set.fs +++ b/src/fable-library-ts/Set.fs @@ -130,7 +130,8 @@ module SetTree = else // rotate left mk (mk t1 v t2'.Left) t2'.Key t2'.Right | _ -> failwith "internal error: Set.rebalance" - else if t1h > t2h + tolerance then // left is heavier than right + // left is heavier than right + else if t1h > t2h + tolerance then match t1.Value with | :? SetTreeNode<'T> as t1' -> // one of the nodes must have height > height t2 + 1