Mercurial > vim
diff src/testdir/test_vim9_func.vim @ 21281:13b1567ae0c6 v8.2.1191
patch 8.2.1191: Vim9: crash when function calls itself
Commit: https://github.com/vim/vim/commit/985116ae0b7b3ef17e0c0ea2669068dd6b3b39c7
Author: Bram Moolenaar <Bram@vim.org>
Date: Sun Jul 12 17:31:09 2020 +0200
patch 8.2.1191: Vim9: crash when function calls itself
Problem: Vim9: crash when function calls itself.
Solution: Add status UF_COMPILING. (closes https://github.com/vim/vim/issues/6441)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sun, 12 Jul 2020 17:45:04 +0200 |
parents | 6a4806e326dd |
children | 60011b87aae1 |
line wrap: on
line diff
--- a/src/testdir/test_vim9_func.vim +++ b/src/testdir/test_vim9_func.vim @@ -999,5 +999,17 @@ func Test_silent_echo() call delete('XTest_silent_echo') endfunc +def Fibonacci(n: number): number + if n < 2 + return n + else + return Fibonacci(n - 1) + Fibonacci(n - 2) + endif +enddef + +def Test_recursive_call() + assert_equal(6765, Fibonacci(20)) +enddef + " vim: ts=8 sw=2 sts=2 expandtab tw=80 fdm=marker