Names3 -> NamesWithHistory

This commit is contained in:
Chris Penner 2021-10-16 21:40:44 -06:00
parent 9d4dbafd16
commit acaad5d59d
30 changed files with 88 additions and 88 deletions

View File

@ -42,8 +42,8 @@ import Unison.Var ( Var )
import qualified Unison.Var as Var
import Unison.Name ( Name )
import qualified Unison.Name as Name
import Unison.Names3 (NamesWithHistory(..), Names0)
import qualified Unison.Names3 as Names3
import Unison.NamesWithHistory (NamesWithHistory(..), Names0)
import qualified Unison.NamesWithHistory as NamesWithHistory
import qualified Unison.Typechecker.TypeLookup as TL
import qualified Unison.Util.Relation as Rel
import qualified Unison.Hashing.V2.Convert as H
@ -56,7 +56,7 @@ names :: NamesWithHistory
names = NamesWithHistory names0 mempty
names0 :: Names0
names0 = Names3.names0 terms types where
names0 = NamesWithHistory.names0 terms types where
terms = Rel.mapRan Referent.Ref (Rel.fromMap termNameRefs) <>
Rel.fromList [ (Name.fromVar vc, Referent.Con (R.DerivedId r) cid ct)
| (ct, (_,(r,decl))) <- ((CT.Data,) <$> builtinDataDecls @Symbol) <>

View File

@ -23,7 +23,7 @@ import qualified Unison.LabeledDependency as LD
import Unison.Name (Name (..))
import Unison.Names2 (Names' (Names), Names0)
import qualified Unison.Names2 as Names
import qualified Unison.Names3 as Names
import qualified Unison.NamesWithHistory as Names
import Unison.Prelude hiding (empty)
import Unison.Reference (Reference)
import Unison.Referent (Referent)

View File

@ -34,7 +34,7 @@ import qualified Unison.Codebase.Branch as Branch
import qualified Unison.Codebase.Branch.Merge as Branch
import qualified Unison.Codebase.Reflog as Reflog
import Unison.Codebase.SyncMode ( SyncMode )
import Unison.Names3 ( NamesWithHistory, Names0 )
import Unison.NamesWithHistory ( NamesWithHistory, Names0 )
import Unison.Parser.Ann (Ann)
import Unison.Referent ( Referent )
import Unison.Reference ( Reference )

View File

@ -85,10 +85,10 @@ import qualified Unison.HashQualified as HQ
import qualified Unison.HashQualified' as HQ'
import qualified Unison.Name as Name
import Unison.Name ( Name )
import Unison.Names3 ( NamesWithHistory(..), Names0
import Unison.NamesWithHistory ( NamesWithHistory(..), Names0
, pattern Names0 )
import qualified Unison.Names2 as Names
import qualified Unison.Names3 as Names3
import qualified Unison.NamesWithHistory as NamesWithHistory
import Unison.Parser.Ann (Ann(..))
import Unison.Reference ( Reference(..) )
import qualified Unison.Reference as Reference
@ -637,8 +637,8 @@ loop = do
uf <- use latestTypecheckedFile >>= addWatch (HQ.toString hq)
case uf of
Nothing -> do
let parseNames0 = (`Names3.NamesWithHistory` mempty) basicPrettyPrintNames0
results = Names3.lookupHQTerm hq parseNames0
let parseNames0 = (`NamesWithHistory.NamesWithHistory` mempty) basicPrettyPrintNames0
results = NamesWithHistory.lookupHQTerm hq parseNames0
if Set.null results then
respond $ SearchTermsNotFound [hq]
else if Set.size results > 1 then
@ -1016,15 +1016,15 @@ loop = do
NamesI thing -> do
ns0 <- basicParseNames0
let ns = NamesWithHistory ns0 mempty
terms = Names3.lookupHQTerm thing ns
types = Names3.lookupHQType thing ns
terms = NamesWithHistory.lookupHQTerm thing ns
types = NamesWithHistory.lookupHQType thing ns
printNames = NamesWithHistory basicPrettyPrintNames0 mempty
terms' :: Set (Referent, Set (HQ'.HashQualified Name))
terms' = Set.map go terms where
go r = (r, Names3.termName hqLength r printNames)
go r = (r, NamesWithHistory.termName hqLength r printNames)
types' :: Set (Reference, Set (HQ'.HashQualified Name))
types' = Set.map go types where
go r = (r, Names3.typeName hqLength r printNames)
go r = (r, NamesWithHistory.typeName hqLength r printNames)
respond $ ListNames hqLength (toList types') (toList terms')
LinkI mdValue srcs -> do
@ -1061,12 +1061,12 @@ loop = do
fileByName = do
ns <- maybe mempty UF.typecheckedToNames0 <$> use latestTypecheckedFile
fnames <- pure $ Names3.NamesWithHistory ns mempty
case Names3.lookupHQTerm dotDoc fnames of
fnames <- pure $ NamesWithHistory.NamesWithHistory ns mempty
case NamesWithHistory.lookupHQTerm dotDoc fnames of
s | Set.size s == 1 -> do
-- the displayI command expects full term names, so we resolve
-- the hash back to its full name in the file
fname' <- pure $ Names3.longestTermName 10 (Set.findMin s) fnames
fname' <- pure $ NamesWithHistory.longestTermName 10 (Set.findMin s) fnames
displayI ConsoleLocation fname'
_ -> codebaseByMetadata
@ -1076,7 +1076,7 @@ loop = do
[] -> codebaseByName
[(_name, ref, _tm)] -> do
len <- eval BranchHashLength
let names = Names3.NamesWithHistory basicPrettyPrintNames0 mempty
let names = NamesWithHistory.NamesWithHistory basicPrettyPrintNames0 mempty
let tm = Term.ref External ref
tm <- eval $ Evaluate1 (PPE.fromNames len names) True tm
case tm of
@ -1088,7 +1088,7 @@ loop = do
codebaseByName = do
parseNames <- basicParseNames0
case Names3.lookupHQTerm dotDoc (Names3.NamesWithHistory parseNames mempty) of
case NamesWithHistory.lookupHQTerm dotDoc (NamesWithHistory.NamesWithHistory parseNames mempty) of
s | Set.size s == 1 -> displayI ConsoleLocation dotDoc
| Set.size s == 0 -> respond $ ListOfLinks mempty []
| otherwise -> -- todo: return a list of links here too
@ -1439,7 +1439,7 @@ loop = do
termDeprecations :: [(Name, Referent)]
termDeprecations =
[ (n, r) | (oldTypeRef,_) <- Map.elems typeEdits
, (n, r) <- Names3.constructorsForType0 oldTypeRef currentPathNames0 ]
, (n, r) <- NamesWithHistory.constructorsForType0 oldTypeRef currentPathNames0 ]
ye'ol'Patch <- getPatchAt patchPath
-- If `uf` updates a -> a', we want to replace all (a0 -> a) in patch
@ -1580,11 +1580,11 @@ loop = do
ExecuteI main -> addRunMain main uf >>= \case
NoTermWithThatName -> do
ppe <- suffixifiedPPE (Names3.NamesWithHistory basicPrettyPrintNames0 mempty)
ppe <- suffixifiedPPE (NamesWithHistory.NamesWithHistory basicPrettyPrintNames0 mempty)
mainType <- eval RuntimeMain
respond $ NoMainFunction main ppe [mainType]
TermHasBadType ty -> do
ppe <- suffixifiedPPE (Names3.NamesWithHistory basicPrettyPrintNames0 mempty)
ppe <- suffixifiedPPE (NamesWithHistory.NamesWithHistory basicPrettyPrintNames0 mempty)
mainType <- eval RuntimeMain
respond $ BadMainFunction main ty ppe [mainType]
RunMainSuccess unisonFile -> do
@ -1598,9 +1598,9 @@ loop = do
MakeStandaloneI output main -> do
mainType <- eval RuntimeMain
parseNames <-
flip Names3.NamesWithHistory mempty <$> basicPrettyPrintNames0A
flip NamesWithHistory.NamesWithHistory mempty <$> basicPrettyPrintNames0A
ppe <- suffixifiedPPE parseNames
let resolved = toList $ Names3.lookupHQTerm main parseNames
let resolved = toList $ NamesWithHistory.lookupHQTerm main parseNames
smain = HQ.toString main
filtered <- catMaybes <$>
traverse (\r -> fmap (r,) <$> loadTypeOfTerm r) resolved
@ -1617,7 +1617,7 @@ loop = do
IOTestI main -> do
-- todo - allow this to run tests from scratch file, using addRunMain
testType <- eval RuntimeTest
parseNames <- (`Names3.NamesWithHistory` mempty) <$> basicPrettyPrintNames0A
parseNames <- (`NamesWithHistory.NamesWithHistory` mempty) <$> basicPrettyPrintNames0A
ppe <- suffixifiedPPE parseNames
-- use suffixed names for resolving the argument to display
let
@ -1632,7 +1632,7 @@ loop = do
, Term.App' (Term.Constructor' ref cid) (Term.Text' msg) <- toList ts
, cid == DD.failConstructorId && ref == DD.testResultRef ]
results = Names3.lookupHQTerm main parseNames in
results = NamesWithHistory.lookupHQTerm main parseNames in
case toList results of
[Referent.Ref ref] -> do
typ <- loadTypeOfTerm (Referent.Ref ref)
@ -1735,7 +1735,7 @@ loop = do
tm (Referent.Con r _i _ct) = eval $ GetDependents r
in LD.fold tp tm ld
(missing, names0) <- eval . Eval $ Branch.findHistoricalRefs' dependents root'
let types = R.toList $ Names3.types0 names0
let types = R.toList $ NamesWithHistory.types0 names0
let terms = fmap (second Referent.toReference) $ R.toList $ Names.terms names0
let names = types <> terms
numberedArgs .= fmap (Text.unpack . Reference.toText) ((fmap snd names) <> toList missing)
@ -1761,7 +1761,7 @@ loop = do
tm _ = pure mempty
in LD.fold tp tm ld
(missing, names0) <- eval . Eval $ Branch.findHistoricalRefs' dependencies root'
let types = R.toList $ Names3.types0 names0
let types = R.toList $ NamesWithHistory.types0 names0
let terms = fmap (second Referent.toReference) $ R.toList $ Names.terms names0
let names = types <> terms
numberedArgs .= fmap (Text.unpack . Reference.toText) ((fmap snd names) <> toList missing)
@ -1886,8 +1886,8 @@ resolveHQToLabeledDependencies = \case
HQ.NameOnly n -> do
parseNames <- basicParseNames0
let terms, types :: Set LabeledDependency
terms = Set.map LD.referent . Name.searchBySuffix n $ Names3.terms0 parseNames
types = Set.map LD.typeRef . Name.searchBySuffix n $ Names3.types0 parseNames
terms = Set.map LD.referent . Name.searchBySuffix n $ NamesWithHistory.terms0 parseNames
types = Set.map LD.typeRef . Name.searchBySuffix n $ NamesWithHistory.types0 parseNames
pure $ terms <> types
-- rationale: the hash should be unique enough that the name never helps
HQ.HashQualified _n sh -> resolveHashOnly sh
@ -2732,7 +2732,7 @@ loadDisplayInfo refs = do
-- then name foo.bar.baz becomes baz
-- name cat.dog becomes .cat.dog
fixupNamesRelative :: Path.Absolute -> Names0 -> Names0
fixupNamesRelative currentPath' = Names3.map0 fixName where
fixupNamesRelative currentPath' = NamesWithHistory.map0 fixName where
prefix = Path.toName (Path.unabsolute currentPath')
fixName n = if currentPath' == Path.absoluteEmpty then n else
fromMaybe (Name.makeAbsolute n) (Name.stripNamePrefix prefix n)
@ -2744,7 +2744,7 @@ makeHistoricalParsingNames lexedHQs = do
basicNames0 <- basicParseNames0
currentPath <- use currentPath
pure $ NamesWithHistory basicNames0
(Names3.makeAbsolute0 rawHistoricalNames <>
(NamesWithHistory.makeAbsolute0 rawHistoricalNames <>
fixupNamesRelative currentPath rawHistoricalNames)
loadTypeDisplayObject
@ -2784,12 +2784,12 @@ parseType input src = do
-- `show Input` is the name of the "file" being lexed
(names0, lexed) <- lexedSource (Text.pack $ show input) (Text.pack src)
parseNames <- basicParseNames0
let names = Names3.push (Names3.currentNames names0)
(Names3.NamesWithHistory parseNames (Names3.oldNames names0))
let names = NamesWithHistory.push (NamesWithHistory.currentNames names0)
(NamesWithHistory.NamesWithHistory parseNames (NamesWithHistory.oldNames names0))
e <- eval $ ParseType names lexed
pure $ case e of
Left err -> Left $ TypeParseError src err
Right typ -> case Type.bindNames mempty (Names3.currentNames names)
Right typ -> case Type.bindNames mempty (NamesWithHistory.currentNames names)
$ Type.generalizeLowercase mempty typ of
Left es -> Left $ ParseResolutionFailures src (toList es)
Right typ -> Right typ
@ -2797,7 +2797,7 @@ parseType input src = do
makeShadowedPrintNamesFromLabeled
:: Monad m => Set LabeledDependency -> Names0 -> Action' m v NamesWithHistory
makeShadowedPrintNamesFromLabeled deps shadowing =
Names3.shadowing shadowing <$> makePrintNamesFromLabeled' deps
NamesWithHistory.shadowing shadowing <$> makePrintNamesFromLabeled' deps
makePrintNamesFromLabeled'
:: Monad m => Set LabeledDependency -> Action' m v NamesWithHistory
@ -2857,7 +2857,7 @@ makeShadowedPrintNamesFromHQ lexedHQs shadowing = do
-- The basic names go into "current", but are shadowed by "shadowing".
-- They go again into "historical" as a hack that makes them available HQ-ed.
pure $
Names3.shadowing
NamesWithHistory.shadowing
shadowing
(NamesWithHistory basicNames0 (fixupNamesRelative currentPath rawHistoricalNames))

View File

@ -51,7 +51,7 @@ import Unison.Server.SearchResult' (SearchResult')
import Unison.Term (Term)
import Unison.Type (Type)
import qualified Unison.Names.ResolutionResult as Names
import qualified Unison.Names3 as Names
import qualified Unison.NamesWithHistory as Names
import qualified Data.Set as Set
import Unison.NameSegment (NameSegment)
import Unison.ShortHash (ShortHash)

View File

@ -26,7 +26,7 @@ import qualified Unison.HashQualified as HQ
import qualified Unison.Referent as Referent
import Unison.Referent (Referent)
import qualified Unison.Names2 as Names2
import Unison.Names3 (Names0)
import Unison.NamesWithHistory (Names0)
import Unison.DataDeclaration (DeclOrBuiltin)
import Unison.Runtime.IOSource (isPropagatedValue)

View File

@ -24,7 +24,7 @@ import qualified Unison.Codebase.Patch as Patch
import Unison.DataDeclaration ( Decl )
import qualified Unison.DataDeclaration as Decl
import qualified Unison.Name as Name
import Unison.Names3 ( Names0 )
import Unison.NamesWithHistory ( Names0 )
import qualified Unison.Names2 as Names
import Unison.Parser.Ann (Ann(..))
import Unison.Reference ( Reference(..) )

View File

@ -3,14 +3,14 @@ module Unison.Codebase.Editor.TodoOutput where
import Unison.Prelude
import qualified Unison.Names3 as Names
import qualified Unison.NamesWithHistory as Names
import qualified Unison.Type as Type
import qualified Unison.Util.Relation as R
import qualified Unison.Codebase.Patch as Patch
import qualified Data.Set as Set
import qualified Unison.DataDeclaration as DD
import Unison.Reference (Reference)
import Unison.Names3 (Names0)
import Unison.NamesWithHistory (Names0)
import Unison.Codebase.Patch (Patch)
import Unison.Codebase.Editor.DisplayObject (DisplayObject(UserObject))
import Unison.Type (Type)

View File

@ -20,7 +20,7 @@ import qualified Unison.Codebase.Runtime as Runtime
import Unison.Codebase.Runtime ( Runtime )
import Unison.Var ( Var )
import qualified Unison.PrettyPrintEnv as PPE
import qualified Unison.Names3 as Names3
import qualified Unison.NamesWithHistory as NamesWithHistory
import qualified Unison.Codebase.Branch as Branch
import qualified Unison.Codebase.Branch.Names as Branch
import System.Exit (die)
@ -42,7 +42,7 @@ execute codebase runtime mainName =
die ("Couldn't load root branch " ++ show h)
Left (Codebase.CouldntParseRootBranch h) ->
die ("Couldn't parse root branch head " ++ show h)
let parseNames0 = Names3.makeAbsolute0 (Branch.toNames0 (Branch.head root))
let parseNames0 = NamesWithHistory.makeAbsolute0 (Branch.toNames0 (Branch.head root))
loadTypeOfTerm = Codebase.getTypeOfTerm codebase
let mainType = Runtime.mainType runtime
mt <- getMainTerm loadTypeOfTerm parseNames0 mainName mainType

View File

@ -16,7 +16,7 @@ import qualified Unison.Builtin.Decls as DD
import qualified Unison.HashQualified as HQ
import qualified Unison.Referent as Referent
import Unison.Name ( Name )
import qualified Unison.Names3 as Names3
import qualified Unison.NamesWithHistory as NamesWithHistory
import Unison.Reference ( Reference )
import qualified Unison.Type as Type
import Unison.Type ( Type )
@ -32,7 +32,7 @@ data MainTerm v
getMainTerm
:: (Monad m, Var v)
=> (Reference -> m (Maybe (Type v Ann)))
-> Names3.Names0
-> NamesWithHistory.Names0
-> String
-> Type.Type v Ann
-> m (MainTerm v)
@ -40,7 +40,7 @@ getMainTerm loadTypeOfTerm parseNames0 mainName mainType =
case HQ.fromString mainName of
Nothing -> pure (NotAFunctionName mainName)
Just hq -> do
let refs = Names3.lookupHQTerm hq (Names3.NamesWithHistory parseNames0 mempty)
let refs = NamesWithHistory.lookupHQTerm hq (NamesWithHistory.NamesWithHistory parseNames0 mempty)
let a = Parser.Ann.External
case toList refs of
[Referent.Ref ref] -> do

View File

@ -73,7 +73,7 @@ import Unison.NamePrinter (prettyHashQualified,
styleHashQualified', prettyHashQualified')
import Unison.Names2 (Names'(..), Names0)
import qualified Unison.Names2 as Names
import qualified Unison.Names3 as Names
import qualified Unison.NamesWithHistory as Names
import Unison.Parser.Ann (Ann, startingLine)
import qualified Unison.PrettyPrintEnv as PPE
import qualified Unison.PrettyPrintEnv.Util as PPE

View File

@ -32,7 +32,7 @@ import qualified Unison.Util.List as List
import Unison.Var (Var)
import qualified Unison.Var as Var
import qualified Unison.WatchKind as UF
import qualified Unison.Names3 as Names
import qualified Unison.NamesWithHistory as Names
import qualified Unison.Names.ResolutionResult as Names
import qualified Unison.Name as Name

View File

@ -20,7 +20,7 @@ import Data.Text (unpack)
import qualified Unison.ABT as ABT
import qualified Unison.Blank as Blank
import qualified Unison.Name as Name
import qualified Unison.Names3 as Names
import qualified Unison.NamesWithHistory as Names
import Unison.Parser.Ann (Ann)
import qualified Unison.Parsers as Parsers
import qualified Unison.Referent as Referent
@ -38,7 +38,7 @@ import qualified Unison.Util.List as List
import qualified Unison.Util.Relation as Rel
import Unison.Var (Var)
import qualified Unison.Var as Var
import Unison.Names3 (Names0)
import Unison.NamesWithHistory (Names0)
type Term v = Term.Term v Ann
type Type v = Type.Type v Ann

View File

@ -47,7 +47,7 @@ import qualified Unison.Var as Var
import qualified Unison.UnisonFile.Error as UF
import Unison.Util.Bytes (Bytes)
import Unison.Name as Name
import Unison.Names3 (NamesWithHistory)
import Unison.NamesWithHistory (NamesWithHistory)
import qualified Unison.Names.ResolutionResult as Names
import Control.Monad.Reader.Class (asks)
import qualified Unison.Hashable as Hashable

View File

@ -5,7 +5,7 @@ import Unison.Prelude
import qualified Data.Text as Text
import Data.Text.IO ( readFile )
import Prelude hiding ( readFile )
import qualified Unison.Names3 as Names
import qualified Unison.NamesWithHistory as Names
import qualified Unison.Builtin as Builtin
import qualified Unison.FileParser as FileParser
import Unison.Parser.Ann (Ann)

View File

@ -7,8 +7,8 @@ import Unison.Prelude
import qualified Data.Set as Set
import qualified Unison.HashQualified as HQ
import qualified Unison.Name as Name
import Unison.Names3 (NamesWithHistory)
import qualified Unison.Names3 as Names
import Unison.NamesWithHistory (NamesWithHistory)
import qualified Unison.NamesWithHistory as Names
import Unison.PrettyPrintEnv (PrettyPrintEnv (PrettyPrintEnv))
import Unison.Util.List (safeHead)

View File

@ -2,7 +2,7 @@
module Unison.PrettyPrintEnvDecl.Names where
import Unison.Names3 (NamesWithHistory)
import Unison.NamesWithHistory (NamesWithHistory)
import Unison.PrettyPrintEnvDecl (PrettyPrintEnvDecl (PrettyPrintEnvDecl))
import Unison.PrettyPrintEnv.Names (fromNames, fromSuffixNames)

View File

@ -57,7 +57,7 @@ import Unison.HashQualified (HashQualified)
import Unison.Type (Type)
import Unison.NamePrinter (prettyHashQualified0)
import qualified Unison.PrettyPrintEnv.Names as PPE
import qualified Unison.Names3 as Names3
import qualified Unison.NamesWithHistory as NamesWithHistory
import Data.Set.NonEmpty (NESet)
import qualified Data.Set.NonEmpty as NES
@ -1474,9 +1474,9 @@ prettyResolutionFailures s allFailures =
(Names.TermResolutionFailure v _ Names.NotFound) -> (v, Nothing)
(Names.TypeResolutionFailure v _ Names.NotFound) -> (v, Nothing)
ppeFromNames0 :: Names3.Names0 -> PPE.PrettyPrintEnv
ppeFromNames0 :: NamesWithHistory.Names0 -> PPE.PrettyPrintEnv
ppeFromNames0 names0 =
PPE.fromNames PPE.todoHashLength (Names3.NamesWithHistory {currentNames = names0, oldNames = mempty})
PPE.fromNames PPE.todoHashLength (NamesWithHistory.NamesWithHistory {currentNames = names0, oldNames = mempty})
prettyRow :: (v, Maybe (NESet String)) -> [(Pretty ColorText, Pretty ColorText)]
prettyRow (v, mSet) = case mSet of

View File

@ -28,7 +28,7 @@ import qualified Unison.Term as Term
import qualified Unison.Typechecker.TypeLookup as TL
import qualified Unison.UnisonFile as UF
import qualified Unison.Var as Var
import qualified Unison.Names3 as Names
import qualified Unison.NamesWithHistory as Names
debug :: Bool
debug = False

View File

@ -55,11 +55,11 @@ import qualified Unison.NamePrinter as NP
import Unison.NameSegment (NameSegment(..))
import qualified Unison.NameSegment as NameSegment
import qualified Unison.Names2 as Names
import Unison.Names3
import Unison.NamesWithHistory
( NamesWithHistory (..),
Names0,
)
import qualified Unison.Names3 as Names3
import qualified Unison.NamesWithHistory as NamesWithHistory
import Unison.Parser.Ann (Ann)
import Unison.Prelude
import qualified Unison.PrettyPrintEnv as PPE
@ -129,14 +129,14 @@ basicNames0' root path = (parseNames00, prettyPrintNames00)
where
root0 = Branch.head root
currentBranch = fromMaybe Branch.empty $ Branch.getAt path root
absoluteRootNames0 = Names3.makeAbsolute0 (Branch.toNames0 root0)
absoluteRootNames0 = NamesWithHistory.makeAbsolute0 (Branch.toNames0 root0)
currentBranch0 = Branch.head currentBranch
currentPathNames0 = Branch.toNames0 currentBranch0
-- all names, but with local names in their relative form only, rather
-- than absolute; external names appear as absolute
currentAndExternalNames0 =
currentPathNames0
`Names3.unionLeft0` absDot externalNames
`NamesWithHistory.unionLeft0` absDot externalNames
where
absDot = Names.prefix0 (Name.unsafeFromText "")
externalNames = rootNames `Names.difference` pathPrefixed currentPathNames0
@ -460,7 +460,7 @@ getCurrentParseNames path root = NamesWithHistory (basicParseNames0 root path) m
-- then name foo.bar.baz becomes baz
-- name cat.dog becomes .cat.dog
fixupNamesRelative :: Path.Absolute -> Names0 -> Names0
fixupNamesRelative root = Names3.map0 fixName where
fixupNamesRelative root = NamesWithHistory.map0 fixName where
prefix = Path.toName $ Path.unabsolute root
fixName n = if root == Path.absoluteEmpty
then n
@ -480,8 +480,8 @@ data Search r = Search
makeTypeSearch :: Int -> NamesWithHistory -> Search Reference
makeTypeSearch len names =
Search
{ lookupNames = \ref -> Names3.typeName len ref names,
lookupRelativeHQRefs' = \name -> Names3.lookupRelativeHQType' name names,
{ lookupNames = \ref -> NamesWithHistory.typeName len ref names,
lookupRelativeHQRefs' = \name -> NamesWithHistory.lookupRelativeHQType' name names,
matchesNamedRef = HQ'.matchesNamedReference,
makeResult = SR.typeResult
}
@ -490,8 +490,8 @@ makeTypeSearch len names =
makeTermSearch :: Int -> NamesWithHistory -> Search Referent
makeTermSearch len names =
Search
{ lookupNames = \ref -> Names3.termName len ref names,
lookupRelativeHQRefs' = \name -> Names3.lookupRelativeHQTerm' name names,
{ lookupNames = \ref -> NamesWithHistory.termName len ref names,
lookupRelativeHQRefs' = \name -> NamesWithHistory.lookupRelativeHQTerm' name names,
matchesNamedRef = HQ'.matchesNamedReferent,
makeResult = SR.termResult
}
@ -687,7 +687,7 @@ prettyDefinitionsBySuffixes relativeTo root renderWidth suffixifyBindings rt cod
-- you get both its source and its rendered form
docResults :: [Reference] -> [Name] -> Backend IO [(HashQualifiedName, UnisonHash, Doc.Doc)]
docResults rs0 docs = do
let refsFor n = Names3.lookupHQTerm (HQ.NameOnly n) parseNames
let refsFor n = NamesWithHistory.lookupHQTerm (HQ.NameOnly n) parseNames
let rs = Set.unions (refsFor <$> docs) <> Set.fromList (Referent.Ref <$> rs0)
-- lookup the type of each, make sure it's a doc
docs <- selectDocs (toList rs)
@ -701,7 +701,7 @@ prettyDefinitionsBySuffixes relativeTo root renderWidth suffixifyBindings rt cod
(Branch.head branch)
(Referent.Ref r)
(HQ'.NameOnly (NameSegment bn))
docs <- docResults [r] $ docNames (Names3.termName hqLength (Referent.Ref r) printNames)
docs <- docResults [r] $ docNames (NamesWithHistory.termName hqLength (Referent.Ref r) printNames)
mk docs ts bn tag
where
mk _ Nothing _ _ = throwError $ MissingSignatureForTerm r
@ -719,7 +719,7 @@ prettyDefinitionsBySuffixes relativeTo root renderWidth suffixifyBindings rt cod
codebase
r
(HQ'.NameOnly (NameSegment bn))
docs <- docResults [] $ docNames (Names3.typeName hqLength r printNames)
docs <- docResults [] $ docNames (NamesWithHistory.typeName hqLength r printNames)
pure $ TypeDefinition (flatten $ Map.lookup r typeFqns)
bn
tag

View File

@ -14,7 +14,7 @@ import Control.Monad.Reader (asks, local)
import Data.Foldable (foldrM)
import Prelude hiding (and, or, seq)
import Unison.Name (Name)
import Unison.Names3 (NamesWithHistory)
import Unison.NamesWithHistory (NamesWithHistory)
import Unison.Reference (Reference)
import Unison.Referent (Referent)
import Unison.Parser hiding (seq)
@ -38,7 +38,7 @@ import qualified Unison.ConstructorType as CT
import qualified Unison.HashQualified as HQ
import qualified Unison.Lexer as L
import qualified Unison.Name as Name
import qualified Unison.Names3 as Names
import qualified Unison.NamesWithHistory as Names
import qualified Unison.Parser as Parser (seq, uniqueName)
import Unison.Parser.Ann (Ann)
import qualified Unison.Pattern as Pattern

View File

@ -14,7 +14,7 @@ import Unison.Var (Var)
import qualified Unison.Builtin.Decls as DD
import qualified Unison.HashQualified as HQ
import qualified Unison.Name as Name
import qualified Unison.Names3 as Names
import qualified Unison.NamesWithHistory as Names
import qualified Data.Set as Set
import Control.Monad.Reader (asks)

View File

@ -12,7 +12,7 @@ import Unison.DataDeclaration (DataDeclaration)
import Unison.DataDeclaration (EffectDeclaration(..))
import Unison.Reference (Reference)
import qualified Unison.Reference as Reference
import Unison.Names3 (Names0)
import Unison.NamesWithHistory (Names0)
data Env v a = Env
-- Data declaration name to hash and its fully resolved form

View File

@ -15,8 +15,8 @@ import qualified Unison.DataDeclaration.Names as DD.Names
import qualified Unison.Hashing.V2.Convert as Hashing
import qualified Unison.Name as Name
import qualified Unison.Names.ResolutionResult as Names
import Unison.Names3 (Names0)
import qualified Unison.Names3 as Names
import Unison.NamesWithHistory (Names0)
import qualified Unison.NamesWithHistory as Names
import Unison.Prelude
import qualified Unison.Reference as Reference
import qualified Unison.Referent as Referent

View File

@ -27,7 +27,7 @@ import qualified Unison.Type as Type
import qualified Unison.TypeParser as TypeParser
import qualified Unison.Util.Pretty as Pr
import qualified Text.Megaparsec.Error as MPE
import qualified Unison.Names3
import qualified Unison.NamesWithHistory
type Term v = Term.Term v Ann
@ -63,7 +63,7 @@ parseAndSynthesizeAsFile
-> String
-> Result
(Seq (Note v Ann))
(Either Unison.Names3.Names0 (TypecheckedUnisonFile v Ann))
(Either Unison.NamesWithHistory.Names0 (TypecheckedUnisonFile v Ann))
parseAndSynthesizeAsFile ambient filename s = FP.parseAndSynthesizeFile
ambient
(\_deps -> pure B.typeLookup)

View File

@ -32,14 +32,14 @@ import qualified Unison.UnisonFile as UF
import Unison.Util.Monoid (intercalateMap)
import Unison.Util.Pretty (toPlain)
import qualified Unison.Test.Common as Common
import qualified Unison.Names3
import qualified Unison.NamesWithHistory
type Note = Result.Note Symbol Ann
type TFile = UF.TypecheckedUnisonFile Symbol Ann
type SynthResult =
Result (Seq Note)
(Either Unison.Names3.Names0 TFile)
(Either Unison.NamesWithHistory.Names0 TFile)
type EitherResult = Either String TFile
@ -101,7 +101,7 @@ decodeResult source (Result notes (Just (Left errNames))) =
Left $ showNotes
source
(PPE.fromNames Common.hqLength
(Unison.Names3.shadowing errNames Builtin.names))
(Unison.NamesWithHistory.shadowing errNames Builtin.names))
notes
decodeResult _source (Result _notes (Just (Right uf))) =
Right uf

View File

@ -21,8 +21,8 @@ import qualified Unison.Reference as Reference
import qualified Unison.Referent as Referent
import qualified Unison.Type.Names as Type.Names
import Unison.Var ( Var )
import Unison.Names3 (Names0)
import qualified Unison.Names3 as Names
import Unison.NamesWithHistory (Names0)
import qualified Unison.NamesWithHistory as Names
import qualified Unison.Names.ResolutionResult as Names
import qualified Unison.ConstructorType as CT

View File

@ -7,7 +7,7 @@ module Unison.Names.ResolutionResult where
import Unison.Prelude
import Unison.Reference as Reference ( Reference )
import Unison.Referent as Referent ( Referent )
import Unison.Names3 (Names0)
import Unison.NamesWithHistory (Names0)
import Data.Set.NonEmpty
data ResolutionError ref

View File

@ -24,8 +24,8 @@ import Prelude.Extras (Eq1(..), Show1(..))
import Text.Show
import qualified Unison.ABT as ABT
import qualified Unison.Blank as B
import Unison.Names3 ( Names0 )
import qualified Unison.Names3 as Names
import Unison.NamesWithHistory ( Names0 )
import qualified Unison.NamesWithHistory as Names
import qualified Unison.Names.ResolutionResult as Names
import Unison.Pattern (Pattern)
import qualified Unison.Pattern as Pattern

View File

@ -13,7 +13,7 @@ import Unison.Type
import qualified Data.Set as Set
import qualified Unison.ABT as ABT
import Unison.Var (Var)
import qualified Unison.Names3 as Names
import qualified Unison.NamesWithHistory as Names
import qualified Unison.Names.ResolutionResult as Names
import qualified Unison.Name as Name
import qualified Unison.Util.List as List