Problem: Vim9: type error for misformed expression.
Solution: Check for end of command before checking type. (closes #7795)
CheckDefFailure(['endif'], 'E580:')
CheckDefFailure(['if g:abool', 'elseif xxx'], 'E1001:')
CheckDefFailure(['if true', 'echo 1'], 'E171:')
+
+ var lines =<< trim END
+ var s = ''
+ if s = ''
+ endif
+ END
+ CheckDefFailure(lines, 'E488:')
+
+ lines =<< trim END
+ var s = ''
+ if s == ''
+ elseif s = ''
+ endif
+ END
+ CheckDefFailure(lines, 'E488:')
enddef
let g:bool_true = v:true
CheckDefFailure(['break'], 'E587:')
CheckDefFailure(['if true', 'break'], 'E587:')
CheckDefFailure(['while 1', 'echo 3'], 'E170:')
+
+ var lines =<< trim END
+ var s = ''
+ while s = ''
+ endwhile
+ END
+ CheckDefFailure(lines, 'E488:')
enddef
def Test_interrupt_loop()
static int included_patches[] =
{ /* Add new patch number below this line */
+/**/
+ 2483,
/**/
2482,
/**/
clear_ppconst(&ppconst);
return NULL;
}
+ if (!ends_excmd2(arg, skipwhite(p)))
+ {
+ semsg(_(e_trailing_arg), p);
+ return NULL;
+ }
if (cctx->ctx_skip == SKIP_YES)
clear_ppconst(&ppconst);
else if (instr->ga_len == instr_count && ppconst.pp_used == 1)
return NULL;
}
cctx->ctx_skip = save_skip;
+ if (!ends_excmd2(arg, skipwhite(p)))
+ {
+ semsg(_(e_trailing_arg), p);
+ return NULL;
+ }
if (scope->se_skip_save == SKIP_YES)
clear_ppconst(&ppconst);
else if (instr->ga_len == instr_count && ppconst.pp_used == 1)
// compile "expr"
if (compile_expr0(&p, cctx) == FAIL)
return NULL;
+ if (!ends_excmd2(arg, skipwhite(p)))
+ {
+ semsg(_(e_trailing_arg), p);
+ return NULL;
+ }
if (bool_on_stack(cctx) == FAIL)
return FAIL;