To: vim_dev@googlegroups.com Subject: Patch 8.2.2580 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.2.2580 Problem: Vim9: checking vararg type is wrong when function is auto-loaded. Solution: Use the member type. (closes #7933) Files: src/vim9execute.c, src/testdir/test_vim9_script.vim *** ../vim-8.2.2579/src/vim9execute.c 2021-03-06 19:26:42.431369337 +0100 --- src/vim9execute.c 2021-03-08 21:45:26.372937901 +0100 *************** *** 807,815 **** // types are correct. for (i = 0; i < argcount; ++i) { ! type_T *type = i < ufunc->uf_args.ga_len ! ? ufunc->uf_arg_types[i] : ufunc->uf_va_type; if (type != NULL && check_typval_arg_type(type, &argv[i], i + 1) == FAIL) return FAIL; --- 807,818 ---- // types are correct. for (i = 0; i < argcount; ++i) { ! type_T *type = NULL; + if (i < ufunc->uf_args.ga_len) + type = ufunc->uf_arg_types[i]; + else if (ufunc->uf_va_type != NULL) + type = ufunc->uf_va_type->tt_member; if (type != NULL && check_typval_arg_type(type, &argv[i], i + 1) == FAIL) return FAIL; *** ../vim-8.2.2579/src/testdir/test_vim9_script.vim 2021-03-04 12:38:17.387440049 +0100 --- src/testdir/test_vim9_script.vim 2021-03-08 21:44:24.157115841 +0100 *************** *** 3154,3159 **** --- 3154,3163 ---- return 'test' enddef g:some#name = 'name' + + def some#varargs(a1: string, ...l: list): string + return a1 .. l[0] .. l[1] + enddef END mkdir('Xdir/autoload', 'p') *************** *** 3166,3171 **** --- 3170,3177 ---- g:some#other = 'other' assert_equal('other', g:some#other) + assert_equal('abc', some#varargs('a', 'b', 'c')) + # upper case script name works lines =<< trim END vim9script *** ../vim-8.2.2579/src/version.c 2021-03-08 20:47:09.733874887 +0100 --- src/version.c 2021-03-08 21:41:54.681557774 +0100 *************** *** 752,753 **** --- 752,755 ---- { /* Add new patch number below this line */ + /**/ + 2580, /**/ -- FIRST SOLDIER: So they wouldn't be able to bring a coconut back anyway. SECOND SOLDIER: Wait a minute! Suppose two swallows carried it together? FIRST SOLDIER: No, they'd have to have it on a line. "Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ \\\ an exciting new programming language -- http://www.Zimbu.org /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///