(Note running with #12868, doubt that that matters)
Source this script
vim9script
class C
this.val: number
def new(this.val)
enddef
endclass
var some_dict: dict<C> = { a: C.new(1), b: C.new(2), c: C.new(3), }
lockvar 2 some_dict
var current: C
current = some_dict['c'] | echo 'A:' current
current = some_dict['b'] | echo 'B:' current
def F()
current = some_dict['c']
enddef
def G()
current = some_dict['b']
enddef
F() | echo 'C:' current
G() | echo 'D:' current
echo some_dict
Observe this output
A: object of C {val: 3}
B: object of C {val: 2}
C: object of C {val: 3}
Error detected while processing command line..script /home/err/bugs/vim/classlock/lockclass.vim[27].
.function <SNR>34_G:
line 1:
E741: Value is locked: current
There's no attempt at modified the locked structures. Notice that it works at script level.
Source the following, which uses a list instead of a class in some_dict and there is no problem
vim9script
var some_dict: dict<list<number>> = { a: [1], b: [2], c: [3], }
lockvar 2 some_dict
var current: list<number>
current = some_dict['c'] | echo 'A:' current
current = some_dict['b'] | echo 'B:' current
def F()
current = some_dict['c']
enddef
def G()
current = some_dict['b']
enddef
F() | echo 'C:' current
G() | echo 'D:' current
#some_dict['a'] = [11]
echo some_dict
No error.
9.0.1778 + PR#12868
linux
No response
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.![]()
This is a bug not related to #12868. I have updated the PR with a fix for this issue.
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.![]()
Closed #12881 as completed via 618e47d.
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.![]()