0
0
mirror of https://github.com/vim/vim.git synced 2025-09-23 03:43:49 -04:00

patch 8.2.1459: Vim9: declaring script var in script does not infer the type

Problem:    Vim9: declaring ascript variable at the script level does not
            infer the type.
Solution:   Get the type from the value. (closes #6716)
This commit is contained in:
Bram Moolenaar
2020-08-15 14:31:20 +02:00
parent 9a5c553f79
commit 53b29e4845
3 changed files with 14 additions and 1 deletions

View File

@@ -3049,7 +3049,10 @@ set_var_const(
+ si->sn_var_vals.ga_len;
sv->sv_name = di->di_key;
sv->sv_tv = &di->di_tv;
sv->sv_type = type == NULL ? &t_any : type;
if (type == NULL)
sv->sv_type = typval2type(tv, &si->sn_type_list);
else
sv->sv_type = type;
sv->sv_const = (flags & LET_IS_CONST);
sv->sv_export = is_export;
++si->sn_var_vals.ga_len;