mirror of
https://github.com/unisonweb/unison.git
synced 2024-10-26 11:07:48 +03:00
slightly better error messages
This commit is contained in:
parent
75e0e3c8d3
commit
06b743a149
@ -290,10 +290,10 @@ doMerge info = do
|
||||
Cli.returnEarly case err of
|
||||
IncoherentDeclReason'ConstructorAlias name1 name2 ->
|
||||
Output.MergeConstructorAlias maybeBranchName name1 name2
|
||||
IncoherentDeclReason'MissingConstructorName name -> Output.MergeMissingConstructorName name
|
||||
IncoherentDeclReason'MissingConstructorName name -> Output.MergeMissingConstructorName maybeBranchName name
|
||||
IncoherentDeclReason'NestedDeclAlias shorterName longerName ->
|
||||
Output.MergeNestedDeclAlias shorterName longerName
|
||||
IncoherentDeclReason'StrayConstructor name -> Output.MergeStrayConstructor name
|
||||
Output.MergeNestedDeclAlias maybeBranchName shorterName longerName
|
||||
IncoherentDeclReason'StrayConstructor name -> Output.MergeStrayConstructor maybeBranchName name
|
||||
pure (defns, declNameLookup)
|
||||
|
||||
(aliceDefns0, aliceDeclNameLookup) <- load (Just (Just branchNames.alice.branch, branches.alice))
|
||||
|
@ -404,9 +404,9 @@ data Output
|
||||
| MergeConflictInvolvingBuiltin !Name
|
||||
| MergeConstructorAlias !(Maybe ProjectBranchName) !Name !Name
|
||||
| MergeDefnsInLib !ProjectBranchName
|
||||
| MergeMissingConstructorName !Name
|
||||
| MergeNestedDeclAlias !Name !Name
|
||||
| MergeStrayConstructor !Name
|
||||
| MergeMissingConstructorName !(Maybe ProjectBranchName) !Name
|
||||
| MergeNestedDeclAlias !(Maybe ProjectBranchName) !Name !Name
|
||||
| MergeStrayConstructor !(Maybe ProjectBranchName) !Name
|
||||
|
||||
data UpdateOrUpgrade = UOUUpdate | UOUUpgrade
|
||||
|
||||
|
@ -1667,27 +1667,39 @@ notifyUser dir = \case
|
||||
<> "and"
|
||||
<> prettyName name2
|
||||
<> "are aliases. Every type declaration must have exactly one name for each constructor."
|
||||
MergeDefnsInLib name ->
|
||||
MergeDefnsInLib branch ->
|
||||
pure . P.wrap $
|
||||
"On"
|
||||
<> P.group (prettyProjectBranchName name <> ",")
|
||||
<> P.group (prettyProjectBranchName branch <> ",")
|
||||
<> "there's a type or term directly in the `lib` namespace, but I expected only library dependencies to be in there."
|
||||
<> "Please remove it before merging."
|
||||
MergeMissingConstructorName name ->
|
||||
MergeMissingConstructorName maybeBranch name ->
|
||||
pure . P.wrap $
|
||||
"The type"
|
||||
"On"
|
||||
<> case maybeBranch of
|
||||
Nothing -> "the LCA,"
|
||||
Just branch -> P.group (prettyProjectBranchName branch <> ",")
|
||||
<> "the type"
|
||||
<> prettyName name
|
||||
<> "is missing a name for one of its constructors. Please add one before merging."
|
||||
MergeNestedDeclAlias shorterName longerName ->
|
||||
MergeNestedDeclAlias maybeBranch shorterName longerName ->
|
||||
pure . P.wrap $
|
||||
"The type"
|
||||
"On"
|
||||
<> case maybeBranch of
|
||||
Nothing -> "the LCA,"
|
||||
Just branch -> P.group (prettyProjectBranchName branch <> ",")
|
||||
<> "the type"
|
||||
<> prettyName longerName
|
||||
<> "is an alias of"
|
||||
<> P.group (prettyName shorterName <> ".")
|
||||
<> "Type aliases cannot be nested. Please make them disjoint before merging."
|
||||
MergeStrayConstructor name ->
|
||||
MergeStrayConstructor maybeBranch name ->
|
||||
pure . P.wrap $
|
||||
"The constructor"
|
||||
"On"
|
||||
<> case maybeBranch of
|
||||
Nothing -> "the LCA,"
|
||||
Just branch -> P.group (prettyProjectBranchName branch <> ",")
|
||||
<> "the constructor"
|
||||
<> prettyName name
|
||||
<> "is not in a subnamespace of a name of its type."
|
||||
<> "Please either delete it or rename it before merging."
|
||||
|
@ -1047,8 +1047,8 @@ bob = 100
|
||||
```ucm
|
||||
project/alice> merge /bob
|
||||
|
||||
The type Foo is missing a name for one of its constructors.
|
||||
Please add one before merging.
|
||||
On alice, the type Foo is missing a name for one of its
|
||||
constructors. Please add one before merging.
|
||||
|
||||
```
|
||||
### Nested decl alias
|
||||
@ -1080,8 +1080,8 @@ bob = 100
|
||||
```ucm
|
||||
project/alice> merge /bob
|
||||
|
||||
The type A.inner.X is an alias of A. Type aliases cannot be
|
||||
nested. Please make them disjoint before merging.
|
||||
On alice, the type A.inner.X is an alias of A. Type aliases
|
||||
cannot be nested. Please make them disjoint before merging.
|
||||
|
||||
```
|
||||
### Stray constructor alias
|
||||
@ -1113,7 +1113,7 @@ project/bob> add
|
||||
```ucm
|
||||
project/alice> merge bob
|
||||
|
||||
The constructor AliasOutsideFooNamespace is not in a
|
||||
On alice, the constructor AliasOutsideFooNamespace is not in a
|
||||
subnamespace of a name of its type. Please either delete it or
|
||||
rename it before merging.
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user