@@ -716,9 +716,9 @@ saveNamespace hh bhId me = do
716716 pure (DbBranchV2 S. Branch {terms, types, patches, children})
717717 BranchV3 branch -> do
718718 children <- Map. bitraverse saveNameSegment (saveBranchV3 hh) (branch ^. # children)
719- decls <- Map. bitraverse saveNameSegment c2sReference (branch ^. # decls)
720719 terms <- Map. bitraverse saveNameSegment c2sReferent (branch ^. # terms)
721- pure (DbBranchV3 S. BranchV3 {children, decls, terms})
720+ types <- Map. bitraverse saveNameSegment c2sReference (branch ^. # types)
721+ pure (DbBranchV3 S. BranchV3 {children, terms, types})
722722
723723 c2sMetadata :: Transaction C.Branch. MdValues -> Transaction S.Branch.Full. DbMetadataSet
724724 c2sMetadata mm = do
@@ -942,13 +942,13 @@ saveDbBranchUnderHashId hh bhId@(Db.unBranchHashId -> hashId) stats = \case
942942 DbBranchV2 branch -> saveV2 branch
943943 -- Here, we elect to serialize V3 branches as V2 branches just before saving them to the database. We could save a
944944 -- little space instead by actually having a proper serialization format for V3 branches.
945- DbBranchV3 branch ->
945+ DbBranchV3 S. BranchV3 {children, terms, types} ->
946946 saveV2
947947 S. Branch
948- { children = branch ^. # children ,
948+ { children,
949949 patches = Map. empty,
950- terms = Map. map unconflictedAndWithoutMetadata (branch ^. # terms) ,
951- types = Map. map unconflictedAndWithoutMetadata (branch ^. # decls)
950+ terms = Map. map unconflictedAndWithoutMetadata terms,
951+ types = Map. map unconflictedAndWithoutMetadata types
952952 }
953953 where
954954 -- Carry a v3 term or type (one ref, no metadata) to a v2 term or type (set of refs, each with metadata)
@@ -1435,11 +1435,11 @@ namespaceStatsForDbBranch = \case
14351435 }
14361436 childrenStats <- getChildrenStats children
14371437 pure (myStats <> childrenStats)
1438- DbBranchV3 S. BranchV3 {children, decls, terms } -> do
1438+ DbBranchV3 S. BranchV3 {children, terms, types } -> do
14391439 let myStats =
14401440 NamespaceStats
14411441 { numContainedTerms = Map. size terms,
1442- numContainedTypes = Map. size decls ,
1442+ numContainedTypes = Map. size types ,
14431443 numContainedPatches = 0
14441444 }
14451445 childrenStats <- getChildrenStats children
0 commit comments