patch 8.2.3065: Vim9: error when sourcing script twice and reusing function
Problem: Vim9: error when sourcing script twice and reusing a function
name.
Solution: Check if the function is dead. (closes #8463)
diff --git a/src/vim9compile.c b/src/vim9compile.c
index 46f5432..e746ea9 100644
--- a/src/vim9compile.c
+++ b/src/vim9compile.c
@@ -498,8 +498,9 @@
|| (ufunc = find_func_even_dead(p, FALSE, cctx)) != NULL)
{
// A local or script-local function can shadow a global function.
- if (ufunc == NULL || !func_is_global(ufunc)
- || (p[0] == 'g' && p[1] == ':'))
+ if (ufunc == NULL || ((ufunc->uf_flags & FC_DEAD) == 0
+ && (!func_is_global(ufunc)
+ || (p[0] == 'g' && p[1] == ':'))))
{
if (is_arg)
semsg(_(e_argument_name_shadows_existing_variable_str), p);