Mercurial > vim
comparison src/vim9execute.c @ 31551:67d9fbe516a3 v9.0.1108
patch 9.0.1108: type error when using "any" type and adding to float
Commit: https://github.com/vim/vim/commit/c6951a76a58663ef8a773d340f2260da7455643c
Author: Bram Moolenaar <Bram@vim.org>
Date: Thu Dec 29 20:56:24 2022 +0000
patch 9.0.1108: type error when using "any" type and adding to float
Problem: Type error when using "any" type and adding a number to a float.
Solution: Accept both a number and a float. (closes https://github.com/vim/vim/issues/11753)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Thu, 29 Dec 2022 22:00:04 +0100 |
parents | 065e4ccf5e10 |
children | fc9ce07dc8a4 |
comparison
equal
deleted
inserted
replaced
31550:aadc3446d666 | 31551:67d9fbe516a3 |
---|---|
6870 case ISN_NEGATENR: smsg("%s%4d NEGATENR", pfx, current); break; | 6870 case ISN_NEGATENR: smsg("%s%4d NEGATENR", pfx, current); break; |
6871 | 6871 |
6872 case ISN_CHECKTYPE: | 6872 case ISN_CHECKTYPE: |
6873 { | 6873 { |
6874 checktype_T *ct = &iptr->isn_arg.type; | 6874 checktype_T *ct = &iptr->isn_arg.type; |
6875 char *tofree; | 6875 char *tofree = NULL; |
6876 char *typename; | |
6877 | |
6878 if (ct->ct_type->tt_type == VAR_FLOAT | |
6879 && (ct->ct_type->tt_flags & TTFLAG_NUMBER_OK)) | |
6880 typename = "float|number"; | |
6881 else | |
6882 typename = type_name(ct->ct_type, &tofree); | |
6876 | 6883 |
6877 if (ct->ct_arg_idx == 0) | 6884 if (ct->ct_arg_idx == 0) |
6878 smsg("%s%4d CHECKTYPE %s stack[%d]", pfx, current, | 6885 smsg("%s%4d CHECKTYPE %s stack[%d]", pfx, current, |
6879 type_name(ct->ct_type, &tofree), | 6886 typename, |
6880 (int)ct->ct_off); | 6887 (int)ct->ct_off); |
6881 else | 6888 else |
6882 smsg("%s%4d CHECKTYPE %s stack[%d] %s %d", | 6889 smsg("%s%4d CHECKTYPE %s stack[%d] %s %d", |
6883 pfx, current, | 6890 pfx, current, |
6884 type_name(ct->ct_type, &tofree), | 6891 typename, |
6885 (int)ct->ct_off, | 6892 (int)ct->ct_off, |
6886 ct->ct_is_var ? "var": "arg", | 6893 ct->ct_is_var ? "var": "arg", |
6887 (int)ct->ct_arg_idx); | 6894 (int)ct->ct_arg_idx); |
6888 vim_free(tofree); | 6895 vim_free(tofree); |
6889 break; | 6896 break; |