mirror of
https://github.com/unisonweb/unison.git
synced 2024-10-26 02:55:19 +03:00
⅄ trunk → 24-07-01-todo-merge-precondition-violations
This commit is contained in:
commit
8ff7e6d92d
@ -81,7 +81,11 @@ identifierSplitAtPosition uri pos = do
|
||||
vf <- getVirtualFile uri
|
||||
PosPrefixInfo {fullLine, cursorPos} <- MaybeT (VFS.getCompletionPrefix pos vf)
|
||||
let (before, after) = Text.splitAt (cursorPos ^. character . to fromIntegral) fullLine
|
||||
pure (Text.takeWhileEnd isIdentifierChar before, Text.takeWhile isIdentifierChar after)
|
||||
pure
|
||||
( Text.takeWhileEnd isIdentifierChar before,
|
||||
-- names can end with '!', and it's not a force, so we include it in the identifier if it's at the end.
|
||||
Text.takeWhile (\c -> isIdentifierChar c || c == '!') after
|
||||
)
|
||||
where
|
||||
isIdentifierChar c =
|
||||
-- Manually exclude '!' and apostrophe, since those are usually just forces and
|
||||
|
@ -3,7 +3,7 @@
|
||||
https://github.com/unisonweb/unison/issues/2786
|
||||
|
||||
```ucm:hide
|
||||
.ns> builtins.merge
|
||||
scratch/main> builtins.merge lib.builtins
|
||||
```
|
||||
|
||||
First we add an ability to the codebase.
|
||||
@ -15,7 +15,7 @@ unique ability Channels where
|
||||
```
|
||||
|
||||
```ucm
|
||||
.ns> add
|
||||
scratch/main> add
|
||||
```
|
||||
|
||||
Now we update the ability, changing the name of the constructor, _but_, we simultaneously
|
||||
@ -36,8 +36,8 @@ thing _ = send 1
|
||||
These should fail with a term/ctor conflict since we exclude the ability from the update.
|
||||
|
||||
```ucm:error
|
||||
.ns> update.old patch Channels.send
|
||||
.ns> update.old patch thing
|
||||
scratch/main> update.old patch Channels.send
|
||||
scratch/main> update.old patch thing
|
||||
```
|
||||
|
||||
If however, `Channels.send` and `thing` _depend_ on `Channels`, updating them should succeed since it pulls in the ability as a dependency.
|
||||
@ -56,20 +56,20 @@ thing _ = send 1
|
||||
These updates should succeed since `Channels` is a dependency.
|
||||
|
||||
```ucm
|
||||
.ns> update.old.preview patch Channels.send
|
||||
.ns> update.old.preview patch thing
|
||||
scratch/main> update.old.preview patch Channels.send
|
||||
scratch/main> update.old.preview patch thing
|
||||
```
|
||||
|
||||
We should also be able to successfully update the whole thing.
|
||||
|
||||
```ucm
|
||||
.ns> update.old
|
||||
scratch/main> update.old
|
||||
```
|
||||
|
||||
# Constructor-term conflict
|
||||
|
||||
```ucm:hide
|
||||
.ns2> builtins.merge
|
||||
scratch/main2> builtins.merge lib.builtins
|
||||
```
|
||||
|
||||
|
||||
@ -78,7 +78,7 @@ X.x = 1
|
||||
```
|
||||
|
||||
```ucm
|
||||
.ns2> add
|
||||
scratch/main2> add
|
||||
```
|
||||
|
||||
```unison
|
||||
@ -89,5 +89,5 @@ structural ability X where
|
||||
This should fail with a ctor/term conflict.
|
||||
|
||||
```ucm:error
|
||||
.ns2> add
|
||||
scratch/main2> add
|
||||
```
|
||||
|
@ -24,7 +24,7 @@ unique ability Channels where
|
||||
|
||||
```
|
||||
```ucm
|
||||
.ns> add
|
||||
scratch/main> add
|
||||
|
||||
⍟ I've added these definitions:
|
||||
|
||||
@ -68,7 +68,7 @@ thing _ = send 1
|
||||
These should fail with a term/ctor conflict since we exclude the ability from the update.
|
||||
|
||||
```ucm
|
||||
.ns> update.old patch Channels.send
|
||||
scratch/main> update.old patch Channels.send
|
||||
|
||||
x These definitions failed:
|
||||
|
||||
@ -77,7 +77,7 @@ These should fail with a term/ctor conflict since we exclude the ability from th
|
||||
|
||||
Tip: Use `help filestatus` to learn more.
|
||||
|
||||
.ns> update.old patch thing
|
||||
scratch/main> update.old patch thing
|
||||
|
||||
⍟ I've added these definitions:
|
||||
|
||||
@ -122,7 +122,7 @@ thing _ = send 1
|
||||
These updates should succeed since `Channels` is a dependency.
|
||||
|
||||
```ucm
|
||||
.ns> update.old.preview patch Channels.send
|
||||
scratch/main> update.old.preview patch Channels.send
|
||||
|
||||
I found and typechecked these definitions in scratch.u. If you
|
||||
do an `add` or `update`, here's how your codebase would
|
||||
@ -135,7 +135,7 @@ These updates should succeed since `Channels` is a dependency.
|
||||
|
||||
Channels.send : a ->{Channels} ()
|
||||
|
||||
.ns> update.old.preview patch thing
|
||||
scratch/main> update.old.preview patch thing
|
||||
|
||||
I found and typechecked these definitions in scratch.u. If you
|
||||
do an `add` or `update`, here's how your codebase would
|
||||
@ -153,7 +153,7 @@ These updates should succeed since `Channels` is a dependency.
|
||||
We should also be able to successfully update the whole thing.
|
||||
|
||||
```ucm
|
||||
.ns> update.old
|
||||
scratch/main> update.old
|
||||
|
||||
⊡ Ignored previously added definitions: Channels
|
||||
|
||||
@ -183,7 +183,7 @@ X.x = 1
|
||||
|
||||
```
|
||||
```ucm
|
||||
.ns2> add
|
||||
scratch/main2> add
|
||||
|
||||
⍟ I've added these definitions:
|
||||
|
||||
@ -215,7 +215,7 @@ structural ability X where
|
||||
This should fail with a ctor/term conflict.
|
||||
|
||||
```ucm
|
||||
.ns2> add
|
||||
scratch/main2> add
|
||||
|
||||
x These definitions failed:
|
||||
|
||||
|
@ -77,6 +77,6 @@ structural type HigherRanked = HigherRanked (forall a. a -> a)
|
||||
We should be able to add and view records with higher-rank fields.
|
||||
|
||||
```ucm
|
||||
.higher_ranked> add
|
||||
.higher_ranked> view HigherRanked
|
||||
scratch/main> add
|
||||
scratch/main> view HigherRanked
|
||||
```
|
||||
|
@ -141,15 +141,13 @@ structural type HigherRanked = HigherRanked (forall a. a -> a)
|
||||
We should be able to add and view records with higher-rank fields.
|
||||
|
||||
```ucm
|
||||
☝️ The namespace .higher_ranked is empty.
|
||||
|
||||
.higher_ranked> add
|
||||
scratch/main> add
|
||||
|
||||
⍟ I've added these definitions:
|
||||
|
||||
structural type HigherRanked
|
||||
|
||||
.higher_ranked> view HigherRanked
|
||||
scratch/main> view HigherRanked
|
||||
|
||||
structural type HigherRanked = HigherRanked (∀ a. a -> a)
|
||||
|
||||
|
@ -4,8 +4,8 @@ The `merge` command merges together two branches in the same project: the curren
|
||||
branch. For example, to merge `topic` into `main`, switch to `main` and run `merge topic`:
|
||||
|
||||
```ucm:error
|
||||
.> help merge
|
||||
.> help merge.commit
|
||||
scratch/main> help merge
|
||||
scratch/main> help merge.commit
|
||||
```
|
||||
|
||||
Let's see a simple unconflicted merge in action: Alice (us) and Bob (them) add different terms. The merged result
|
||||
|
@ -4,12 +4,12 @@ The `merge` command merges together two branches in the same project: the curren
|
||||
branch. For example, to merge `topic` into `main`, switch to `main` and run `merge topic`:
|
||||
|
||||
```ucm
|
||||
.> help merge
|
||||
scratch/main> help merge
|
||||
|
||||
merge
|
||||
`merge /branch` merges `branch` into the current branch
|
||||
|
||||
.> help merge.commit
|
||||
scratch/main> help merge.commit
|
||||
|
||||
merge.commit (or commit.merge)
|
||||
`merge.commit` merges a temporary branch created by the `merge`
|
||||
|
@ -15,7 +15,7 @@ two.ambiguousTerm = "term two"
|
||||
```
|
||||
|
||||
```ucm
|
||||
.example.resolution_failures> add
|
||||
scratch/main> add
|
||||
```
|
||||
|
||||
## Tests
|
||||
|
@ -31,9 +31,7 @@ two.ambiguousTerm = "term two"
|
||||
|
||||
```
|
||||
```ucm
|
||||
☝️ The namespace .example.resolution_failures is empty.
|
||||
|
||||
.example.resolution_failures> add
|
||||
scratch/main> add
|
||||
|
||||
⍟ I've added these definitions:
|
||||
|
||||
|
@ -3,8 +3,7 @@
|
||||
Updating conflicted definitions works fine.
|
||||
|
||||
```ucm:hide
|
||||
.> builtins.merge
|
||||
.merged> builtins.merge
|
||||
scratch/main> builtins.merge lib.builtins
|
||||
```
|
||||
|
||||
```unison
|
||||
@ -13,9 +12,9 @@ temp = 2
|
||||
```
|
||||
|
||||
```ucm
|
||||
.> add
|
||||
.> debug.alias.term.force temp x
|
||||
.> delete.term temp
|
||||
scratch/main> add
|
||||
scratch/main> debug.alias.term.force temp x
|
||||
scratch/main> delete.term temp
|
||||
```
|
||||
|
||||
```unison
|
||||
@ -23,6 +22,6 @@ x = 3
|
||||
```
|
||||
|
||||
```ucm
|
||||
.> update
|
||||
.> view x
|
||||
scratch/main> update
|
||||
scratch/main> view x
|
||||
```
|
||||
|
@ -22,18 +22,18 @@ temp = 2
|
||||
|
||||
```
|
||||
```ucm
|
||||
.> add
|
||||
scratch/main> add
|
||||
|
||||
⍟ I've added these definitions:
|
||||
|
||||
temp : Nat
|
||||
x : Nat
|
||||
|
||||
.> debug.alias.term.force temp x
|
||||
scratch/main> debug.alias.term.force temp x
|
||||
|
||||
Done.
|
||||
|
||||
.> delete.term temp
|
||||
scratch/main> delete.term temp
|
||||
|
||||
Done.
|
||||
|
||||
@ -57,14 +57,14 @@ x = 3
|
||||
|
||||
```
|
||||
```ucm
|
||||
.> update
|
||||
scratch/main> update
|
||||
|
||||
Okay, I'm searching the branch for code that needs to be
|
||||
updated...
|
||||
|
||||
Done.
|
||||
|
||||
.> view x
|
||||
scratch/main> view x
|
||||
|
||||
x : Nat
|
||||
x = 3
|
||||
|
Loading…
Reference in New Issue
Block a user