2022-03-31 00:21:32 +03:00
|
|
|
|
|
|
|
```ucm:hide
|
2024-06-12 01:22:09 +03:00
|
|
|
scratch/main> builtins.merge
|
2022-03-31 00:21:32 +03:00
|
|
|
```
|
|
|
|
|
|
|
|
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`.
|
|
|
|
|
|
|
|
```unison
|
|
|
|
foo _ =
|
|
|
|
id x = x
|
2022-12-02 08:51:11 +03:00
|
|
|
void x = ()
|
2022-03-31 00:21:32 +03:00
|
|
|
bar = let
|
2022-12-02 08:51:11 +03:00
|
|
|
void (Debug.watch "hello" "hello")
|
2022-03-31 00:21:32 +03:00
|
|
|
result = 5
|
2022-12-02 08:51:11 +03:00
|
|
|
void (Debug.watch "goodbye" "goodbye")
|
2022-03-31 00:21:32 +03:00
|
|
|
result
|
|
|
|
baz = id bar
|
|
|
|
baz
|
|
|
|
|
|
|
|
> !foo
|
|
|
|
```
|
|
|
|
|
|
|
|
```ucm
|
2024-06-12 01:22:09 +03:00
|
|
|
scratch/main> add
|
2022-03-31 00:21:32 +03:00
|
|
|
```
|
|
|
|
|