mirror of
https://github.com/vim/vim.git
synced 2025-10-03 05:14:07 -04:00
patch 8.2.2734: Vim9: cannot use legacy script-local var from :def function
Problem: Vim9: cannot use legacy script-local var from :def function. Solution: Do not insist on using "s:" prefix. (closes #8076)
This commit is contained in:
@@ -2714,6 +2714,21 @@ def Test_expr7_negate_add()
|
||||
CheckDefAndScriptFailure(lines, 'E1050:')
|
||||
enddef
|
||||
|
||||
def Test_expr7_legacy_script()
|
||||
var lines =<< trim END
|
||||
let s:legacy = 'legacy'
|
||||
def GetLocal(): string
|
||||
return legacy
|
||||
enddef
|
||||
def GetLocalPrefix(): string
|
||||
return s:legacy
|
||||
enddef
|
||||
call assert_equal('legacy', GetLocal())
|
||||
call assert_equal('legacy', GetLocalPrefix())
|
||||
END
|
||||
CheckScriptSuccess(lines)
|
||||
enddef
|
||||
|
||||
def Echo(arg: any): string
|
||||
return arg
|
||||
enddef
|
||||
|
Reference in New Issue
Block a user