mirror of
https://github.com/unisonweb/unison.git
synced 2024-09-11 10:35:57 +03:00
1.8 KiB
1.8 KiB
Regression test for updates which conflict with an existing ability constructor
https://github.com/unisonweb/unison/issues/2786
scratch/main> builtins.merge lib.builtins
First we add an ability to the codebase.
Note that this will create the name Channels.send
as an ability constructor.
unique ability Channels where
send : a -> {Channels} ()
scratch/main> add
Now we update the ability, changing the name of the constructor, but, we simultaneously add a new top-level term with the same name as the constructor which is being removed from Channels.
unique ability Channels where
sends : [a] -> {Channels} ()
Channels.send : a -> ()
Channels.send a = ()
thing : '{Channels} ()
thing _ = send 1
These should fail with a term/ctor conflict since we exclude the ability from the update.
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.
unique ability Channels where
sends : [a] -> {Channels} ()
Channels.send : a -> ()
Channels.send a = sends [a]
thing : '{Channels} ()
thing _ = send 1
These updates should succeed since Channels
is a dependency.
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.
scratch/main> update.old
Constructor-term conflict
scratch/main2> builtins.merge lib.builtins
X.x = 1
scratch/main2> add
structural ability X where
x : ()
This should fail with a ctor/term conflict.
scratch/main2> add