unison icon indicating copy to clipboard operation
unison copied to clipboard

`renameTo: duplicate rename` pattern matching bug prevents ability to add/update functions

Open jcwilk opened this issue 1 year ago • 5 comments

Steps to reproduce:

Add a function with a pattern match of [a@chars, b@chars] to your scratch.u and save it. eg:

failingFunction : [Text] -> (Text, Text)
failingFunction = cases
  [a@chars, b@chars] -> (a, b)
  _ -> ("", "")

You should get output like:

@jcwilk/advent-of-code-2023/main> 

  I found and typechecked these definitions in ~/unison/scratch.u. If you do an `add` or `update`,
  here's how your codebase would change:
  
    ⍟ These new definitions are ok to `add`:
    
      failingFunction : [Text] -> (Text, Text)


  renameTo: duplicate rename

@jcwilk/advent-of-code-2023/main>

The unique bit is renameTo: duplicate rename. If I then try to add or update then it acts as if there's nothing to update, even if there are many other stale functions as well:

@jcwilk/advent-of-code-2023/main> 

  I found and typechecked these definitions in ~/unison/scratch.u. If you do an `add` or `update`,
  here's how your codebase would change:
  
    ⍟ These new definitions are ok to `add`:
    
      failingFunction : [Text] -> (Text, Text)


  renameTo: duplicate rename

@jcwilk/advent-of-code-2023/main> add

  😶
  
  There's nothing for me to add right now.
  
  Hint: I'm currently watching for definitions in .u files under the ~/unison directory. Make sure
        you've updated something there before using the `add` or `update` commands, or use `load`
        to load a file explicitly.

@jcwilk/advent-of-code-2023/main> update

  😶
  
  There's nothing for me to add right now.
  
  Hint: I'm currently watching for definitions in .u files under the ~/unison directory. Make sure
        you've updated something there before using the `add` or `update` commands, or use `load`
        to load a file explicitly.

@jcwilk/advent-of-code-2023/main>

Attaching an example scratch.u file as well:

scratch.u.zip

jcwilk avatar Dec 04 '23 13:12 jcwilk