diff options
author | Bram Moolenaar <Bram@vim.org> | 2021-04-03 21:01:01 +0200 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2021-04-03 21:01:01 +0200 |
commit | 77709b194c71eb02f765521f31b463593bd07cda (patch) | |
tree | feb265fa3dcd95f50f63948cbb829c01ffbe6089 /src/vim9compile.c | |
parent | 440cf096fad7bf628974abc344343b823d79a006 (diff) | |
download | vim-git-77709b194c71eb02f765521f31b463593bd07cda.tar.gz |
patch 8.2.2705: Vim9: misleading reported line number for wrong typev8.2.2705
Problem: Vim9: misleading reported line number for wrong type.
Solution: Remember and use the line number at the start. (closes #8059)
Diffstat (limited to 'src/vim9compile.c')
-rw-r--r-- | src/vim9compile.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/vim9compile.c b/src/vim9compile.c index 3fb4a8d20..4d702d4f9 100644 --- a/src/vim9compile.c +++ b/src/vim9compile.c @@ -6166,6 +6166,7 @@ compile_assignment(char_u *arg, exarg_T *eap, cmdidx_T cmdidx, cctx_T *cctx) char_u *sp; int is_decl = is_decl_command(cmdidx); lhs_T lhs; + long start_lnum = SOURCING_LNUM; // Skip over the "var" or "[var, var]" to get to any "=". p = skip_var_list(arg, TRUE, &var_count, &semicolon, TRUE); @@ -6393,7 +6394,9 @@ compile_assignment(char_u *arg, exarg_T *eap, cmdidx_T cmdidx, cctx_T *cctx) { type_T *use_type = lhs.lhs_lvar->lv_type; - // without operator check type here, otherwise below + // Without operator check type here, otherwise below. + // Use the line number of the assignment. + SOURCING_LNUM = start_lnum; if (lhs.lhs_has_index) use_type = lhs.lhs_member_type; if (need_type(rhs_type, use_type, -1, 0, cctx, |