unison icon indicating copy to clipboard operation
unison copied to clipboard

merge issue when splitting an alias

Open stew opened this issue 1 month ago • 0 comments

This demonstrates an issue Cody and I ran into. We had a term with two different aliases. Cody split that alias so that the two names had two different implementations, and picked which call site should go to which new definition.

On a different branch, I made an unrelated change to a type referred to in the type signature of the term, which caused the term and the callers of that term to get new hashes on my branch.

When I went to merge my branch, it told me that I should go delete one of cody's new definitions first, so that the merge could just replace them all with the other, which is certainly not the right thing.

One can successfully get ucm to do what you want by changing either of the names of the functions in cody's branch first, and then naming it back. but it seems like ucm could have figured this out for me

```unison

type Song = Song Note

type Note = Do | Re | Mi

one.getNote: Song -> Note
one.getNote _ = Do

caller1 : Song -> Note
caller1 s = 
    one.getNote s

caller2 : Song -> Note
caller2 s =  
    _ = one.getNote s
    one.getNote s
```

```ucm
> update
> alias.term one.getNote two.getNote
> names one.getNote two.getNote
> branch.create /barb
> branch.create /andy
```


```unison

one.getNote: Song -> Note
one.getNote _ = Mi

caller1 s = one.getNote s

two.getNote : Song -> Note
two.getNote _ = Re

caller2 s = two.getNote s

```

```ucm
> update
> names one.getNote two.getNote
> switch /barb
```

```unison
type Note = Do | Re | Mi | Fa | Sol | La | Ti
```

```ucm
> update
> names one.getNote two.getNote
```

This section will fail, but if you delete it, the larger following section will succeed, doing what I want this one to do

```ucm
> merge /andy
```

``` ucm
> switch /andy
> move two.getNote two.getNuts
> switch /barb

> merge /andy

> move two.getNuts two.getNote
```

stew avatar Nov 21 '25 00:11 stew