unison/unison-src/transcripts/sum-type-update-conflicts.md
2024-06-26 11:55:35 -07:00

741 B

Regression test for updates which conflict with an existing data constructor

https://github.com/unisonweb/unison/issues/2786

scratch/main> builtins.merge lib.builtins

First we add a sum-type to the codebase.

structural type X = x
scratch/main> add

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.

structural type X = y | z

X.x : Text
X.x = "some text that's not in the codebase"

dependsOnX = Text.size X.x

This update should succeed since the conflicted constructor is removed in the same update that the new term is being added.

scratch/main> update.old