2022-01-17 03:25:50 +03:00
|
|
|
# Regression test for updates which conflict with an existing data constructor
|
|
|
|
|
|
|
|
https://github.com/unisonweb/unison/issues/2786
|
|
|
|
|
|
|
|
```ucm:hide
|
2024-06-26 21:53:59 +03:00
|
|
|
scratch/main> builtins.merge lib.builtins
|
2022-01-17 03:25:50 +03:00
|
|
|
```
|
|
|
|
|
|
|
|
First we add a sum-type to the codebase.
|
|
|
|
|
|
|
|
```unison
|
|
|
|
structural type X = x
|
|
|
|
```
|
|
|
|
|
|
|
|
```ucm
|
2024-06-26 21:53:59 +03:00
|
|
|
scratch/main> add
|
2022-01-17 03:25:50 +03:00
|
|
|
```
|
|
|
|
|
|
|
|
Now we update the type, changing the name of the constructors, _but_, we simultaneously
|
|
|
|
add a new top-level term with the same name as the old constructor.
|
|
|
|
|
|
|
|
```unison
|
|
|
|
structural type X = y | z
|
|
|
|
|
|
|
|
X.x : Text
|
|
|
|
X.x = "some text that's not in the codebase"
|
|
|
|
|
|
|
|
dependsOnX = Text.size X.x
|
|
|
|
```
|
|
|
|
|
2022-01-17 21:07:40 +03:00
|
|
|
This update should succeed since the conflicted constructor
|
|
|
|
is removed in the same update that the new term is being added.
|
2022-01-17 03:25:50 +03:00
|
|
|
|
2022-01-17 21:07:40 +03:00
|
|
|
```ucm
|
2024-06-26 21:53:59 +03:00
|
|
|
scratch/main> update.old
|
2022-01-17 03:25:50 +03:00
|
|
|
```
|