fix(tvix/eval): handle thunks in arithmetic builtins
The simplest solution seems to be to pass references to arithmetic_op!() which avoids the moving annoyance we had to deal with in the builtins (no more popping!). We then use .force() to force the values and dereference any Thunks (which arithmetic_op! doesn't do for us). Change-Id: I0eb8ad60e80a0b3ba9d9f411e973ef8bcf136989 Reviewed-on: https://cl.tvl.fyi/c/depot/+/6724 Tested-by: BuildkiteCI Reviewed-by: wpcarro <wpcarro@gmail.com> Reviewed-by: tazjin <tazjin@tvl.su>
This commit is contained in:
parent
55459f02fc
commit
64d3efcc2c
10 changed files with 32 additions and 28 deletions
|
|
@ -1 +1 @@
|
|||
[ 18 18.9 18.9 19.1 19 ]
|
||||
[ 18 18.9 18.9 19.1 19 42 ]
|
||||
|
|
|
|||
|
|
@ -4,4 +4,5 @@
|
|||
(builtins.add 7 11.9)
|
||||
(builtins.add 7.2 11.9)
|
||||
(builtins.add 7.1 11.9)
|
||||
(builtins.add (builtins.add 21 10) 11)
|
||||
]
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
[ 3 7 0 1 0 0.5 0.5 0.5 ]
|
||||
[ 3 7 0 1 0 0.5 0.5 0.5 42 ]
|
||||
|
|
|
|||
|
|
@ -7,4 +7,5 @@
|
|||
(builtins.div 1.0 2)
|
||||
(builtins.div 1 2.0)
|
||||
(builtins.div 1.0 2.0)
|
||||
(builtins.div (builtins.div 84 4) 0.5)
|
||||
]
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
[ 36 0 0 14 ]
|
||||
[ 36 0 0 14 42 ]
|
||||
|
|
|
|||
|
|
@ -3,4 +3,5 @@
|
|||
(builtins.mul 0 7)
|
||||
(builtins.mul 7 0)
|
||||
(builtins.mul 7 2)
|
||||
(builtins.mul (builtins.mul 4 0.5) 21)
|
||||
]
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
[ -4 -3.1 -4.9 -4.7 -4 ]
|
||||
[ -4 -3.1 -4.9 -4.7 -4 42 ]
|
||||
|
|
|
|||
|
|
@ -4,4 +4,5 @@
|
|||
(builtins.sub 7 11.9)
|
||||
(builtins.sub 7.2 11.9)
|
||||
(builtins.sub 7.9 11.9)
|
||||
(builtins.sub (builtins.sub 123 23) 58)
|
||||
]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue