Skip to content

Commit

Permalink
Fix up update transcripts
Browse files Browse the repository at this point in the history
  • Loading branch information
ChrisPenner committed Jun 5, 2024
1 parent 2a04c47 commit 9f71e2e
Show file tree
Hide file tree
Showing 22 changed files with 340 additions and 476 deletions.
20 changes: 6 additions & 14 deletions unison-src/transcripts/ability-term-conflicts-on-update.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,13 @@ thing : '{Channels} ()
thing _ = send 1
```

These should fail with a term/ctor conflict since we exclude the ability from the update.
We should be able to update everything at once.

```ucm:error
.ns> update.old patch Channels.send
.ns> update.old patch thing
```ucm
.ns> update
```

If however, `Channels.send` and `thing` _depend_ on `Channels`, updating them should succeed since it pulls in the ability as a dependency.
If `Channels.send` and `thing` _depend_ on `Channels`, updating them should succeed since it pulls in the ability as a dependency.

```unison
unique ability Channels where
Expand All @@ -53,17 +52,10 @@ thing : '{Channels} ()
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
```

We should also be able to successfully update the whole thing.
We should be able to successfully update the whole thing.

```ucm
.ns> update.old
.ns> update
```

# Constructor-term conflict
Expand Down
68 changes: 11 additions & 57 deletions unison-src/transcripts/ability-term-conflicts-on-update.output.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,31 +65,18 @@ thing _ = send 1
ability Channels
```
These should fail with a term/ctor conflict since we exclude the ability from the update.
We should be able to update everything at once.

```ucm
.ns> update.old patch Channels.send
.ns> update
x These definitions failed:
Reason
term/ctor collision Channels.send : a -> ()
Tip: Use `help filestatus` to learn more.
Okay, I'm searching the branch for code that needs to be
updated...
.ns> update.old patch thing
⍟ I've added these definitions:
Channels.send : a -> ()
thing : '{Channels} ()
⍟ I've updated these names to your new definition:
ability Channels
Done.
```
If however, `Channels.send` and `thing` _depend_ on `Channels`, updating them should succeed since it pulls in the ability as a dependency.
If `Channels.send` and `thing` _depend_ on `Channels`, updating them should succeed since it pulls in the ability as a dependency.

```unison
unique ability Channels where
Expand Down Expand Up @@ -119,48 +106,15 @@ thing _ = send 1
thing : '{Channels} ()
```
These updates should succeed since `Channels` is a dependency.
We should be able to successfully update the whole thing.

```ucm
.ns> 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
change:
⊡ Previously added definitions will be ignored: Channels
⍟ These names already exist. You can `update` them to your
new definition:
Channels.send : a ->{Channels} ()
.ns> 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
change:
⊡ Previously added definitions will be ignored: Channels
⍟ These names already exist. You can `update` them to your
new definition:
Channels.send : a ->{Channels} ()
thing : '{Channels} ()
.ns> update
```
We should also be able to successfully update the whole thing.

```ucm
.ns> update.old
Okay, I'm searching the branch for code that needs to be
updated...
⊡ Ignored previously added definitions: Channels
⍟ I've updated these names to your new definition:
Channels.send : a ->{Channels} ()
thing : '{Channels} ()
Done.
```
# Constructor-term conflict
Expand Down
9 changes: 7 additions & 2 deletions unison-src/transcripts/cycle-update-3.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,12 @@ ping : Nat
ping = 3
```

```ucm
.> update.old
Updating only part of a cycle should bring the rest of the cycle into scope:

```ucm:error
.> update
```

```
.> view ping pong
```
36 changes: 24 additions & 12 deletions unison-src/transcripts/cycle-update-3.output.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,21 +50,33 @@ ping = 3
ping : Nat
```
Updating only part of a cycle should bring the rest of the cycle into scope:

```ucm
.> update.old
.> update
⍟ I've updated these names to your new definition:
ping : Nat
Okay, I'm searching the branch for code that needs to be
updated...
.> view ping pong
That's done. Now I'm making sure everything typechecks...
ping : Nat
ping = 3
pong : 'Nat
pong _ =
use Nat +
!#4t465jk908.1 + 2
Typechecking failed. I've updated your scratch file with the
definitions that need fixing. Once the file is compiling, try
`update` again.
```
```unison:added-by-ucm scratch.u
pong : 'Nat
pong _ =
use Nat +
!ping + 2
ping : Nat
ping = 3
```

```
.> view ping pong
```

2 changes: 1 addition & 1 deletion unison-src/transcripts/cycle-update-4.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,6 @@ clang _ = !pong + 3
```

```ucm
.> update.old ping
.> update
.> view ping pong clang
```
18 changes: 9 additions & 9 deletions unison-src/transcripts/cycle-update-4.output.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,16 +58,16 @@ clang _ = !pong + 3
```
```ucm
.> update.old ping
.> update
I've added these definitions:
clang : 'Nat
⍟ I've updated these names to your new definition:
ping : 'Nat
pong : 'Nat
Okay, I'm searching the branch for code that needs to be
updated...
That's done. Now I'm making sure everything typechecks...
Everything typechecks, so I'm saving the results...
Done.
.> view ping pong clang
Expand Down
2 changes: 1 addition & 1 deletion unison-src/transcripts/cycle-update-5.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ inner.ping _ = !pong + 3
```

```ucm
.inner> update.old
.inner> update
.> view inner.ping
```

Expand Down
9 changes: 5 additions & 4 deletions unison-src/transcripts/cycle-update-5.output.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,11 +54,12 @@ inner.ping _ = !pong + 3
```
```ucm
.inner> update.old
.inner> update
⍟ I've added these definitions:
inner.ping : '##Nat
Okay, I'm searching the branch for code that needs to be
updated...
Done.
.> view inner.ping
Expand Down
40 changes: 4 additions & 36 deletions unison-src/transcripts/diff-namespace.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ structural ability X a1 a2 where x : ()
```

```ucm
.ns1> builtins.merge
.ns1> add
.ns1> alias.term fromJust fromJust'
.ns1> alias.term helloWorld helloWorld2
Expand Down Expand Up @@ -72,14 +73,15 @@ fromJust = "asldkfjasldkfj"
```unison:hide
fromJust = 99
b = "oog"
bdependent = b
d = 4
e = 5
f = 6
unique type Y a b = Y a b
```

```ucm
.ns2> update.old
.ns2> update
.> diff.namespace ns1 ns2
.> alias.term ns2.d ns2.d'
.> alias.type ns2.A ns2.A'
Expand All @@ -96,44 +98,10 @@ unique type Y a b = Y a b
bdependent = "banana"
```
```ucm
.ns3> update.old
.ns3> update
.> diff.namespace ns2 ns3
```


## Two different auto-propagated changes creating a name conflict
Currently, the auto-propagated name-conflicted definitions are not explicitly
shown, only their also-conflicted dependency is shown.
```unison:hide
a = 333
b = a + 1
```
```ucm
.nsx> add
.> fork nsx nsy
.> fork nsx nsz
```
```unison:hide
a = 444
```
```ucm
.nsy> update.old
```
```unison:hide
a = 555
```
```ucm
.nsz> update.old
.> merge.old nsy nsw
```
```ucm:error
.> merge.old nsz nsw
```
```ucm
.> diff.namespace nsx nsw
.nsw> view a b
```

## Should be able to diff a namespace hash from history.

```unison
Expand Down
Loading

0 comments on commit 9f71e2e

Please sign in to comment.