forked from aniani/vim
patch 9.1.0257: Vim9: :call may not find imported class members
Problem: Vim9: :call may not find imported class members
(mityu)
Solution: Set the typval of an imported lval variable correctly
(Yegappan Lakshmanan)
fixes: #14334
closes: #14386
Signed-off-by: Yegappan Lakshmanan <yegappan@yahoo.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
This commit is contained in:
committed by
Christian Brabandt
parent
78d742ab88
commit
f1750ca0c2
@@ -2054,6 +2054,13 @@ def Test_import_vim9_from_legacy()
|
||||
export def GetText(): string
|
||||
return 'text'
|
||||
enddef
|
||||
export var exported_nr: number = 22
|
||||
def AddNum(n: number)
|
||||
exported_nr += n
|
||||
enddef
|
||||
export var exportedDict: dict<func> = {Fn: AddNum}
|
||||
export const CONST = 10
|
||||
export final finalVar = 'abc'
|
||||
END
|
||||
writefile(vim9_lines, 'Xvim9_export.vim', 'D')
|
||||
|
||||
@@ -2072,6 +2079,13 @@ def Test_import_vim9_from_legacy()
|
||||
" imported symbol is script-local
|
||||
call assert_equal('exported', s:vim9.exported)
|
||||
call assert_equal('text', s:vim9.GetText())
|
||||
call s:vim9.exportedDict.Fn(5)
|
||||
call assert_equal(27, s:vim9.exported_nr)
|
||||
call call(s:vim9.exportedDict.Fn, [3])
|
||||
call assert_equal(30, s:vim9.exported_nr)
|
||||
call assert_fails('let s:vim9.CONST = 20', 'E46: Cannot change read-only variable "CONST"')
|
||||
call assert_fails('let s:vim9.finalVar = ""', 'E46: Cannot change read-only variable "finalVar"')
|
||||
call assert_fails('let s:vim9.non_existing_var = 20', 'E1048: Item not found in script: non_existing_var')
|
||||
END
|
||||
writefile(legacy_lines, 'Xlegacy_script.vim', 'D')
|
||||
|
||||
|
||||
Reference in New Issue
Block a user