unisonweb / unison

A friendly programming language from the future
https://unison-lang.org
Other
5.81k stars 271 forks source link

local variable name capture bug #5380

Closed mitchellwrosen closed 1 month ago

mitchellwrosen commented 1 month ago
```ucm
scratch/main> builtins.merge lib.builtin
foo : Nat
foo = 17

bar : Nat
bar =
  qux : Nat
  qux = 18
  foo + qux
scratch/main> add
scratch/main> move.term foo qux
scratch/main> view bar

Output:
scratch/main> builtins.merge lib.builtin

  Done.
foo : Nat
foo = 17

bar : Nat
bar =
  qux : Nat
  qux = 18
  foo + qux

  Loading changes detected in scratch.u.

  I found and typechecked these definitions in scratch.u. If you
  do an `add` or `update`, here's how your codebase would
  change:

    ⍟ These new definitions are ok to `add`:

      bar : Nat
      foo : Nat
scratch/main> add

  ⍟ I've added these definitions:

    bar : Nat
    foo : Nat

scratch/main> move.term foo qux

  Done.

scratch/main> view bar

  bar : Nat
  bar =
    use Nat +
    qux : Nat
    qux = 18
    qux + qux