@@ -4712,35 +4712,34 @@ let NewClonedTycon orig = NewModifiedTycon (fun d -> d) orig
47124712/// duplicate modules etc.
47134713let CombineCcuContentFragments m l =
47144714
4715- let CombineMaps f m1 m2 =
4716- Map.foldBack ( fun k v acc -> Map.add k ( if Map.containsKey k m2 then f [ v; Map.find k m2] else f [ v]) acc) m1
4717- ( Map.foldBack ( fun k v acc -> if Map.containsKey k m1 then acc else Map.add k ( f [ v]) acc) m2 Map.empty)
4718-
47194715 /// Combine module types when multiple namespace fragments contribute to the
47204716 /// same namespace, making new module specs as we go.
47214717 let rec CombineModuleOrNamespaceTypes path m ( mty1 : ModuleOrNamespaceType ) ( mty2 : ModuleOrNamespaceType ) =
47224718 match mty1.ModuleOrNamespaceKind, mty2.ModuleOrNamespaceKind with
47234719 | Namespace, Namespace ->
47244720 let kind = mty1.ModuleOrNamespaceKind
4721+ let tab1 = mty1.AllEntitiesByLogicalMangledName
4722+ let tab2 = mty2.AllEntitiesByLogicalMangledName
47254723 let entities =
4726- ( mty1.AllEntitiesByLogicalMangledName, mty2.AllEntitiesByLogicalMangledName)
4727- ||> CombineMaps ( CombineEntityList path)
4724+ [ for e1 in mty1.AllEntities do
4725+ match tab2.TryFind e1.LogicalName with
4726+ | Some e2 -> yield CombineEntites path e1 e2
4727+ | None -> yield e1
4728+ for e2 in mty2.AllEntities do
4729+ match tab1.TryFind e2.LogicalName with
4730+ | Some _ -> ()
4731+ | None -> yield e2 ]
47284732
47294733 let vals = QueueList.append mty1.AllValsAndMembers mty2.AllValsAndMembers
47304734
4731- ModuleOrNamespaceType( kind, vals, QueueList.ofList ( NameMap.range entities) )
4735+ ModuleOrNamespaceType( kind, vals, QueueList.ofList entities)
47324736
47334737 | Namespace, _ | _, Namespace ->
47344738 error( Error( FSComp.SR.tastNamespaceAndModuleWithSameNameInAssembly( textOfPath path), m))
47354739
47364740 | _ ->
47374741 error( Error( FSComp.SR.tastTwoModulesWithSameNameInAssembly( textOfPath path), m))
47384742
4739- and CombineEntityList path l =
4740- match l with
4741- | h :: t -> List.fold ( CombineEntites path) h t
4742- | _ -> failwith " CombineEntityList"
4743-
47444743 and CombineEntites path ( entity1 : Entity ) ( entity2 : Entity ) =
47454744
47464745 match entity1.IsModuleOrNamespace, entity2.IsModuleOrNamespace with
0 commit comments