Skip to content

Commit

Permalink
Merge cp/project-root
Browse files Browse the repository at this point in the history
  • Loading branch information
ChrisPenner committed Jul 11, 2024
2 parents d480b3a + 670b086 commit 1a67a79
Show file tree
Hide file tree
Showing 8 changed files with 119 additions and 120 deletions.
2 changes: 0 additions & 2 deletions parser-typechecker/src/Unison/Codebase/Branch/Type.hs
Original file line number Diff line number Diff line change
Expand Up @@ -188,8 +188,6 @@ branch0 terms types children edits =
_deepTypes = R.empty,
_deepPaths = Set.empty,
_deepEdits = Map.empty,
_names = mempty,
_pped = PPED.empty
}
& deriveDeepTerms
& deriveDeepTypes
Expand Down
2 changes: 1 addition & 1 deletion unison-cli/src/Unison/Cli/PrettyPrintUtils.hs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import Unison.PrettyPrintEnvDecl qualified as PPE hiding (biasTo)
import Unison.PrettyPrintEnvDecl qualified as PPED
import Unison.PrettyPrintEnvDecl.Names qualified as PPED

-- -- | Builds a pretty print env decl from a names object.
-- | Builds a pretty print env decl from a names object.
prettyPrintEnvDeclFromNames :: Names -> Cli PPE.PrettyPrintEnvDecl
prettyPrintEnvDeclFromNames ns =
Cli.runTransaction Codebase.hashLength <&> \hashLen ->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ diffHelper before after =
Cli.Env {codebase} <- ask
hqLength <- Cli.runTransaction Codebase.hashLength
diff <- liftIO (BranchDiff.diff0 before after)
names <- Cli.currentNames
names <- Cli.currentNames <&> \currentNames -> currentNames <> Branch.toNames before <> Branch.toNames after
pped <- Cli.prettyPrintEnvDeclFromNames names
let suffixifiedPPE = PPED.suffixifiedPPE pped
fmap (suffixifiedPPE,) do
Expand Down
4 changes: 2 additions & 2 deletions unison-src/transcripts/delete.output.md
Original file line number Diff line number Diff line change
Expand Up @@ -362,8 +362,8 @@ scratch/main> delete.verbose Foo Foo.Foo incrementFoo
Removed definitions:
1. structural type Foo
2. Foo.Foo : Nat -> #68k40ra7l7
3. incrementFoo : #68k40ra7l7 -> Nat
2. Foo.Foo : Nat -> Foo
3. incrementFoo : Foo -> Nat
Tip: You can use `undo` or use a hash from `branch.reflog` to
undo this change.
Expand Down
11 changes: 6 additions & 5 deletions unison-src/transcripts/diff-namespace.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ scratch/b1> builtins.merge lib.builtins
scratch/b2> builtins.merge lib.builtins
scratch/nsx> builtins.merge lib.builtins
scratch/main> builtins.merge lib.builtins
scratch/ns1> builtins.merge lib.builtins
```

```unison:hide
Expand Down Expand Up @@ -79,15 +80,15 @@ scratch/ns1> delete.term junk

```unison:hide
fromJust = 99
b = "oog"
b = 999999999
d = 4
e = 5
f = 6
unique type Y a b = Y a b
```

```ucm
scratch/ns2> update.old
scratch/ns2> update
scratch/main> diff.namespace /ns1: /ns2:
scratch/ns2> alias.term d d'
scratch/ns2> alias.type A A'
Expand All @@ -104,7 +105,7 @@ scratch/main> diff.namespace /ns3: /ns2:
bdependent = "banana"
```
```ucm
scratch/ns3> update.old
scratch/ns3> update
scratch/main> diff.namespace /ns2: /ns3:
```

Expand Down Expand Up @@ -132,15 +133,15 @@ a = 444
```

```ucm
scratch/nsy> update.old
scratch/nsy> update
```

```unison:hide
a = 555
```

```ucm
scratch/nsz> update.old
scratch/nsz> update
scratch/nsy> branch /nsw
scratch/nsw> debug.alias.term.force .forconflicts .a
scratch/nsw> debug.alias.term.force .forconflicts .b
Expand Down
147 changes: 76 additions & 71 deletions unison-src/transcripts/diff-namespace.output.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,11 +79,11 @@ scratch/ns1> add
structural type A a
structural ability X a1 a2
b : ##Nat
bdependent : ##Nat
c : ##Nat
fromJust : ##Nat
helloWorld : ##Text
b : Nat
bdependent : Nat
c : Nat
fromJust : Nat
helloWorld : Text
scratch/ns1> alias.term fromJust fromJust'
Expand Down Expand Up @@ -126,7 +126,7 @@ scratch/ns1> add
⍟ I've added these definitions:
junk : ##Text
junk : Text
scratch/ns1> debug.alias.term.force junk fromJust
Expand All @@ -139,28 +139,24 @@ scratch/ns1> delete.term junk
```
``` unison
fromJust = 99
b = "oog"
b = 999999999
d = 4
e = 5
f = 6
unique type Y a b = Y a b
```

``` ucm
scratch/ns2> update.old
scratch/ns2> update
⍟ I've added these definitions:
type Y a b
d : ##Nat
e : ##Nat
f : ##Nat
⍟ I've updated these names to your new definition:
b : ##Text
fromJust : ##Nat
(The old definition was also named fromJust'.)
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.
scratch/main> diff.namespace /ns1: /ns2:
Expand All @@ -175,21 +171,25 @@ scratch/main> diff.namespace /ns1: /ns2:
4. b : Nat
5. b : Text
5. b : Nat
6. fromJust' : Nat
6. bdependent : Nat
7. fromJust' : Nat
7. bdependent : Nat
Added definitions:
8. type Y a b
9. Y.Y : a -> b -> #md85ksgqel a b
9. Y.Y : a -> b -> Y a b
10. d : Nat
11. e : Nat
12. f : Nat
13. patch patch (added 2 updates)
Name changes:
Original Changes
13. fromJust' ┐ 14. fromJust#gjmq673r1v (removed)
15. fromJust#gjmq673r1v ┘
scratch/ns2> alias.term d d'
Expand All @@ -216,29 +216,30 @@ scratch/main> diff.namespace /ns1: /ns2:
4. b : Nat
5. b : Text
5. b : Nat
6. fromJust' : Nat
6. bdependent : Nat
7. fromJust' : Nat
7. bdependent : Nat
Added definitions:
8. type Y a b
9. Y.Y : a -> b -> #md85ksgqel a b
9. Y.Y : a -> b -> Y a b
10. ┌ d : Nat
11. └ d' : Nat
12. e : Nat
13. f : Nat
14. patch patch (added 2 updates)
Name changes:
Original Changes
15. A 16. A' (added)
Original Changes
14. A 15. A' (added)
17. X 18. X' (added)
16. X 17. X' (added)
18. fromJust' ┐ 19. fromJust#gjmq673r1v (removed)
20. fromJust#gjmq673r1v ┘
scratch/ns1> alias.type X X2
Expand All @@ -264,9 +265,8 @@ scratch/ns2> delete.term.verbose fromJust'
Name changes:
Original Changes
1. fromJust ┐ 2. fromJust' (removed)
3. fromJust' │
4. yoohoo ┘
1. fromJust' ┐ 2. fromJust' (removed)
3. yoohoo ┘
Tip: You can use `undo` or use a hash from `branch.reflog` to
undo this change.
Expand All @@ -276,20 +276,21 @@ scratch/main> diff.namespace /ns3: /ns2:
Name changes:
Original Changes
1. fromJust 2. yoohoo (added)
3. fromJust' ┘ 4. fromJust' (removed)
1. fromJust' 2. yoohoo (added)
3. fromJust' (removed)
```
``` unison
bdependent = "banana"
```

``` ucm
scratch/ns3> update.old
scratch/ns3> update
⍟ I've updated these names to your new definition:
bdependent : ##Text
Okay, I'm searching the branch for code that needs to be
updated...
Done.
scratch/main> diff.namespace /ns2: /ns3:
Expand All @@ -299,13 +300,11 @@ scratch/main> diff.namespace /ns2: /ns3:
2. bdependent : Text
3. patch patch (added 1 updates)
Name changes:
Original Changes
4. fromJust ┐ 5. fromJust' (added)
6. yoohoo ┘ 7. yoohoo (removed)
Original Changes
3. yoohoo 4. fromJust' (added)
5. yoohoo (removed)
```
## Two different auto-propagated changes creating a name conflict
Expand Down Expand Up @@ -349,23 +348,33 @@ a = 444
```

``` ucm
scratch/nsy> update.old
scratch/nsy> update
⍟ I've updated these names to your new definition:
a : 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.
```
``` unison
a = 555
```

``` ucm
scratch/nsz> update.old
scratch/nsz> update
⍟ I've updated these names to your new definition:
a : 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.
scratch/nsy> branch /nsw
Expand All @@ -388,25 +397,21 @@ scratch/main> diff.namespace /nsx: /nsw:
New name conflicts:
1. a#uiiiv8a86s : Nat
2. ┌ a#mdl4vqtu00 : Nat
3. └ a#r3msrbpp1v : Nat
1. a#uiiiv8a86s : Nat
2. ┌ a#mdl4vqtu00 : Nat
3. └ a#r3msrbpp1v : Nat
4. b#lhigeb1let : Nat
5. ┌ b#r3msrbpp1v : Nat
6. └ b#unkqhuu66p : Nat
Added definitions:
7. patch patch (added 1 updates)
4. b#lhigeb1let : Nat
5. ┌ b#r3msrbpp1v : Nat
6. └ b#unkqhuu66p : Nat
Name changes:
Original Changes
8. forconflicts 9. a#r3msrbpp1v (added)
10. b#r3msrbpp1v (added)
Original Changes
7. forconflicts 8. a#r3msrbpp1v (added)
9. b#r3msrbpp1v (added)
scratch/nsw> view a
Expand Down
6 changes: 3 additions & 3 deletions unison-src/transcripts/fix2254.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ We'll make our edits in a new branch.

```ucm
scratch/a> add
scratch/a> branch a2
scratch/a> branch /a2
scratch/a2>
```

Expand All @@ -57,7 +57,7 @@ unique type A a b c d
Let's do the update now, and verify that the definitions all look good and there's nothing `todo`:

```ucm
scratch/a2> update.old
scratch/a2> update
scratch/a2> view A NeedsA f f2 f3 g
scratch/a2> todo
```
Expand Down Expand Up @@ -89,6 +89,6 @@ structural type Rec = { uno : Nat, dos : Nat, tres : Text }
And checking that after updating this record, there's nothing `todo`:

```ucm
scratch/r2> update.old
scratch/r2> update
scratch/r2> todo
```
Loading

0 comments on commit 1a67a79

Please sign in to comment.