[vim/vim] Vim9script: Using filter() on block-scoped variable causes script-level variable to become inaccessible in function (Issue #19959)

0 views
Skip to first unread message

Mao-Yining

unread,
Apr 11, 2026, 11:13:43 PM (2 hours ago) Apr 11
to vim/vim, Subscribed
mao-yining created an issue (vim/vim#19959)

Steps to reproduce

vim9script
if true
	var lines = ['a']
	lines->filter((_, _) => true)
endif
var lines = []

def F()
	lines->add('c')
enddef
F()

Throw E1001: Variable not found: lines.

Expected behaviour

The script-level variable lines should be accessible inside function F().

Version of Vim

9.2.0329

Environment

MS-Windows GUI

Logs and stack traces


Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issues/19959@github.com>

Mao-Yining

unread,
Apr 11, 2026, 11:15:59 PM (1 hour ago) Apr 11
to vim/vim, Subscribed
mao-yining left a comment (vim/vim#19959)

Found this problem when preparing #19915


Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issues/19959/4230641163@github.com>

Reply all
Reply to author
Forward
0 new messages