Skip to content

Commit 01a0ee6

Browse files
authored
Merge pull request #5809 from unisonweb/topic/swap-default-update
make update v2 the default
2 parents 87f8c02 + bc205ef commit 01a0ee6

11 files changed

+114
-59
lines changed

unison-cli/src/Unison/Codebase/Editor/HandleInput/Load.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ import Unison.WatchKind qualified as WK
7575

7676
useUpdateV2 :: Bool
7777
useUpdateV2 =
78-
isJust (unsafePerformIO (lookupEnv "UNISON_USE_UPDATE_V2"))
78+
not . isJust . unsafePerformIO $ lookupEnv "UNISON_USE_UPDATE_V1"
7979
{-# NOINLINE useUpdateV2 #-}
8080

8181
handleLoad :: Maybe FilePath -> Cli ()

unison-cli/src/Unison/Codebase/Editor/HandleInput/Update2.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ import Witch (unsafeFrom)
8484

8585
useUpdateV2 :: Bool
8686
useUpdateV2 =
87-
isJust (unsafePerformIO (lookupEnv "UNISON_USE_UPDATE_V2"))
87+
not . isJust . unsafePerformIO $ lookupEnv "UNISON_USE_UPDATE_V1"
8888
{-# NOINLINE useUpdateV2 #-}
8989

9090
handleUpdate2 :: Cli ()

unison-src/transcripts-using-base/all-base-hashes.output.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3454,13 +3454,13 @@ scratch/main> find.verbose
34543454
runTest : '{IO, TempDirs, Exception, Stream Result} a
34553455
->{IO} [Result]
34563456
3457-
851. -- #emt8oa7ee2hha5993870s292rk3muaf44m46ribq3959ps80u3msge1e9dp9p4vprqqnha588s8khqplpcatlqv5gmhuj11ek0abpfo
3457+
968. -- #emt8oa7ee2hha5993870s292rk3muaf44m46ribq3959ps80u3msge1e9dp9p4vprqqnha588s8khqplpcatlqv5gmhuj11ek0abpfo
34583458
saveSelfContained : Optional Nat
34593459
-> a
34603460
-> Text
34613461
->{IO, Exception} ()
34623462
3463-
852. -- #48nls8b5okebjcn689uk8bbo7nenitarsrpvmln9fh0s6mvpnt6slumbg46ofm061urucqeuq70lmkm1chu1b1tdbviid1fl4mriqb8
3463+
969. -- #48nls8b5okebjcn689uk8bbo7nenitarsrpvmln9fh0s6mvpnt6slumbg46ofm061urucqeuq70lmkm1chu1b1tdbviid1fl4mriqb8
34643464
saveTestCase : Optional Nat
34653465
-> Text
34663466
-> Text

unison-src/transcripts/idempotent/cycle-update-3.md

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,9 +58,12 @@ scratch/main> update
5858
5959
That's done. Now I'm making sure everything typechecks...
6060
61-
Typechecking failed. I've updated your scratch file with the
62-
definitions that need fixing. Once the file is compiling, try
63-
`update` again.
61+
Some definitions don't typecheck with your changes. I've
62+
update the file scratch.u with the definitions that need
63+
fixing. Once the file is compiling, try `update` again.
64+
65+
I've also switched you to a new branch update-main for this
66+
work. On `update`, it will be merged back into main.
6467
```
6568

6669
``` unison :added-by-ucm scratch.u

unison-src/transcripts/idempotent/update-suffixifies-properly.md

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,9 +60,12 @@ myproject/main> update
6060
6161
That's done. Now I'm making sure everything typechecks...
6262
63-
Typechecking failed. I've updated your scratch file with the
64-
definitions that need fixing. Once the file is compiling, try
65-
`update` again.
63+
Some definitions don't typecheck with your changes. I've
64+
update the file scratch.u with the definitions that need
65+
fixing. Once the file is compiling, try `update` again.
66+
67+
I've also switched you to a new branch update-main for this
68+
work. On `update`, it will be merged back into main.
6669
```
6770

6871
``` unison :added-by-ucm scratch.u

unison-src/transcripts/idempotent/update-term-with-dependent-to-different-type.md

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,9 +58,12 @@ scratch/main> update
5858
5959
That's done. Now I'm making sure everything typechecks...
6060
61-
Typechecking failed. I've updated your scratch file with the
62-
definitions that need fixing. Once the file is compiling, try
63-
`update` again.
61+
Some definitions don't typecheck with your changes. I've
62+
update the file scratch.u with the definitions that need
63+
fixing. Once the file is compiling, try `update` again.
64+
65+
I've also switched you to a new branch update-main for this
66+
work. On `update`, it will be merged back into main.
6467
```
6568

6669
``` unison :added-by-ucm scratch.u

unison-src/transcripts/idempotent/update-test-watch-roundtrip.md

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,12 @@ scratch/main> update
4747
4848
That's done. Now I'm making sure everything typechecks...
4949
50-
Typechecking failed. I've updated your scratch file with the
51-
definitions that need fixing. Once the file is compiling, try
52-
`update` again.
50+
Some definitions don't typecheck with your changes. I've
51+
update the file scratch.u with the definitions that need
52+
fixing. Once the file is compiling, try `update` again.
53+
54+
I've also switched you to a new branch update-main for this
55+
work. On `update`, it will be merged back into main.
5356
```
5457

5558
``` unison :added-by-ucm scratch.u

unison-src/transcripts/idempotent/update-type-delete-constructor-with-dependent.md

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,9 +59,12 @@ scratch/main> update
5959
6060
That's done. Now I'm making sure everything typechecks...
6161
62-
Typechecking failed. I've updated your scratch file with the
63-
definitions that need fixing. Once the file is compiling, try
64-
`update` again.
62+
Some definitions don't typecheck with your changes. I've
63+
update the file scratch.u with the definitions that need
64+
fixing. Once the file is compiling, try `update` again.
65+
66+
I've also switched you to a new branch update-main for this
67+
work. On `update`, it will be merged back into main.
6568
```
6669

6770
``` unison :added-by-ucm scratch.u

unison-src/transcripts/idempotent/update-type-delete-record-field.md

Lines changed: 68 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,17 @@ scratch/main> add
3030
updated...
3131
3232
Done.
33+
34+
scratch/main> find
35+
36+
1. type Foo
37+
2. Foo.bar : Foo -> Nat
38+
3. Foo.bar.modify : (Nat ->{g} Nat) -> Foo ->{g} Foo
39+
4. Foo.bar.set : Nat -> Foo -> Foo
40+
5. Foo.baz : Foo -> Int
41+
6. Foo.baz.modify : (Int ->{g} Int) -> Foo ->{g} Foo
42+
7. Foo.baz.set : Int -> Foo -> Foo
43+
8. Foo.Foo : Nat -> Int -> Foo
3344
```
3445

3546
``` unison
@@ -61,40 +72,12 @@ scratch/main> update
6172
6273
That's done. Now I'm making sure everything typechecks...
6374
64-
Typechecking failed. I've updated your scratch file with the
65-
definitions that need fixing. Once the file is compiling, try
66-
`update` again.
67-
68-
scratch/main> view Foo
69-
70-
type Foo = { bar : Nat, baz : Int }
71-
72-
scratch/main> find.verbose
73-
74-
1. -- #m0tpa159pbsdld5ea0marnq9614dnmjjc72n1evi4bsk45a1hl84qprt6vdvejuuiuc3f5o23olc1t19tk1dt8mjobmr0chqc3svij8
75-
type Foo
76-
77-
2. -- #16o21u2lli7rd8f3h4epnblpfk3h68gag99d5gicihcpk15dkv4m9601picg37ncsbg2e8j63tu7ebs40jrcoifs7f6nqrus3qnfgv0
78-
Foo.bar : Foo -> Nat
79-
80-
3. -- #64v4pv4rvmnts82gbsb1u2dvgdu4eqq8leq37anqjrkq8s9c7ogrjahdotc36nrodva6ok1rs4ah5k09i7sb0clvcap2773k1t7thb8
81-
Foo.bar.modify : (Nat ->{g} Nat) -> Foo ->{g} Foo
82-
83-
4. -- #bkfjhnu5jqv2m49hosd8g6m4e5u9ju4b1du90cji8s8hnaendvnep2a5cd085ejtu27c4lm3u7slamk52p86rubp211jc5c0qcut2l0
84-
Foo.bar.set : Nat -> Foo -> Foo
85-
86-
5. -- #u394ule3vr1ab8q5nit6miktgpki9gj4nft5jfjsho6cflg94kf953mdhjj8s18e9j1525iv8l5ebjhebnuc01q51fl8ni5n9j0gs28
87-
Foo.baz : Foo -> Int
88-
89-
6. -- #cbbi7mqcaqdlcl41uajb608b8fi5dfvc654rmd47mk9okpn1t3jltrf8psnn3g2tnr1ftctj753fjhco3ku1oapc664upo1h6eodfrg
90-
Foo.baz.modify : (Int ->{g} Int) -> Foo ->{g} Foo
91-
92-
7. -- #hhi45ik1245qq3g93586f998di8j5afvjamqr2m08auqq8ogqt4d01rejrse4qsl27381vnqnt8uffhgvnc0nk22o5uabimjhji4868
93-
Foo.baz.set : Int -> Foo -> Foo
94-
95-
8. -- #m0tpa159pbsdld5ea0marnq9614dnmjjc72n1evi4bsk45a1hl84qprt6vdvejuuiuc3f5o23olc1t19tk1dt8mjobmr0chqc3svij8#0
96-
Foo.Foo : Nat -> Int -> Foo
97-
75+
Some definitions don't typecheck with your changes. I've
76+
update the file scratch.u with the definitions that need
77+
fixing. Once the file is compiling, try `update` again.
78+
79+
I've also switched you to a new branch update-main for this
80+
work. On `update`, it will be merged back into main.
9881
```
9982

10083
``` unison :added-by-ucm scratch.u
@@ -113,3 +96,54 @@ Foo.baz.set : Int -> Foo -> Foo
11396
Foo.baz.set baz1 = cases Foo bar _ -> Foo bar baz1
11497
11598
```
99+
100+
The definitions related to the update are only present in the scratch file now,
101+
and not in the temporary branch:
102+
103+
``` unison
104+
scratch/update-main> ls
105+
106+
1. lib/ (580 terms, 100 types)
107+
```
108+
109+
so we can remove the unwanted definitions from the scratch file and `update` again to delete them:
110+
111+
``` unison
112+
type Foo = { bar : Nat }
113+
```
114+
115+
``` ucm :added-by-ucm
116+
Loading changes detected in scratch.u.
117+
118+
~ type Foo
119+
120+
~ Foo.bar : Foo -> Nat
121+
~ Foo.bar.modify : (Nat ->{g} Nat) -> Foo ->{g} Foo
122+
~ Foo.bar.set : Nat -> Foo -> Foo
123+
- Foo.baz : Foo -> Int
124+
- Foo.baz.modify : (Int ->{g} Int) -> Foo ->{g} Foo
125+
- Foo.baz.set : Int -> Foo -> Foo
126+
127+
+ (added), ~ (modified), - (deleted)
128+
129+
Run `update` to apply these changes to your codebase.
130+
```
131+
132+
``` ucm
133+
scratch/update-main> update
134+
135+
Okay, I'm searching the branch for code that needs to be
136+
updated...
137+
138+
I fast-forward merged scratch/update-main into scratch/main.
139+
140+
Done.
141+
142+
scratch/main> find
143+
144+
1. type Foo
145+
2. Foo.bar : Foo -> Nat
146+
3. Foo.bar.modify : (Nat ->{g} Nat) -> Foo ->{g} Foo
147+
4. Foo.bar.set : Nat -> Foo -> Foo
148+
5. Foo.Foo : Nat -> Foo
149+
```

unison-src/transcripts/idempotent/update-type-with-dependent-term.md

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,9 +54,12 @@ scratch/main> update
5454
5555
That's done. Now I'm making sure everything typechecks...
5656
57-
Typechecking failed. I've updated your scratch file with the
58-
definitions that need fixing. Once the file is compiling, try
59-
`update` again.
57+
Some definitions don't typecheck with your changes. I've
58+
update the file scratch.u with the definitions that need
59+
fixing. Once the file is compiling, try `update` again.
60+
61+
I've also switched you to a new branch update-main for this
62+
work. On `update`, it will be merged back into main.
6063
```
6164

6265
``` unison :added-by-ucm scratch.u

0 commit comments

Comments
 (0)