Problem: Vim9: unreachable code in assignment.
Solution: Don't check "new_local" when "has_index" is set. Add test for
wrong type of list index.
END
CheckDefFailure(lines, 'E1012: Type mismatch; expected number but got dict<unknown>', 3)
+ lines =<< trim END
+ var lines: list<string>
+ lines['a'] = 'asdf'
+ END
+ CheckDefFailure(lines, 'E39:', 2)
+
+ lines =<< trim END
+ var lines: string
+ lines[9] = 'asdf'
+ END
+ CheckDefFailure(lines, 'E1141:', 2)
+
# list of dict
var ld: list<dict<number>>
ld[0] = {}
static int included_patches[] =
{ /* Add new patch number below this line */
+/**/
+ 2139,
/**/
2138,
/**/
int r;
// Compile the "idx" in "var[idx]" or "key" in "var.key".
- if (new_local)
- --cctx->ctx_locals.ga_len;
p = var_start + varlen;
if (*p == '[')
{
r = generate_PUSHS(cctx, key);
}
- if (new_local)
- ++cctx->ctx_locals.ga_len;
if (r == FAIL)
goto theend;