Compare commits

...

13 Commits

Author SHA1 Message Date
Bram Moolenaar
27f4f6baee patch 8.2.1998: terminal Cmd test sometimes fails to close popup
Problem:    Terminal Cmd test sometimes fails to close popup.
Solution:   Add "term_finish" option.
2020-11-16 21:02:28 +01:00
Bram Moolenaar
8adc8d9b73 patch 8.2.1997: window changes when using bufload() while in a terminal popup
Problem:    Window changes when using bufload() while in a terminal popup.
Solution:   When searching for a window by ID also find a popup window.
            (closes #7307)
2020-11-16 20:47:31 +01:00
Bram Moolenaar
193f6201b4 patch 8.2.1996: Vim9: invalid error for argument of extend()
Problem:    Vim9: invalid error for argument of extend().
Solution:   Check if the type could match. (closes #7299)
2020-11-16 20:08:35 +01:00
Bram Moolenaar
714cbe5b21 patch 8.2.1995: the popup menu can cause too much redrawing
Problem:    The popup menu can cause too much redrawing.
Solution:   Reduce the length of the displayed text. (Yasuhiro Matsumoto,
            closes #7306)
2020-11-16 19:12:00 +01:00
Bram Moolenaar
c4390fe6c0 patch 8.2.1994: MS-Windows: MinGW always does a full build
Problem:    MS-Windows: MinGW always does a full build.
Solution:   Only check if $OUTDIR exists. (Masamichi Abe, closes #7311)
2020-11-16 18:49:47 +01:00
Bram Moolenaar
50dc3ecc64 patch 8.2.1993: occasional failure of the netbeans test
Problem:    Occasional failure of the netbeans test.
Solution:   Add "silent!". (Yegappan Lakshmanan, closes #7304)
2020-11-16 18:39:43 +01:00
Bram Moolenaar
4792a679f9 patch 8.2.1992: build fails with small features
Problem:    Build fails with small features.
Solution:   Add #ifdef.
2020-11-15 21:11:18 +01:00
Bram Moolenaar
ca359cbedd patch 8.2.1991: Coverity warns for not using the ga_grow() return value
Problem:    Coverity warns for not using the ga_grow() return value.
Solution:   Bail out if ga_grow() fails. (Yegappan Lakshmanan, closes #7303)
2020-11-15 20:49:41 +01:00
Bram Moolenaar
6a07644db3 patch 8.2.1990: cursor position wrong in terminal popup with finished job
Problem:    Cursor position wrong in terminal popup with finished job.
Solution:   Only add the top and left offset when not done already.
            (closes #7298)
2020-11-15 20:32:58 +01:00
Bram Moolenaar
2dfae04f37 patch 8.2.1989: info popup triggers WinEnter and WinLeave autocommands
Problem:    Info popup triggers WinEnter and WinLeave autocommands.
Solution:   Suppress autocommands for the info popup. (closes #7296)
2020-11-15 14:09:37 +01:00
Bram Moolenaar
e41decc892 patch 8.2.1988: still in Insert mode when opening terminal popup
Problem:    Still in Insert mode when opening terminal popup with a <Cmd>
            mapping in Insert mode.
Solution:   Exit Insert mode. (closes #7295)
2020-11-14 21:34:59 +01:00
Bram Moolenaar
6453cc8078 patch 8.2.1987: MS-Windows: Win32.mak is no longer needed
Problem:    MS-Windows: Win32.mak is no longer needed.
Solution:   Do not include Win32.mak. (Jason McHugh, closes #7290)
2020-11-14 21:04:33 +01:00
Bram Moolenaar
a065a14115 patch 8.2.1986: expression test is flaky on Appveyor
Problem:    Expression test is flaky on Appveyor.
Solution:   Temporarily disable the test in MS-Windows.
2020-11-14 20:57:20 +01:00
24 changed files with 204 additions and 66 deletions

View File

@@ -264,11 +264,6 @@ For building 64 bit binaries you also need to install the SDK:
"Microsoft Windows SDK for Windows 7 and .NET Framework 3.5 SP1"
You don't need the examples and documentation.
If you get an error that Win32.mak can't be found, you have to set the
variable SDK_INCLUDE_DIR. For example, on Windows 10, installation of MSVC
puts include files in the following directory:
set SDK_INCLUDE_DIR=C:\Program Files\Microsoft SDKs\Windows\v6.0A\Include
2. MSYS2 with MinGW
===================

View File

@@ -1055,23 +1055,23 @@ install.exe: dosinst.c dosinst.h version.h
uninstall.exe: uninstall.c dosinst.h version.h
$(CC) $(CFLAGS) -o uninstall.exe uninstall.c $(LIB) -lole32
$(OBJ): $(OUTDIR)
$(OBJ): | $(OUTDIR)
$(EXEOBJG): $(OUTDIR)
$(EXEOBJG): | $(OUTDIR)
$(EXEOBJC): $(OUTDIR)
$(EXEOBJC): | $(OUTDIR)
ifeq ($(VIMDLL),yes)
$(TARGET): $(OUTDIR) $(OBJ)
$(TARGET): $(OBJ)
$(LINK) $(CFLAGS) $(LFLAGS) -o $@ $(OBJ) $(LIB) -lole32 -luuid -lgdi32 $(LUA_LIB) $(MZSCHEME_LIBDIR) $(MZSCHEME_LIB) $(PYTHONLIB) $(PYTHON3LIB) $(RUBYLIB)
$(GVIMEXE): $(OUTDIR) $(EXEOBJG) $(VIMDLLBASE).dll
$(GVIMEXE): $(EXEOBJG) $(VIMDLLBASE).dll
$(CC) -L. $(EXELFLAGS) -mwindows -o $@ $(EXEOBJG) -l$(VIMDLLBASE)
$(VIMEXE): $(OUTDIR) $(EXEOBJC) $(VIMDLLBASE).dll
$(VIMEXE): $(EXEOBJC) $(VIMDLLBASE).dll
$(CC) -L. $(EXELFLAGS) -o $@ $(EXEOBJC) -l$(VIMDLLBASE)
else
$(TARGET): $(OUTDIR) $(OBJ)
$(TARGET): $(OBJ)
$(LINK) $(CFLAGS) $(LFLAGS) -o $@ $(OBJ) $(LIB) -lole32 -luuid $(LUA_LIB) $(MZSCHEME_LIBDIR) $(MZSCHEME_LIB) $(PYTHONLIB) $(PYTHON3LIB) $(RUBYLIB)
endif
@@ -1286,7 +1286,7 @@ $(OUTDIR)/%.o : xdiff/%.c $(XDIFF_DEPS)
$(CC) -c $(CFLAGS) $< -o $@
$(PATHDEF_SRC): $(OUTDIR) Make_cyg_ming.mak Make_cyg.mak Make_ming.mak
$(PATHDEF_SRC): Make_cyg_ming.mak Make_cyg.mak Make_ming.mak | $(OUTDIR)
ifneq (sh.exe, $(SHELL))
@echo creating $(PATHDEF_SRC)
@echo '/* pathdef.c */' > $(PATHDEF_SRC)

View File

@@ -15,11 +15,7 @@
# This will build the console version of Vim with no additional interfaces.
# To add features, define any of the following:
#
# For MSVC 11, if you want to include Win32.mak, you need to specify
# where the file is, e.g.:
# SDK_INCLUDE_DIR="C:\Program Files\Microsoft SDKs\Windows\v7.1\Include"
#
# !!!! After changing features do "nmake clean" first !!!!
# !!!! After changing any features do "nmake clean" first !!!!
#
# Feature Set: FEATURES=[TINY, SMALL, NORMAL, BIG, HUGE] (default is HUGE)
#
@@ -209,9 +205,6 @@ OBJDIR = $(OBJDIR)V
OBJDIR = $(OBJDIR)d
!endif
# If you include Win32.mak, it requires that CPU be set appropriately.
# To cross-compile for Win64, set CPU=AMD64 or CPU=IA64.
!ifdef PROCESSOR_ARCHITECTURE
# We're on Windows NT or using VC 6+
! ifdef CPU
@@ -251,18 +244,7 @@ NODEBUG = 1
MAKEFLAGS_GVIMEXT = DEBUG=yes
!endif
# Get all sorts of useful, standard macros from the Platform SDK,
# if SDK_INCLUDE_DIR is set or USE_WIN32MAK is set to "yes".
!ifdef SDK_INCLUDE_DIR
! include $(SDK_INCLUDE_DIR)\Win32.mak
!elseif "$(USE_WIN32MAK)"=="yes"
! include <Win32.mak>
!else
link = link
!endif
# Check VC version.
!if [echo MSVCVER=_MSC_VER> msvcver.c && $(CC) /EP msvcver.c > msvcver.~ 2> nul]

View File

@@ -2455,6 +2455,7 @@ win_line(
wp->w_wrow = row;
did_wcol = TRUE;
curwin->w_valid |= VALID_WCOL|VALID_WROW|VALID_VIRTCOL;
curwin->w_flags &= ~(WFLAG_WCOL_OFF_ADDED | WFLAG_WROW_OFF_ADDED);
}
#endif

View File

@@ -1033,6 +1033,11 @@ doESCkey:
case K_COMMAND: // <Cmd>command<CR>
do_cmdline(NULL, getcmdkeycmd, NULL, 0);
#ifdef FEAT_TERMINAL
if (term_use_loop())
// Started a terminal that gets the input, exit Insert mode.
goto doESCkey;
#endif
break;
case K_CURSORHOLD: // Didn't type something for a while.

View File

@@ -295,7 +295,7 @@ arg_float_or_nr(type_T *type, argcontext_T *context)
static int
arg_number(type_T *type, argcontext_T *context)
{
return check_type(&t_number, type, TRUE, context->arg_idx + 1);
return check_arg_type(&t_number, type, context->arg_idx + 1);
}
/*
@@ -304,7 +304,7 @@ arg_number(type_T *type, argcontext_T *context)
static int
arg_string(type_T *type, argcontext_T *context)
{
return check_type(&t_string, type, TRUE, context->arg_idx + 1);
return check_arg_type(&t_string, type, context->arg_idx + 1);
}
/*
@@ -342,7 +342,7 @@ arg_same_as_prev(type_T *type, argcontext_T *context)
{
type_T *prev_type = context->arg_types[context->arg_idx - 1];
return check_type(prev_type, type, TRUE, context->arg_idx + 1);
return check_arg_type(prev_type, type, context->arg_idx + 1);
}
/*
@@ -363,7 +363,7 @@ arg_item_of_prev(type_T *type, argcontext_T *context)
// probably VAR_ANY, can't check
return OK;
return check_type(expected, type, TRUE, context->arg_idx + 1);
return check_arg_type(expected, type, context->arg_idx + 1);
}
/*

View File

@@ -3645,7 +3645,11 @@ getcmdkeycmd(
got_int = FALSE;
while (c1 != NUL && !aborted)
{
ga_grow(&line_ga, 32);
if (ga_grow(&line_ga, 32) != OK)
{
aborted = TRUE;
break;
}
if (vgetorpeek(FALSE) == NUL)
{

View File

@@ -868,6 +868,9 @@ validate_cursor_col(void)
curwin->w_wcol = col;
curwin->w_valid |= VALID_WCOL;
#ifdef FEAT_PROP_POPUP
curwin->w_flags &= ~WFLAG_WCOL_OFF_ADDED;
#endif
}
}
@@ -1180,7 +1183,10 @@ curs_columns(
{
curwin->w_wrow += popup_top_extra(curwin);
curwin->w_wcol += popup_left_extra(curwin);
curwin->w_flags |= WFLAG_WCOL_OFF_ADDED + WFLAG_WROW_OFF_ADDED;
}
else
curwin->w_flags &= ~(WFLAG_WCOL_OFF_ADDED + WFLAG_WROW_OFF_ADDED);
#endif
// now w_leftcol is valid, avoid check_cursor_moved() thinking otherwise

View File

@@ -361,6 +361,8 @@ pum_display(
// redo the positioning. Limit this to two times, when there is not
// much room the window size will keep changing.
} while (pum_set_selected(selected, redo_count) && ++redo_count <= 2);
pum_redraw();
}
/*
@@ -541,8 +543,23 @@ pum_redraw(void)
{
if (st != NULL)
{
screen_puts_len(st, (int)STRLEN(st), row, col,
attr);
int size = (int)STRLEN(st);
int cells = (*mb_string2cells)(st, size);
// only draw the text that fits
while (size > 0
&& col + cells > pum_width + pum_col)
{
--size;
if (has_mbyte)
{
size -= (*mb_head_off)(st, st + size);
cells -= (*mb_ptr2cells)(st + size);
}
else
--cells;
}
screen_puts_len(st, size, row, col, attr);
vim_free(st);
}
col += width;
@@ -795,6 +812,10 @@ pum_set_selected(int n, int repeat UNUSED)
use_popup = USEPOPUP_NORMAL;
else
use_popup = USEPOPUP_NONE;
if (use_popup != USEPOPUP_NONE)
// don't use WinEnter or WinLeave autocommands for the info
// popup
block_autocmds();
# endif
// Open a preview window and set "curwin" to it.
// 3 lines by default, prefer 'previewheight' if set and smaller.
@@ -972,6 +993,10 @@ pum_set_selected(int n, int repeat UNUSED)
if (WIN_IS_POPUP(curwin))
// can't keep focus in a popup window
win_enter(firstwin, TRUE);
# endif
# ifdef FEAT_PROP_POPUP
if (use_popup != USEPOPUP_NONE)
unblock_autocmds();
# endif
}
#endif
@@ -982,9 +1007,6 @@ pum_set_selected(int n, int repeat UNUSED)
popup_hide_info();
#endif
if (!resized)
pum_redraw();
return resized;
}

View File

@@ -3743,13 +3743,17 @@ update_popups(void (*win_update)(win_T *wp))
wp->w_winrow -= top_off;
wp->w_wincol -= left_extra;
// cursor position matters in terminal in job mode
#ifdef FEAT_TERMINAL
if (wp != curwin || !term_in_normal_mode())
#endif
// Add offset for border and padding if not done already.
if ((wp->w_flags & WFLAG_WCOL_OFF_ADDED) == 0)
{
wp->w_wcol += left_extra;
wp->w_flags |= WFLAG_WCOL_OFF_ADDED;
}
if ((wp->w_flags & WFLAG_WROW_OFF_ADDED) == 0)
{
wp->w_wrow += top_off;
wp->w_wcol += left_extra;
wp->w_flags |= WFLAG_WROW_OFF_ADDED;
}
total_width = popup_width(wp);

View File

@@ -1,6 +1,7 @@
/* vim9compile.c */
int check_defined(char_u *p, size_t len, cctx_T *cctx);
int check_compare_types(exptype_T type, typval_T *tv1, typval_T *tv2);
int use_typecheck(type_T *actual, type_T *expected);
int get_script_item_idx(int sid, char_u *name, int check_writable, cctx_T *cctx);
imported_T *find_imported(char_u *name, size_t len, cctx_T *cctx);
imported_T *find_imported_in_script(char_u *name, size_t len, int sid);

View File

@@ -15,6 +15,7 @@ int check_typval_type(type_T *expected, typval_T *actual_tv, int argidx);
void type_mismatch(type_T *expected, type_T *actual);
void arg_type_mismatch(type_T *expected, type_T *actual, int argidx);
int check_type(type_T *expected, type_T *actual, int give_msg, int argidx);
int check_arg_type(type_T *expected, type_T *actual, int argidx);
char_u *skip_type(char_u *start, int optional);
type_T *parse_type(char_u **arg, garray_T *type_gap);
void common_type(type_T *type1, type_T *type2, type_T **dest, garray_T *type_gap);

View File

@@ -3348,6 +3348,10 @@ struct window_S
// top of the window
char w_topline_was_set; // flag set to TRUE when topline is set,
// e.g. by winrestview()
linenr_T w_botline; // number of the line below the bottom of
// the window
#ifdef FEAT_DIFF
int w_topfill; // number of filler lines above w_topline
int w_old_topfill; // w_topfill at last redraw
@@ -3361,6 +3365,12 @@ struct window_S
colnr_T w_skipcol; // starting column when a single line
// doesn't fit in the window
int w_empty_rows; // number of ~ rows in window
#ifdef FEAT_DIFF
int w_filler_rows; // number of filler rows at the end of the
// window
#endif
/*
* Layout of the window in the screen.
* May need to add "msg_scrolled" to "w_winrow" in rare situations.
@@ -3368,11 +3378,14 @@ struct window_S
int w_winrow; // first row of window in screen
int w_height; // number of rows in window, excluding
// status/command/winbar line(s)
int w_status_height; // number of status lines (0 or 1)
int w_wincol; // Leftmost column of window in screen.
int w_width; // Width of window, excluding separation.
int w_vsep_width; // Number of separator columns (0 or 1).
pos_save_T w_save_cursor; // backup of cursor pos and topline
#ifdef FEAT_PROP_POPUP
int w_popup_flags; // POPF_ values
int w_popup_handled; // POPUP_HANDLE[0-9] flags
@@ -3433,8 +3446,14 @@ struct window_S
# if defined(FEAT_TIMERS)
timer_T *w_popup_timer; // timer for closing popup window
# endif
#endif
int w_flags; // WFLAG_ flags
# define WFLAG_WCOL_OFF_ADDED 1 // popup border and padding were added to
// w_wcol
# define WFLAG_WROW_OFF_ADDED 2 // popup border and padding were added to
// w_wrow
#endif
/*
* === start of cached values ====
@@ -3475,14 +3494,6 @@ struct window_S
*/
int w_wrow, w_wcol; // cursor position in window
linenr_T w_botline; // number of the line below the bottom of
// the window
int w_empty_rows; // number of ~ rows in window
#ifdef FEAT_DIFF
int w_filler_rows; // number of filler rows at the end of the
// window
#endif
/*
* Info about the lines currently in the window is remembered to avoid
* recomputing it every time. The allocated size of w_lines[] is Rows.

View File

@@ -2208,7 +2208,10 @@ position_cursor(win_T *wp, VTermPos *pos, int add_off UNUSED)
{
wp->w_wrow += popup_top_extra(curwin);
wp->w_wcol += popup_left_extra(curwin);
wp->w_flags |= WFLAG_WCOL_OFF_ADDED | WFLAG_WROW_OFF_ADDED;
}
else
wp->w_flags &= ~(WFLAG_WCOL_OFF_ADDED | WFLAG_WROW_OFF_ADDED);
#endif
wp->w_valid |= (VALID_WCOL|VALID_WROW);
}

View File

@@ -5,8 +5,8 @@
|4| @24|╔+0#0000001#ffd7ff255|═@19|╗| +0#0000000#ffffff0@26
|5| @24|║+0#0000001#ffd7ff255|a|n|o|t|h|e|r| |t|e|x|t| @7|║| +0#0000000#ffffff0@26
|6| @24|║+0#0000001#ffd7ff255|t|o| |s|h|o|w| @12|║| +0#0000000#ffffff0@26
|7| @24|║+0#0000001#ffd7ff255|i|n| |a| |p|o|p|u|p| |w|i|n|d|o|w| @2|║| +0#0000000#ffffff0@26
|8| @24|║+0#0000001#ffd7ff255| +0#4040ff13&> @18|║+0#0000001&| +0#0000000#ffffff0@26
|7| @24|║+0#0000001#ffd7ff255>i|n| |a| |p|o|p|u|p| |w|i|n|d|o|w| @2|║| +0#0000000#ffffff0@26
|8| @24|║+0#0000001#ffd7ff255| +0#4040ff13&@19|║+0#0000001&| +0#0000000#ffffff0@26
|9| @24|║+0#0000001#ffd7ff255| +0#4040ff13&@19|║+0#0000001&| +0#0000000#ffffff0@26
|1|0| @23|╚+0#0000001#ffd7ff255|═@19|╝| +0#0000000#ffffff0@26
|1@1| @72

View File

@@ -36,7 +36,7 @@ func ReadXnetbeans()
let l = readfile("Xnetbeans")
" Xnetbeans may include '0:geometry=' messages in the GUI Vim if the window
" position, size, or z order are changed. Remove these messages because
" these message will break the assert for the output.
" these messages will break the assert for the output.
return filter(l, 'v:val !~ "^0:geometry="')
endfunc
@@ -927,7 +927,7 @@ endfunc
" error.
func Test_nb_bwipe_buffer()
call s:run_server('Nb_bwipe_buffer')
%bwipe!
silent! %bwipe!
sleep 100m
nbclose
endfunc

View File

@@ -3243,6 +3243,10 @@ func Get_popupmenu_lines()
call popup_show(id)
endif
endfunc
" Check that no autocommands are triggered for the info popup
au WinEnter * if win_gettype() == 'popup' | call setline(2, 'WinEnter') | endif
au WinLeave * if win_gettype() == 'popup' | call setline(2, 'WinLeave') | endif
END
return lines
endfunc

View File

@@ -1237,6 +1237,40 @@ func Test_terminal_popup_with_cmd()
unlet s:winid
endfunc
func Test_terminal_popup_bufload()
let termbuf = term_start(&shell, #{hidden: v:true, term_finish: 'close'})
let winid = popup_create(termbuf, {})
sleep 50m
let newbuf = bufadd('')
call bufload(newbuf)
call setbufline(newbuf, 1, 'foobar')
" must not have switched to another window
call assert_equal(winid, win_getid())
call feedkeys("exit\<CR>", 'xt')
sleep 50m
exe 'bwipe! ' .. newbuf
endfunc
func Test_terminal_popup_insert_cmd()
CheckUnix
inoremap <F3> <Cmd>call StartTermInPopup()<CR>
func StartTermInPopup()
call term_start(['/bin/sh', '-c', 'cat'], #{hidden: v:true, term_finish: 'close'})->popup_create(#{highlight: 'Pmenu'})
endfunc
call feedkeys("i\<F3>")
sleep 10m
call assert_equal('n', mode())
call feedkeys("\<C-D>", 'xt')
sleep 50m
delfunc StartTermInPopup
iunmap <F3>
endfunc
func Check_dump01(off)
call assert_equal('one two three four five', trim(getline(a:off + 1)))
call assert_equal('~ Select Word', trim(getline(a:off + 7)))

View File

@@ -195,10 +195,16 @@ def Test_extend_arg_types()
assert_equal([1, 2, 3], extend([1, 2], [3]))
assert_equal([3, 1, 2], extend([1, 2], [3], 0))
assert_equal([1, 3, 2], extend([1, 2], [3], 1))
assert_equal([1, 3, 2], extend([1, 2], [3], s:number_one))
assert_equal(#{a: 1, b: 2, c: 3}, extend(#{a: 1, b: 2}, #{c: 3}))
assert_equal(#{a: 1, b: 4}, extend(#{a: 1, b: 2}, #{b: 4}))
assert_equal(#{a: 1, b: 2}, extend(#{a: 1, b: 2}, #{b: 4}, 'keep'))
assert_equal(#{a: 1, b: 2}, extend(#{a: 1, b: 2}, #{b: 4}, s:string_keep))
var res: list<dict<any>>
extend(res, map([1, 2], {_, v -> {}}))
assert_equal([{}, {}], res)
CheckDefFailure(['extend([1, 2], 3)'], 'E1013: Argument 2: type mismatch, expected list<number> but got number')
CheckDefFailure(['extend([1, 2], ["x"])'], 'E1013: Argument 2: type mismatch, expected list<number> but got list<string>')
@@ -338,6 +344,10 @@ def Test_index()
index(['a', 'b', 'a', 'B'], 'b', 2, true)->assert_equal(3)
enddef
let s:number_one = 1
let s:number_two = 2
let s:string_keep = 'keep'
def Test_insert()
var l = insert([2, 1], 3)
var res = 0
@@ -347,9 +357,12 @@ def Test_insert()
res->assert_equal(6)
assert_equal([1, 2, 3], insert([2, 3], 1))
assert_equal([1, 2, 3], insert([2, 3], s:number_one))
assert_equal([1, 2, 3], insert([1, 2], 3, 2))
assert_equal([1, 2, 3], insert([1, 2], 3, s:number_two))
assert_equal(['a', 'b', 'c'], insert(['b', 'c'], 'a'))
assert_equal(0z1234, insert(0z34, 0x12))
CheckDefFailure(['insert([2, 3], "a")'], 'E1013: Argument 2: type mismatch, expected number but got string', 1)
CheckDefFailure(['insert([2, 3], 1, "x")'], 'E1013: Argument 3: type mismatch, expected number but got string', 1)
enddef

View File

@@ -567,11 +567,14 @@ def Test_expr4_equal()
assert_equal(false, function('g:Test_expr4_equal', [123]) == function('g:Test_expr4_is', [123]))
assert_equal(false, function('g:Test_expr4_equal', [123]) == function('g:Test_expr4_equal', [999]))
var OneFunc: func
var TwoFunc: func
OneFunc = function('len')
TwoFunc = function('len')
assert_equal(true, OneFunc('abc') == TwoFunc('123'))
# TODO: this unexpectedly sometimes fails on Appveyor
if !has('win32')
var OneFunc: func
var TwoFunc: func
OneFunc = function('len')
TwoFunc = function('len')
assert_equal(true, OneFunc('abc') == TwoFunc('123'))
endif
END
CheckDefAndScriptSuccess(lines)

View File

@@ -750,6 +750,32 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
1998,
/**/
1997,
/**/
1996,
/**/
1995,
/**/
1994,
/**/
1993,
/**/
1992,
/**/
1991,
/**/
1990,
/**/
1989,
/**/
1988,
/**/
1987,
/**/
1986,
/**/
1985,
/**/

View File

@@ -820,7 +820,7 @@ generate_TYPECHECK(
* Return TRUE if "actual" could be "expected" and a runtime typecheck is to be
* used. Return FALSE if the types will never match.
*/
static int
int
use_typecheck(type_T *actual, type_T *expected)
{
if (actual->tt_type == VAR_ANY

View File

@@ -516,6 +516,20 @@ check_type(type_T *expected, type_T *actual, int give_msg, int argidx)
return ret;
}
/*
* Like check_type() but also allow for a runtime type check. E.g. "any" can be
* used for "number".
*/
int
check_arg_type(type_T *expected, type_T *actual, int argidx)
{
if (check_type(expected, actual, FALSE, 0) == OK
|| use_typecheck(actual, expected))
return OK;
// TODO: should generate a TYPECHECK instruction.
return check_type(expected, actual, TRUE, argidx);
}
/*
* Skip over a type definition and return a pointer to just after it.
* When "optional" is TRUE then a leading "?" is accepted.

View File

@@ -1462,6 +1462,7 @@ win_valid(win_T *win)
/*
* Find window "id" in the current tab page.
* Also find popup windows.
* Return NULL if not found.
*/
win_T *
@@ -1472,6 +1473,14 @@ win_find_by_id(int id)
FOR_ALL_WINDOWS(wp)
if (wp->w_id == id)
return wp;
#ifdef FEAT_PROP_POPUP
FOR_ALL_POPUPWINS(wp)
if (wp->w_id == id)
return wp;
FOR_ALL_POPUPWINS_IN_TAB(curtab, wp)
if (wp->w_id == id)
return wp;
#endif
return NULL;
}