Merge remote-tracking branch 'origin/trunk' into cp/project-ui-command

This commit is contained in:
Chris Penner 2023-08-09 10:06:46 -07:00
commit d81aa9ae15
8 changed files with 50 additions and 24 deletions

View File

@ -11,10 +11,6 @@ on:
description: 'Release Version (E.g. M4 or M4a)'
required: true
type: string
share_base_path:
description: 'Path to base version that UCM should pull by default (E.g. `unison.public.base.releases.M4`)'
required: true
type: string
target:
description: 'Ref to use for this release, defaults to trunk'
required: true
@ -61,8 +57,6 @@ jobs:
name: "build_linux"
runs-on: ubuntu-20.04
env:
UNISON_BASE_PATH: "${{inputs.share_base_path}}"
steps:
- uses: actions/checkout@v2
with:
@ -109,7 +103,7 @@ jobs:
- name: build
run: |
# unison-cli checks env vars for which base version to automatically pull,
# unison-cli embeds version numbers using TH
# so it needs to be forced to rebuild to ensure those are updated.
stack clean unison-cli
stack --no-terminal build --flag unison-parser-typechecker:optimized
@ -133,8 +127,6 @@ jobs:
build_macos:
name: "build_macos"
runs-on: macos-12
env:
UNISON_BASE_PATH: "${{inputs.share_base_path}}"
steps:
- uses: actions/checkout@v2
with:
@ -184,7 +176,7 @@ jobs:
- name: build
run: |
# unison-cli checks env vars for which base version to automatically pull,
# unison-cli embeds version numbers using TH
# so it needs to be forced to rebuild to ensure those are updated.
stack clean unison-cli
stack --no-terminal build --flag unison-parser-typechecker:optimized
@ -208,9 +200,6 @@ jobs:
build_windows:
name: "build_windows"
runs-on: windows-2019
env:
UNISON_BASE_PATH: "${{inputs.share_base_path}}"
steps:
- uses: actions/checkout@v2
with:
@ -257,7 +246,7 @@ jobs:
- name: build
run: |
# unison-cli checks env vars for which base version to automatically pull,
# unison-cli embeds version numbers using TH
# so it needs to be forced to rebuild to ensure those are updated.
stack clean unison-cli

View File

@ -76,3 +76,4 @@ The format for this list: name, GitHub handle
* Mario Bašić (@mabasic)
* Chris Krycho (@chriskrycho)
* Hatim Khambati (@hatimkhambati26)
* Kyle Goetz (@kylegoetz)

View File

@ -985,7 +985,7 @@ infixAppOrBooleanOp = chainl1 term4 (or <|> and <|> infixApp)
typedecl :: (Monad m, Var v) => P v m (L.Token v, Type v Ann)
typedecl =
(,)
<$> P.try (prefixDefinitionName <* reserved ":")
<$> P.try (prefixTermName <* reserved ":")
<*> TypeParser.valueType
<* semi
@ -1053,8 +1053,8 @@ binding = label "binding" do
arg2 <- prefixDefinitionName
pure (ann arg1, op, [arg1, arg2])
let prefixLhs = do
v <- prefixDefinitionName
vs <- many prefixDefinitionName
v <- prefixTermName
vs <- many prefixTermName
pure (ann v, v, vs)
let lhs :: P v m (Ann, L.Token v, [L.Token v])
lhs = infixLhs <|> prefixLhs

View File

@ -9,16 +9,15 @@ fi
usage() {
echo "NOTE: must be run from the root of the project."
echo "Usage: $0 VERSION SHARE_BASE_PATH [TARGET]"
echo "Usage: $0 VERSION [TARGET]"
echo "VERSION: The version you're releasing, e.g. M4a"
echo "SHARE_BASE_PATH: Which base version to pull from share, e.g. 'unison.public.base.releases.M4'"
echo "TARGET: The revision to make the release from, defaults to 'trunk'"
echo ""
echo "E.g."
echo "$0 M4a"
}
if [[ -z "$1" || -z "$2" ]] ; then
if [[ -z "$1" ]] ; then
usage
exit 1
fi
@ -36,8 +35,7 @@ fi
version="${1}"
prev_version=$(./scripts/previous-tag.sh "$version")
share_base_path=${2}
target=${3:-trunk}
target=${2:-trunk}
tag="release/${version}"
echo "Creating release in unison-local-ui..."
@ -46,7 +44,7 @@ gh release create "release/${version}" --repo unisonweb/unison-local-ui --target
echo "Kicking off release workflow in unisonweb/unison"
git tag "${tag}" "${target}"
git push origin "${tag}"
gh workflow run release --repo unisonweb/unison --field "version=${version}" --field "share_base_path=${share_base_path}"
gh workflow run release --repo unisonweb/unison --field "version=${version}"
echo "Kicking off Homebrew update task"
gh workflow run release --repo unisonweb/homebrew-unison --field "version=${version}"

View File

@ -6,6 +6,7 @@ module Unison.CommandLine.InputPatterns where
import Control.Lens (preview, (^.))
import Control.Lens.Cons qualified as Cons
import Data.List (intercalate)
import Data.List.Extra qualified as List
import Data.List.NonEmpty qualified as NE
import Data.Map qualified as Map
import Data.Maybe (fromJust)
@ -452,7 +453,7 @@ ui =
{ patternName = "ui",
aliases = [],
visibility = I.Visible,
argTypes = [],
argTypes = [(Optional, namespaceOrDefinitionArg)],
help = P.wrap "`ui` opens the Local UI in the default browser.",
parse = \case
[] -> pure $ Input.UiI Path.relativeEmpty'
@ -2963,6 +2964,17 @@ namespaceArg =
globTargets = Set.fromList [Globbing.Namespace]
}
namespaceOrDefinitionArg :: ArgumentType
namespaceOrDefinitionArg =
ArgumentType
{ typeName = "term, type, or namespace",
suggestions = \q cb _http p -> Codebase.runTransaction cb do
namespaces <- prefixCompleteNamespace q p
termsTypes <- prefixCompleteTermOrType q p
pure (List.nubOrd $ namespaces <> termsTypes),
globTargets = Set.fromList [Globbing.Namespace, Globbing.Term, Globbing.Type]
}
-- | Names of child branches of the branch, only gives options for one 'layer' deeper at a time.
childNamespaceNames :: Branch.Branch0 m -> [Text]
childNamespaceNames b = NameSegment.toText <$> Map.keys (Branch.nonEmptyChildren b)

View File

@ -0,0 +1,8 @@
# No Hashes in Term Declarations
There should not be hashes in the names used in term declarations, either in the type signature or the type definition.
```unison:hide:all:error
x##Nat : Int -> Int -> Boolean
x##Nat = 5
```

View File

@ -0,0 +1,4 @@
# No Hashes in Term Declarations
There should not be hashes in the names used in term declarations, either in the type signature or the type definition.

View File

@ -31,6 +31,7 @@ module Unison.Syntax.Parser
peekAny,
positionalVar,
prefixDefinitionName,
prefixTermName,
queryToken,
reserved,
root,
@ -297,6 +298,19 @@ prefixDefinitionName :: (Var v) => P v m (L.Token v)
prefixDefinitionName =
wordyDefinitionName <|> parenthesize symbolyDefinitionName
-- Parse a prefix identifier e.g. Foo or (+), rejecting any hash
-- This is useful for term declarations, where type signatures and term names should not have hashes.
prefixTermName :: (Var v) => P v m (L.Token v)
prefixTermName = wordyTermName <|> parenthesize symbolyTermName
where
wordyTermName = queryToken $ \case
L.WordyId s Nothing -> Just $ Var.nameds s
L.Blank s -> Just $ Var.nameds ("_" <> s)
_ -> Nothing
symbolyTermName = queryToken $ \case
L.SymbolyId s Nothing -> Just $ Var.nameds s
_ -> Nothing
-- Parse a wordy identifier e.g. Foo, discarding any hash
wordyDefinitionName :: (Var v) => P v m (L.Token v)
wordyDefinitionName = queryToken $ \case