patch 8.2.4231: Vim9: map() gives type error when type was not declared
Problem: Vim9: map() gives type error when type was not declared.
Solution: Only check the type when it was declared, like extend() does.
(closes #9635)
diff --git a/src/vim9instr.c b/src/vim9instr.c
index d000c4a..e869d9e 100644
--- a/src/vim9instr.c
+++ b/src/vim9instr.c
@@ -1331,10 +1331,10 @@
if (push_type_stack(cctx, type) == FAIL)
return FAIL;
- if (maptype != NULL && maptype[0].type_curr->tt_member != NULL
- && maptype[0].type_curr->tt_member != &t_any)
+ if (maptype != NULL && maptype[0].type_decl->tt_member != NULL
+ && maptype[0].type_decl->tt_member != &t_any)
// Check that map() didn't change the item types.
- generate_TYPECHECK(cctx, maptype[0].type_curr, -1, 1);
+ generate_TYPECHECK(cctx, maptype[0].type_decl, -1, 1);
return OK;
}