unison/unison-src/transcripts/anf-tests.output.md
Greg Pfeil 0031542faf
Add a space before code block info strings
This is for consistency with the `cmark` style. Now the blocks we still
pretty-print ourselves will match the bulk of them that `cmark`
produces.
2024-07-10 13:56:07 -06:00

1005 B

This tests a variable related bug in the ANF compiler.

The nested let would get flattened out, resulting in:

bar = result

which would be handled by renaming. However, the context portion of the rest of the code was not being renamed correctly, so bar would remain in the definition of baz.

foo _ =
  id x = x
  void x = ()
  bar = let
    void (Debug.watch "hello" "hello")
    result = 5
    void (Debug.watch "goodbye" "goodbye")
    result
  baz = id bar
  baz

> !foo

  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 : ∀ _. _ -> Nat
  
  Now evaluating any watch expressions (lines starting with
  `>`)... Ctrl+C cancels.

    12 | > !foo
           ⧩
           5

scratch/main> add

  ⍟ I've added these definitions:
  
    foo : ∀ _. _ -> Nat