Mercurial > vim
comparison src/vim9type.c @ 22419:6a9e5c087c86 v8.2.1758
patch 8.2.1758: Vim9: type of unmaterialized list is wrong
Commit: https://github.com/vim/vim/commit/5597ba046790e5ffd76dfc327d7898c56df65d3f
Author: Bram Moolenaar <Bram@vim.org>
Date: Sun Sep 27 17:45:03 2020 +0200
patch 8.2.1758: Vim9: type of unmaterialized list is wrong
Problem: Vim9: type of unmaterialized list is wrong.
Solution: Use list<number>.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sun, 27 Sep 2020 18:00:03 +0200 |
parents | 712bc35842aa |
children | 0e03ef68e738 |
comparison
equal
deleted
inserted
replaced
22418:04fb79390baf | 22419:6a9e5c087c86 |
---|---|
267 if (tv->v_type == VAR_STRING) | 267 if (tv->v_type == VAR_STRING) |
268 return &t_string; | 268 return &t_string; |
269 | 269 |
270 if (tv->v_type == VAR_LIST) | 270 if (tv->v_type == VAR_LIST) |
271 { | 271 { |
272 listitem_T *li; | 272 list_T *l = tv->vval.v_list; |
273 | 273 listitem_T *li; |
274 if (tv->vval.v_list == NULL || tv->vval.v_list->lv_first == NULL) | 274 |
275 if (l == NULL || l->lv_first == NULL) | |
275 return &t_list_empty; | 276 return &t_list_empty; |
277 if (l->lv_first == &range_list_item) | |
278 return &t_list_number; | |
276 | 279 |
277 // Use the common type of all members. | 280 // Use the common type of all members. |
278 member_type = typval2type(&tv->vval.v_list->lv_first->li_tv, type_gap); | 281 member_type = typval2type(&l->lv_first->li_tv, type_gap); |
279 for (li = tv->vval.v_list->lv_first->li_next; li != NULL; | 282 for (li = l->lv_first->li_next; li != NULL; li = li->li_next) |
280 li = li->li_next) | |
281 common_type(typval2type(&li->li_tv, type_gap), | 283 common_type(typval2type(&li->li_tv, type_gap), |
282 member_type, &member_type, type_gap); | 284 member_type, &member_type, type_gap); |
283 return get_list_type(member_type, type_gap); | 285 return get_list_type(member_type, type_gap); |
284 } | 286 } |
285 | 287 |