unisonweb / unison

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

Problem adding documentation when there is a todo #5354

Open dvberkel opened 2 months ago

dvberkel commented 2 months ago

I discovered a ucm behavior that surprised me. I can reproduce in the following manner:

  1. Create new project.
  2. Open a scratch file.
  3. Create a watch expression > todo "This will fail"
  4. Create a definition answer = 42
  5. Save the file, the definition is marked as new
  6. Add it to the code base

Step six fails with a message that there is nothing to add.

  Loading changes detected in ~/orgs/unisonlanguage/scratch.u.

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

    ⍟ These new definitions are ok to `add`:

      answer : Nat

  Now evaluating any watch expressions (lines starting with `>`)... Ctrl+C cancels.

  💔💥

  I've encountered a call to builtin.todo with the following value:

    "This will fail"

  Stack trace:
    todo
    #1ogehb3tt5

todo-problem/main> add

  😶

  There's nothing for me to add right now.

  Hint: I'm currently watching for definitions in .u files under the ~/orgs/unisonlanguage
        directory. Make sure you've updated something there before using the `add` or `update`
        commands, or use `load` to load a file explicitly.

My expectation would be that the definition would be added to the code base

Environment (please complete the following information):

Additional context The problem was also discussed on Discord

aryairani commented 2 months ago

Internal note: Maybe the runtime error interrupted the action that would set the typecheckedUF state; should be an easy fix.