Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Value.value can't be used in a pure test #5538

Open
ceedubs opened this issue Jan 14, 2025 · 3 comments
Open

Value.value can't be used in a pure test #5538

ceedubs opened this issue Jan 14, 2025 · 3 comments
Labels

Comments

@ceedubs
Copy link
Contributor

ceedubs commented Jan 14, 2025

The Value.value builtin can't be used in a test. Is this intended? It doesn't declare the IO ability, but the error message indicates that it is performing IO.

fresh/main> builtins.merge

  Done.
foo : [Test.Result]
foo =
  _ = Value.value 3
  [Result.Ok "passed"]
  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`:
    
      foo : [Result]
fresh/main> add

  ⍟ I've added these definitions:

    foo : [Result]
fresh/main> test

🛑

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

💔💥

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

  "pure code can't perform I/O"

Stack trace:
  builtin.bug
  #iqsghdla6m

Environment (please complete the following information):

  • ucm --version 0.5.31
@ceedubs ceedubs added the bug label Jan 14, 2025
@aryairani
Copy link
Contributor

aryairani commented Jan 14, 2025

Here's the spot where that's defined.

("Value.value", (Tracked, value'create)),

@ceedubs
Copy link
Contributor Author

ceedubs commented Jan 14, 2025

I'm not sure whether the right fix is to change Value.value to not be Tracked or to keep it Tracked but allow it in the test/doc sandboxes. The latter seems like the safer change.

@pchiusano
Copy link
Member

Probably the latter.

This should be allowed within Unison Cloud’s sandbox as well, it’s useful sometimes if you’re doing custom hashing or serialization of generic values.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants