patch 8.2.0723: Vim9: nested constant expression not evaluated compile time
Problem: Vim9: nested constant expression not evaluated compile time.
Solution: Use compile_expr1() for parenthesis.
diff --git a/src/testdir/test_vim9_disassemble.vim b/src/testdir/test_vim9_disassemble.vim
index 724087d..610c565 100644
--- a/src/testdir/test_vim9_disassemble.vim
+++ b/src/testdir/test_vim9_disassemble.vim
@@ -1053,6 +1053,10 @@
return 2 + 3 * 4 / 6 + 7
enddef
+def s:ComputeConstParen(): number
+ return ((2 + 4) * (8 / 2)) / (3 + 4)
+enddef
+
def Test_simplify_const_expr()
let res = execute('disass s:ConcatStrings')
assert_match('\<SNR>\d*_ConcatStrings.*' ..
@@ -1065,6 +1069,12 @@
'\d PUSHNR 11.*' ..
'\d RETURN',
res)
+
+ res = execute('disass s:ComputeConstParen')
+ assert_match('\<SNR>\d*_ComputeConstParen.*' ..
+ '\d PUSHNR 3\>.*' ..
+ '\d RETURN',
+ res)
enddef
" vim: ts=8 sw=2 sts=2 expandtab tw=80 fdm=marker