From: Bram Moolenaar Date: Thu, 14 May 2020 21:20:55 +0000 (+0200) Subject: patch 8.2.0754: Vim9: No test for forward declaration X-Git-Tag: v8.2.0754 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=a5d0077efbced85fcc63f203937b13efd55d036f;p=vim patch 8.2.0754: Vim9: No test for forward declaration Problem: Vim9: No test for forward declaration. Solution: Add a test. --- diff --git a/src/testdir/test_vim9_script.vim b/src/testdir/test_vim9_script.vim index c528b8009..6b6228e5e 100644 --- a/src/testdir/test_vim9_script.vim +++ b/src/testdir/test_vim9_script.vim @@ -1732,6 +1732,7 @@ def Test_let_func_call() END writefile(lines, 'Xfinished') source Xfinished + " GetValue() is not called during discovery phase assert_equal(1, g:count) unlet g:count @@ -1752,6 +1753,28 @@ def Test_let_missing_type() delete('Xfinished') enddef +def Test_forward_declaration() + let lines =<< trim END + vim9script + g:initVal = GetValue() + def GetValue(): string + return theVal + enddef + let theVal = 'something' + theVal = 'else' + g:laterVal = GetValue() + END + writefile(lines, 'Xforward') + source Xforward + assert_equal('something', g:initVal) + assert_equal('else', g:laterVal) + + unlet g:initVal + unlet g:laterVal + delete('Xforward') +enddef + + " Keep this last, it messes up highlighting. def Test_substitute_cmd() new diff --git a/src/version.c b/src/version.c index ad56b7af1..8ff5161e7 100644 --- a/src/version.c +++ b/src/version.c @@ -746,6 +746,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 754, /**/ 753, /**/