mirror of
https://github.com/unisonweb/unison.git
synced 2024-09-11 02:25:39 +03:00
Ensure Name
s are absolute after prefixing
In a separate part of the change this PR was extracted from, `Path.prefixName` ensures the result is absolute, but that is more involved than other changes here, so this uses the previous technique of calling `Name.makeAbsolute` afterward. I don’t think this changes anything important, but the `Name` _is_ always absolute after `Path.prefixName`, so this just ensures that it’s tracked.
This commit is contained in:
parent
4c12fe8a47
commit
cf6ab11088
@ -405,7 +405,7 @@ handleHashQualifiedNameArg =
|
||||
SA.HashQualifiedWithBranchPrefix mprefix hqname ->
|
||||
pure . HQ'.toHQ $ foldr (\prefix -> fmap $ Name.makeAbsolute . Path.prefixName prefix) hqname mprefix
|
||||
SA.ShallowListEntry prefix entry ->
|
||||
pure . HQ'.toHQ . fmap (Path.prefixName prefix) $ shallowListEntryToHQ' entry
|
||||
pure . HQ'.toHQ . fmap (Name.makeAbsolute . Path.prefixName prefix) $ shallowListEntryToHQ' entry
|
||||
SA.SearchResult mpath result -> pure $ searchResultToHQ mpath result
|
||||
otherArgType -> Left $ wrongStructuredArgument "a hash-qualified name" otherArgType
|
||||
|
||||
@ -580,7 +580,7 @@ handleHashQualifiedSplit'Arg =
|
||||
SA.HashQualifiedWithBranchPrefix (Right prefix) hqname ->
|
||||
pure . hq'NameToSplit' $ Name.makeAbsolute . Path.prefixName prefix <$> hqname
|
||||
SA.ShallowListEntry prefix entry ->
|
||||
pure . hq'NameToSplit' . fmap (Path.prefixName prefix) $ shallowListEntryToHQ' entry
|
||||
pure . hq'NameToSplit' . fmap (Name.makeAbsolute . Path.prefixName prefix) $ shallowListEntryToHQ' entry
|
||||
sr@(SA.SearchResult mpath result) ->
|
||||
first (const $ expectedButActually "a name" sr "a hash") . hqNameToSplit' $ searchResultToHQ mpath result
|
||||
otherNumArg -> Left $ wrongStructuredArgument "a name" otherNumArg
|
||||
@ -626,7 +626,7 @@ handleShortHashOrHQSplit'Arg =
|
||||
SA.HashQualifiedWithBranchPrefix (Right prefix) hqname ->
|
||||
pure . pure $ hq'NameToSplit' (Name.makeAbsolute . Path.prefixName prefix <$> hqname)
|
||||
SA.ShallowListEntry prefix entry ->
|
||||
pure . pure . hq'NameToSplit' . fmap (Path.prefixName prefix) $ shallowListEntryToHQ' entry
|
||||
pure . pure . hq'NameToSplit' . fmap (Name.makeAbsolute . Path.prefixName prefix) $ shallowListEntryToHQ' entry
|
||||
SA.SearchResult mpath result -> pure . hqNameToSplit' $ searchResultToHQ mpath result
|
||||
otherNumArg -> Left $ wrongStructuredArgument "a hash or name" otherNumArg
|
||||
|
||||
@ -651,7 +651,7 @@ handleNameArg =
|
||||
SA.HashQualifiedWithBranchPrefix (Right prefix) hqname ->
|
||||
pure . Name.makeAbsolute . Path.prefixName prefix $ HQ'.toName hqname
|
||||
SA.ShallowListEntry prefix entry ->
|
||||
pure . HQ'.toName . fmap (Path.prefixName prefix) $ shallowListEntryToHQ' entry
|
||||
pure . HQ'.toName . fmap (Name.makeAbsolute . Path.prefixName prefix) $ shallowListEntryToHQ' entry
|
||||
SA.SearchResult mpath result ->
|
||||
maybe (Left "can’t find a name from the numbered arg") pure . HQ.toName $ searchResultToHQ mpath result
|
||||
otherNumArg -> Left $ wrongStructuredArgument "a name" otherNumArg
|
||||
|
@ -39,8 +39,8 @@ foo.subtract x y = x Int.- y
|
||||
|
||||
.> view 1
|
||||
|
||||
foo.add : Int -> Int -> Int
|
||||
foo.add x y =
|
||||
.foo.add : Int -> Int -> Int
|
||||
.foo.add x y =
|
||||
use Int +
|
||||
x + y
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user