Fix a bug with `$it` variable decompilation
Clarification and motivation
In #1772 (closed) we started to decompile $it variable (the last computed value). But it introduced a new bug.
Take this contract
type 'a proxy = Proxy
let some_complex_variable =
{ a = 42
; b = "abc"
; c =
{ f1 = 1tz
; f2 = 28n
; f3 = (Proxy : unit proxy)
}
}
let main (_, s : unit * int) : operation list * int =
let res = some_complex_variable.a in
(([] : operation list), s + res)
The interesting part here is { f1 = 1tz; f2 = 28n; f3 = (Proxy : unit proxy) }. A compiled source for it looks like
{ /* File "test3.mligo", line 7, character 4 to line 10, character 5 */
{ /* File "test3.mligo", line 9, characters 12-17 */ UNIT } ;
{ /* File "test3.mligo", line 7, character 4 to line 10, character 5 */
{ /* File "test3.mligo", line 8, characters 11-14 */ PUSH nat 28 } ;
{ /* File "test3.mligo", line 7, characters 11-14 */ PUSH mutez 1000000 } ;
PAIR
/* File "test3.mligo", line 7, character 4 to line 10, character 5 */ } ;
PAIR
/* File "test3.mligo", line 7, character 4 to line 10, character 5 */ } ;
We're interested in /* File "test3.mligo", line 7, character 4 to line 10, character 5 */ location. With --michelson-format json it has a { f1 : mutez; f2 : nat; f3 : unit proxy } type for all locations. It means that if I try to decompile not the topmost value, I'll get a transpilation error.
As a result in the debugger, we'll see a halting $it: computing....
Acceptance criteria
- We don't have a halting
$it: computing...in the variables pane.