vim9script
def Foo(bar: dict<string>)
if exists('bar["a"]')
echo "it exists"
else
echo "it doesn't exist"
endif
enddef
Foo({'a': '...'})
Foo({'b': '...'})
This should echo:
it exists
it doesn’t exist
But it echoes:
it doesn’t exist
it doesn’t exist
I have tried all kinds of combinations, including checking for l:bar[“a”] and a:bar[“a”]. The only thing that works is to assign the bar argument to a global variable and testing that instead, but that’s a kluge.
Regards,
Christian