unisonweb / unison

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

builtins.merge doesn't roundtrip #5356

Closed ceedubs closed 1 month ago

ceedubs commented 2 months ago

Describe and demonstrate the bug

Input:

```ucm
scratch/main> builtins.merge
scratch/main> edit.namespace
scrach/main> load

Output:
scratch/main> builtins.merge

  Done.
scratch/main> edit.namespace

  ☝️

  I added 493 definitions to the top of scratch.u

  You can edit them there, then run `update` to replace the
  definitions currently in this namespace.

scrach/main> load

  Loading changes detected in scratch.u.

    ❓

    I couldn't resolve any of these symbols:

       21 |   = Blob Text

    Symbol   Suggestions

    Text     No matches

πŸ›‘

The transcript failed due to an error in the stanza above. The error is:

❓

I couldn't resolve any of these symbols:

   21 |   = Blob Text

Symbol   Suggestions

Text     No matches


**Environment (please complete the following information):**
 - `ucm --version` 2241036cb
mitchellwrosen commented 1 month ago

I don't understand what's going on here. If you perform these steps manually in ucm, you don't get this error. Why are things different via the transcript code paths?

mitchellwrosen commented 1 month ago

HOLD THE PHONE – let me know when you are holding it – the transcript has a typo:

scrach/main> load

if you replace that with scratch/main> load, it works.

What's happening is scrach/main> creates a new empty project (without builtins.merge), and then we try typechecking the output of edit.namespace against it, which fails due to Text being out of scope.

ceedubs commented 1 month ago

I know that @aryairani disagrees with me but I can't help but say that https://github.com/unisonweb/unison/issues/5173 would have caught the issue in the transcript :D