We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent f272ae1 commit 80ad3e2Copy full SHA for 80ad3e2
3 files changed
src/evalfunc.c
@@ -435,6 +435,7 @@ arg_extend3(type_T *type, argcontext_T *context)
435
/*
436
* Lists of functions that check the argument types of a builtin function.
437
*/
438
+argcheck_T arg1_string[] = {arg_string};
439
argcheck_T arg3_string_nr_bool[] = {arg_string, arg_number, arg_bool};
440
argcheck_T arg1_float_or_nr[] = {arg_float_or_nr};
441
argcheck_T arg2_listblob_item[] = {arg_list_or_blob, arg_item_of_prev};
@@ -1561,7 +1562,7 @@ static funcentry_T global_functions[] =
1561
1562
ret_list_number, f_srand},
1563
{"state", 0, 1, FEARG_1, NULL,
1564
ret_string, f_state},
- {"str2float", 1, 1, FEARG_1, NULL,
1565
+ {"str2float", 1, 1, FEARG_1, arg1_string,
1566
ret_float, FLOAT_FUNC(f_str2float)},
1567
{"str2list", 1, 2, FEARG_1, NULL,
1568
ret_list_number, f_str2list},
src/testdir/test_vim9_builtin.vim
@@ -916,6 +916,18 @@ def Test_split()
916
split(' aa bb ', '\W\+', true)->assert_equal(['', 'aa', 'bb', ''])
917
enddef
918
919
+def Run_str2float()
920
+ if !has('float')
921
+ MissingFeature 'float'
922
+ endif
923
+ str2float("1.00")->assert_equal(1.00)
924
+ str2float("2e-2")->assert_equal(0.02)
925
+
926
+ CheckDefFailure(['echo str2float(123)'], 'E1013:')
927
+ CheckScriptFailure(['vim9script', 'echo str2float(123)'], 'E1024:')
928
929
+enddef
930
931
def Test_str2nr()
932
str2nr("1'000'000", 10, true)->assert_equal(1000000)
933
src/version.c
@@ -750,6 +750,8 @@ static char *(features[]) =
750
751
static int included_patches[] =
752
{ /* Add new patch number below this line */
753
+/**/
754
+ 2443,
755
/**/
756
2442,
757
0 commit comments