mirror of
https://github.com/unisonweb/unison.git
synced 2024-10-05 06:07:21 +03:00
rename decls to types
This commit is contained in:
parent
28249cebf8
commit
1cffaa6809
@ -32,12 +32,12 @@ import Unison.Util.Map qualified as Map
|
||||
|
||||
-- | Convert a V3 branch to a hashing branch.
|
||||
convertBranchV3 :: BranchV3 m -> H2.Branch
|
||||
convertBranchV3 BranchV3 {children, decls, terms} =
|
||||
convertBranchV3 BranchV3 {children, terms, types} =
|
||||
H2.Branch
|
||||
{ children = children & Map.bimap coerce (unCausalHash . Causal.causalHash),
|
||||
patches = Map.empty,
|
||||
terms = Map.bimap coerce (\ref -> Map.singleton (v2ToH2Referent ref) emptyMetadata) terms,
|
||||
types = Map.bimap coerce (\ref -> Map.singleton (v2ToH2Reference ref) emptyMetadata) decls
|
||||
types = Map.bimap coerce (\ref -> Map.singleton (v2ToH2Reference ref) emptyMetadata) types
|
||||
}
|
||||
where
|
||||
emptyMetadata = H2.MdValues Set.empty
|
||||
|
@ -54,8 +54,8 @@ data Branch' t h p c = Branch
|
||||
-- | A V3 branch; see U.Codebase.BranchV3
|
||||
data GBranchV3 t h c = BranchV3
|
||||
{ children :: !(Map t c),
|
||||
decls :: !(Map t (TypeReference' t h)),
|
||||
terms :: !(Map t (Referent'' t h))
|
||||
terms :: !(Map t (Referent'' t h)),
|
||||
types :: !(Map t (TypeReference' t h))
|
||||
}
|
||||
deriving stock (Generic, Show)
|
||||
|
||||
|
@ -716,9 +716,9 @@ saveNamespace hh bhId me = do
|
||||
pure (DbBranchV2 S.Branch {terms, types, patches, children})
|
||||
BranchV3 branch -> do
|
||||
children <- Map.bitraverse saveNameSegment (saveBranchV3 hh) (branch ^. #children)
|
||||
decls <- Map.bitraverse saveNameSegment c2sReference (branch ^. #decls)
|
||||
terms <- Map.bitraverse saveNameSegment c2sReferent (branch ^. #terms)
|
||||
pure (DbBranchV3 S.BranchV3 {children, decls, terms})
|
||||
types <- Map.bitraverse saveNameSegment c2sReference (branch ^. #types)
|
||||
pure (DbBranchV3 S.BranchV3 {children, terms, types})
|
||||
|
||||
c2sMetadata :: Transaction C.Branch.MdValues -> Transaction S.Branch.Full.DbMetadataSet
|
||||
c2sMetadata mm = do
|
||||
@ -942,13 +942,13 @@ saveDbBranchUnderHashId hh bhId@(Db.unBranchHashId -> hashId) stats = \case
|
||||
DbBranchV2 branch -> saveV2 branch
|
||||
-- Here, we elect to serialize V3 branches as V2 branches just before saving them to the database. We could save a
|
||||
-- little space instead by actually having a proper serialization format for V3 branches.
|
||||
DbBranchV3 branch ->
|
||||
DbBranchV3 S.BranchV3 {children, terms, types} ->
|
||||
saveV2
|
||||
S.Branch
|
||||
{ children = branch ^. #children,
|
||||
{ children,
|
||||
patches = Map.empty,
|
||||
terms = Map.map unconflictedAndWithoutMetadata (branch ^. #terms),
|
||||
types = Map.map unconflictedAndWithoutMetadata (branch ^. #decls)
|
||||
terms = Map.map unconflictedAndWithoutMetadata terms,
|
||||
types = Map.map unconflictedAndWithoutMetadata types
|
||||
}
|
||||
where
|
||||
-- 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
|
||||
}
|
||||
childrenStats <- getChildrenStats children
|
||||
pure (myStats <> childrenStats)
|
||||
DbBranchV3 S.BranchV3 {children, decls, terms} -> do
|
||||
DbBranchV3 S.BranchV3 {children, terms, types} -> do
|
||||
let myStats =
|
||||
NamespaceStats
|
||||
{ numContainedTerms = Map.size terms,
|
||||
numContainedTypes = Map.size decls,
|
||||
numContainedTypes = Map.size types,
|
||||
numContainedPatches = 0
|
||||
}
|
||||
childrenStats <- getChildrenStats children
|
||||
|
@ -20,8 +20,8 @@ import Unison.Prelude
|
||||
-- * Patches don't exist.
|
||||
data BranchV3 m = BranchV3
|
||||
{ children :: !(Map NameSegment (CausalBranchV3 m)),
|
||||
decls :: !(Map NameSegment TypeReference),
|
||||
terms :: !(Map NameSegment Referent)
|
||||
terms :: !(Map NameSegment Referent),
|
||||
types :: !(Map NameSegment TypeReference)
|
||||
}
|
||||
deriving stock (Generic)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user