mirror of
https://github.com/unisonweb/unison.git
synced 2024-08-16 05:50:35 +03:00
[create-pull-request] automated change
This commit is contained in:
parent
70b937bc76
commit
f88d652383
@ -8,11 +8,11 @@ import Unison.Codebase.Path (Path)
|
||||
import Unison.Codebase.Path qualified as Path
|
||||
import Unison.Codebase.ShortCausalHash (ShortCausalHash)
|
||||
import Unison.Codebase.ShortCausalHash qualified as SCH
|
||||
import Unison.NameSegment qualified as NameSegment
|
||||
import Unison.Prelude
|
||||
import Unison.Project (ProjectAndBranch (..), ProjectBranchName, ProjectName)
|
||||
import Unison.Share.Types
|
||||
import Unison.Util.Monoid qualified as Monoid
|
||||
import qualified Unison.NameSegment as NameSegment
|
||||
|
||||
data ReadRepo
|
||||
= ReadRepoGit ReadGitRepo
|
||||
|
@ -35,7 +35,7 @@ import Control.Monad.Catch (MonadCatch)
|
||||
import Control.Monad.Primitive qualified as PA
|
||||
import Control.Monad.Reader (ReaderT (..), ask, runReaderT)
|
||||
import Control.Monad.State.Strict (State, execState, modify)
|
||||
import Crypto.Error (CryptoError(..), CryptoFailable(..))
|
||||
import Crypto.Error (CryptoError (..), CryptoFailable (..))
|
||||
import Crypto.Hash qualified as Hash
|
||||
import Crypto.MAC.HMAC qualified as HMAC
|
||||
import Crypto.PubKey.Ed25519 qualified as Ed25519
|
||||
@ -2823,10 +2823,12 @@ declareForeigns = do
|
||||
in pure . Bytes.fromArray . hmac alg $ serializeValueLazy x
|
||||
|
||||
declareForeign Untracked "crypto.Ed25519.sign.impl" boxBoxBoxToEFBox
|
||||
. mkForeign $ pure . signEd25519Wrapper
|
||||
. mkForeign
|
||||
$ pure . signEd25519Wrapper
|
||||
|
||||
declareForeign Untracked "crypto.Ed25519.verify.impl" boxBoxBoxToEFBool
|
||||
. mkForeign $ pure . verifyEd25519Wrapper
|
||||
. mkForeign
|
||||
$ pure . verifyEd25519Wrapper
|
||||
|
||||
let catchAll :: (MonadCatch m, MonadIO m, NFData a) => m a -> m (Either Util.Text.Text a)
|
||||
catchAll e = do
|
||||
@ -3426,15 +3428,16 @@ hostPreference (Just host) = SYS.Host $ Util.Text.unpack host
|
||||
signEd25519Wrapper ::
|
||||
(Bytes.Bytes, Bytes.Bytes, Bytes.Bytes) -> Either Failure Bytes.Bytes
|
||||
signEd25519Wrapper (secret0, public0, msg0) = case validated of
|
||||
CryptoFailed err ->
|
||||
Left (Failure Ty.cryptoFailureRef (errMsg err) unitValue)
|
||||
CryptoPassed (secret, public) ->
|
||||
Right . Bytes.fromArray $ Ed25519.sign secret public msg
|
||||
CryptoFailed err ->
|
||||
Left (Failure Ty.cryptoFailureRef (errMsg err) unitValue)
|
||||
CryptoPassed (secret, public) ->
|
||||
Right . Bytes.fromArray $ Ed25519.sign secret public msg
|
||||
where
|
||||
msg = Bytes.toArray msg0 :: ByteString
|
||||
validated =
|
||||
(,) <$> Ed25519.secretKey (Bytes.toArray secret0 :: ByteString)
|
||||
<*> Ed25519.publicKey (Bytes.toArray public0 :: ByteString)
|
||||
(,)
|
||||
<$> Ed25519.secretKey (Bytes.toArray secret0 :: ByteString)
|
||||
<*> Ed25519.publicKey (Bytes.toArray public0 :: ByteString)
|
||||
|
||||
errMsg CryptoError_PublicKeySizeInvalid =
|
||||
"ed25519: Public key size invalid"
|
||||
@ -3447,15 +3450,16 @@ signEd25519Wrapper (secret0, public0, msg0) = case validated of
|
||||
verifyEd25519Wrapper ::
|
||||
(Bytes.Bytes, Bytes.Bytes, Bytes.Bytes) -> Either Failure Bool
|
||||
verifyEd25519Wrapper (public0, msg0, sig0) = case validated of
|
||||
CryptoFailed err ->
|
||||
Left $ Failure Ty.cryptoFailureRef (errMsg err) unitValue
|
||||
CryptoPassed (public, sig) ->
|
||||
Right $ Ed25519.verify public msg sig
|
||||
CryptoFailed err ->
|
||||
Left $ Failure Ty.cryptoFailureRef (errMsg err) unitValue
|
||||
CryptoPassed (public, sig) ->
|
||||
Right $ Ed25519.verify public msg sig
|
||||
where
|
||||
msg = Bytes.toArray msg0 :: ByteString
|
||||
validated =
|
||||
(,) <$> Ed25519.publicKey (Bytes.toArray public0 :: ByteString)
|
||||
<*> Ed25519.signature (Bytes.toArray sig0 :: ByteString)
|
||||
(,)
|
||||
<$> Ed25519.publicKey (Bytes.toArray public0 :: ByteString)
|
||||
<*> Ed25519.signature (Bytes.toArray sig0 :: ByteString)
|
||||
|
||||
errMsg CryptoError_PublicKeySizeInvalid =
|
||||
"ed25519: Public key size invalid"
|
||||
|
@ -1,6 +1,7 @@
|
||||
module Unison.Syntax.FileParser
|
||||
( file
|
||||
) where
|
||||
( file,
|
||||
)
|
||||
where
|
||||
|
||||
import Control.Lens
|
||||
import Control.Monad.Reader (asks, local)
|
||||
|
@ -1,10 +1,11 @@
|
||||
{-# LANGUAGE OverloadedStrings #-}
|
||||
|
||||
module Unison.Syntax.TypeParser
|
||||
( computationType
|
||||
, valueType
|
||||
, valueTypeLeaf
|
||||
) where
|
||||
( computationType,
|
||||
valueType,
|
||||
valueTypeLeaf,
|
||||
)
|
||||
where
|
||||
|
||||
import Control.Monad.Reader (asks)
|
||||
import Data.Set qualified as Set
|
||||
|
@ -61,14 +61,15 @@ import Unison.Sqlite qualified as Sqlite
|
||||
import Witch (unsafeFrom)
|
||||
|
||||
branchRelativePathToAbsolute :: BranchRelativePath -> Cli Path.Absolute
|
||||
branchRelativePathToAbsolute brp = resolveBranchRelativePath brp <&> \case
|
||||
BranchRelativePath.ResolvedLoosePath p -> p
|
||||
BranchRelativePath.ResolvedBranchRelative projectBranch mRel ->
|
||||
let projectBranchIds = getIds projectBranch
|
||||
handleRel = case mRel of
|
||||
Nothing -> id
|
||||
Just rel -> flip Path.resolve rel
|
||||
in handleRel (projectBranchPath projectBranchIds)
|
||||
branchRelativePathToAbsolute brp =
|
||||
resolveBranchRelativePath brp <&> \case
|
||||
BranchRelativePath.ResolvedLoosePath p -> p
|
||||
BranchRelativePath.ResolvedBranchRelative projectBranch mRel ->
|
||||
let projectBranchIds = getIds projectBranch
|
||||
handleRel = case mRel of
|
||||
Nothing -> id
|
||||
Just rel -> flip Path.resolve rel
|
||||
in handleRel (projectBranchPath projectBranchIds)
|
||||
where
|
||||
getIds = \case
|
||||
ProjectAndBranch project branch -> ProjectAndBranch (view #projectId project) (view #branchId branch)
|
||||
@ -91,7 +92,6 @@ resolveBranchRelativePath = \case
|
||||
toThese = \case
|
||||
Left branchName -> That branchName
|
||||
Right (projectName, branchName) -> These projectName branchName
|
||||
|
||||
|
||||
-- | Get the current project that a user is on.
|
||||
getCurrentProject :: Cli (Maybe Sqlite.Project)
|
||||
|
@ -2757,7 +2757,7 @@ renderEditConflicts ppe Patch {..} = do
|
||||
then "deprecated and also replaced with"
|
||||
else "replaced with"
|
||||
)
|
||||
`P.hang` P.lines replacements
|
||||
`P.hang` P.lines replacements
|
||||
formatTermEdits ::
|
||||
(Reference.TermReference, Set TermEdit.TermEdit) ->
|
||||
Numbered Pretty
|
||||
@ -2772,7 +2772,7 @@ renderEditConflicts ppe Patch {..} = do
|
||||
then "deprecated and also replaced with"
|
||||
else "replaced with"
|
||||
)
|
||||
`P.hang` P.lines replacements
|
||||
`P.hang` P.lines replacements
|
||||
formatConflict ::
|
||||
Either
|
||||
(Reference, Set TypeEdit.TypeEdit)
|
||||
|
@ -43,7 +43,7 @@ import Unison.Referent qualified as Referent
|
||||
import Unison.Runtime.IOSource qualified as IOSource
|
||||
import Unison.Syntax.DeclPrinter qualified as DeclPrinter
|
||||
import Unison.Syntax.HashQualified' qualified as HQ' (toText)
|
||||
import Unison.Syntax.Name qualified as Name (parseText, nameP, toText)
|
||||
import Unison.Syntax.Name qualified as Name (nameP, parseText, toText)
|
||||
import Unison.Syntax.TypePrinter qualified as TypePrinter
|
||||
import Unison.Util.Monoid qualified as Monoid
|
||||
import Unison.Util.Pretty qualified as Pretty
|
||||
|
@ -1,4 +1,5 @@
|
||||
{-# LANGUAGE OverloadedStrings, RecordWildCards #-}
|
||||
{-# LANGUAGE OverloadedStrings #-}
|
||||
{-# LANGUAGE RecordWildCards #-}
|
||||
|
||||
{- This module kicks off the Transcript Tests.
|
||||
It doesn't do the transcript parsing itself.
|
||||
@ -16,8 +17,8 @@ import System.FilePath
|
||||
splitFileName,
|
||||
takeDirectory,
|
||||
takeExtensions,
|
||||
(</>),
|
||||
(<.>),
|
||||
(</>),
|
||||
)
|
||||
import System.IO.CodePage (withCP65001)
|
||||
import System.IO.Silently (silence)
|
||||
@ -82,7 +83,7 @@ outputFileForTranscript filePath =
|
||||
replaceExtension filePath ".output.md"
|
||||
|
||||
buildTests :: TestConfig -> TestBuilder -> FilePath -> Test ()
|
||||
buildTests TestConfig{ .. } testBuilder dir = do
|
||||
buildTests TestConfig {..} testBuilder dir = do
|
||||
io
|
||||
. putStrLn
|
||||
. unlines
|
||||
@ -149,9 +150,9 @@ test config = do
|
||||
cleanup
|
||||
|
||||
handleArgs :: TestConfig -> [String] -> TestConfig
|
||||
handleArgs acc ("--runtime-path":p:rest) =
|
||||
handleArgs (acc { runtimePath = p }) rest
|
||||
handleArgs acc [prefix] = acc { matchPrefix = Just prefix }
|
||||
handleArgs acc ("--runtime-path" : p : rest) =
|
||||
handleArgs (acc {runtimePath = p}) rest
|
||||
handleArgs acc [prefix] = acc {matchPrefix = Just prefix}
|
||||
handleArgs acc _ = acc
|
||||
|
||||
defaultConfig :: IO TestConfig
|
||||
|
@ -42,9 +42,9 @@ import Network.HTTP.Client.TLS qualified as HTTP
|
||||
import Stats (recordRtsStats)
|
||||
import System.Directory
|
||||
( canonicalizePath,
|
||||
exeExtension,
|
||||
getCurrentDirectory,
|
||||
removeDirectoryRecursive,
|
||||
exeExtension
|
||||
)
|
||||
import System.Environment (getExecutablePath, getProgName, withArgs)
|
||||
import System.Exit qualified as Exit
|
||||
@ -52,8 +52,8 @@ import System.FilePath
|
||||
( replaceExtension,
|
||||
takeDirectory,
|
||||
takeExtension,
|
||||
(</>),
|
||||
(<.>),
|
||||
(</>),
|
||||
)
|
||||
import System.IO (stderr)
|
||||
import System.IO.CodePage (withCP65001)
|
||||
|
@ -5,4 +5,3 @@ module Unison.Kind where
|
||||
import Unison.Prelude
|
||||
|
||||
data Kind = Star | Arrow Kind Kind deriving (Eq, Ord, Read, Show, Generic)
|
||||
|
||||
|
@ -6,7 +6,7 @@ import Unison.Name qualified as Name
|
||||
import Unison.Name.Internal (Name)
|
||||
import Unison.NameSegment (NameSegment)
|
||||
|
||||
newtype ForwardName = ForwardName { toList :: NonEmpty NameSegment } deriving (Eq, Ord, Show)
|
||||
newtype ForwardName = ForwardName {toList :: NonEmpty NameSegment} deriving (Eq, Ord, Show)
|
||||
|
||||
-- | O(d)
|
||||
fromName :: Name -> ForwardName
|
||||
|
@ -42,8 +42,8 @@ import Unison.Server.Types
|
||||
mayDefaultWidth,
|
||||
)
|
||||
import Unison.Symbol (Symbol)
|
||||
import Unison.Syntax.Name qualified as Name
|
||||
import Unison.Util.Pretty (Width)
|
||||
import qualified Unison.Syntax.Name as Name
|
||||
|
||||
type FuzzyFindAPI =
|
||||
"find"
|
||||
|
@ -1,11 +1,12 @@
|
||||
module Unison.Server.NameSearch
|
||||
( Search(..)
|
||||
, NameSearch(..)
|
||||
, hoistSearch
|
||||
, hoistNameSearch
|
||||
, applySearch
|
||||
, SearchType(..)
|
||||
) where
|
||||
( Search (..),
|
||||
NameSearch (..),
|
||||
hoistSearch,
|
||||
hoistNameSearch,
|
||||
applySearch,
|
||||
SearchType (..),
|
||||
)
|
||||
where
|
||||
|
||||
import Control.Lens
|
||||
import Data.List qualified as List
|
||||
@ -13,7 +14,7 @@ import Data.Set qualified as Set
|
||||
import Unison.HashQualified qualified as HQ
|
||||
import Unison.HashQualified' qualified as HQ'
|
||||
import Unison.Name (Name)
|
||||
import Unison.NamesWithHistory (SearchType(..))
|
||||
import Unison.NamesWithHistory (SearchType (..))
|
||||
import Unison.Prelude
|
||||
import Unison.Reference (Reference)
|
||||
import Unison.Referent (Referent)
|
||||
|
@ -747,9 +747,9 @@ instance FromJSON HashMismatchForEntity where
|
||||
Aeson.withObject "HashMismatchForEntity" \obj ->
|
||||
HashMismatchForEntity
|
||||
<$> obj
|
||||
.: "supplied"
|
||||
.: "supplied"
|
||||
<*> obj
|
||||
.: "computed"
|
||||
.: "computed"
|
||||
|
||||
------------------------------------------------------------------------------------------------------------------------
|
||||
-- Fast-forward path
|
||||
|
Loading…
Reference in New Issue
Block a user