tweak output messages

This commit is contained in:
Arya Irani 2024-08-01 17:49:45 -04:00
parent c4c23273f9
commit 9100b97e91
10 changed files with 26 additions and 24 deletions

View File

@ -156,9 +156,9 @@ makePrettyUnisonFile originalFile dependents =
originalFile
<> Pretty.newline
<> Pretty.newline
<> "-- The definitions below are not compatible with the updated definitions above."
<> "-- The definitions below no longer typecheck with the changes above."
<> Pretty.newline
<> "-- Please fix the errors and run `update` again."
<> "-- Please fix the errors and try `update` again."
<> Pretty.newline
<> Pretty.newline
<> ( dependents

View File

@ -2095,11 +2095,12 @@ notifyUser dir = \case
<> P.text filename
ConflictedDefn operation defn ->
pure . P.wrap $
( case defn of
TermDefn (Conflicted name _refs) -> "The term name" <> prettyName name <> "is ambiguous."
TypeDefn (Conflicted name _refs) -> "The type name" <> prettyName name <> "is ambiguous."
( "This branch has more than one" <> case defn of
TermDefn (Conflicted name _refs) -> "term with the name" <> P.group (P.backticked (prettyName name) <> ".")
TypeDefn (Conflicted name _refs) -> "type with the name" <> P.group (P.backticked (prettyName name) <> ".")
)
<> "Please resolve the ambiguity, then try to"
<> P.newline
<> "Please delete or rename all but one of them, then try the"
<> P.text operation
<> "again."
IncoherentDeclDuringMerge aliceOrBob reason ->
@ -2614,7 +2615,7 @@ renderNameConflicts hashLen conflictedNames = do
prettyConflictedTerms <- showConflictedNames "term" conflictedTermNames
pure $
Monoid.unlessM (null allConflictedNames) $
P.callout "" . P.sep "\n\n" . P.nonEmpty $
P.callout "" . P.linesSpaced . P.nonEmpty $
[ prettyConflictedTypes,
prettyConflictedTerms,
tip $
@ -2635,7 +2636,7 @@ renderNameConflicts hashLen conflictedNames = do
where
showConflictedNames :: Pretty -> Map Name [HQ.HashQualified Name] -> Numbered Pretty
showConflictedNames thingKind conflictedNames =
P.lines <$> do
P.linesSpaced <$> do
for (Map.toList conflictedNames) \(name, hashes) -> do
prettyConflicts <- for hashes \hash -> do
n <- addNumberedArg $ SA.HashQualified hash

View File

@ -59,7 +59,8 @@ x = 3
``` ucm
scratch/main> update
The term name x is ambiguous. Please resolve the ambiguity,
then try to update again.
This branch has more than one term with the name `x`. Please
delete or rename all but one of them, then try the update
again.
```

View File

@ -72,8 +72,8 @@ myproject/main> update
``` unison:added-by-ucm scratch.u
foo = +30
-- The definitions below are not compatible with the updated definitions above.
-- Please fix the errors and run `update` again.
-- The definitions below no longer typecheck with the changes above.
-- Please fix the errors and try `update` again.
bar : Nat
bar =

View File

@ -71,8 +71,8 @@ scratch/main> update
foo : Int
foo = +5
-- The definitions below are not compatible with the updated definitions above.
-- Please fix the errors and run `update` again.
-- The definitions below no longer typecheck with the changes above.
-- Please fix the errors and try `update` again.
bar : Nat
bar =

View File

@ -53,8 +53,8 @@ scratch/main> update
``` unison:added-by-ucm scratch.u
foo n = "hello, world!"
-- The definitions below are not compatible with the updated definitions above.
-- Please fix the errors and run `update` again.
-- The definitions below no longer typecheck with the changes above.
-- Please fix the errors and try `update` again.
test> mynamespace.foo.test =
n = 2

View File

@ -67,8 +67,8 @@ scratch/main> update
``` unison:added-by-ucm scratch.u
type Foo = Bar Nat
-- The definitions below are not compatible with the updated definitions above.
-- Please fix the errors and run `update` again.
-- The definitions below no longer typecheck with the changes above.
-- Please fix the errors and try `update` again.
foo : Foo -> Nat
foo = cases

View File

@ -106,8 +106,8 @@ scratch/main> find.verbose
``` unison:added-by-ucm scratch.u
type Foo = { bar : Nat }
-- The definitions below are not compatible with the updated definitions above.
-- Please fix the errors and run `update` again.
-- The definitions below no longer typecheck with the changes above.
-- Please fix the errors and try `update` again.
Foo.baz : Foo -> Int
Foo.baz = cases Foo _ baz -> baz

View File

@ -62,8 +62,8 @@ scratch/main> update
``` unison:added-by-ucm scratch.u
type Foo = Bar Nat Nat
-- The definitions below are not compatible with the updated definitions above.
-- Please fix the errors and run `update` again.
-- The definitions below no longer typecheck with the changes above.
-- Please fix the errors and try `update` again.
incrFoo : Foo -> Foo
incrFoo = cases Bar n -> Bar (n Nat.+ 1)

View File

@ -60,8 +60,8 @@ scratch/main> update
``` unison:added-by-ucm scratch.u
type Foo a = Bar Nat a
-- The definitions below are not compatible with the updated definitions above.
-- Please fix the errors and run `update` again.
-- The definitions below no longer typecheck with the changes above.
-- Please fix the errors and try `update` again.
type Baz = Qux Foo