You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is an example taken directly from busted documentation:
localt= {
greet=function(msg) print(msg) end
}
stub(t, "greet")
t.greet("Hey!") -- DOES NOT print 'Hey!'assert.stub(t.greet).was.called_with("Hey!")
Lua LS gives the following error on the assertion line:
Diagnostics:
Cannot assign `function` to parameter `luassert.spy`.
- `function` cannot match `luassert.spy`
- Type `function` cannot match `luassert.spy` [param-type-mismatch]
I'm not sure how to fix this. Changing the param in the meta file to luassert.spy|function may be a workaround but would not be accurate. The problem is that t.greet is already a luassert.spy object but the language server incorrectly assumes that it is a function. The object is modified in-place and after the call:
locals=stub(t, "greet")
t.greet is no longer a function but a callable table. Both s and t.greet point to the same object (of type luassert.spy). It would be best if the language server could figure this out.
The text was updated successfully, but these errors were encountered:
This is an example taken directly from busted documentation:
Lua LS gives the following error on the assertion line:
I'm not sure how to fix this. Changing the param in the meta file to
luassert.spy|function
may be a workaround but would not be accurate. The problem is thatt.greet
is already aluassert.spy
object but the language server incorrectly assumes that it is afunction
. The object is modified in-place and after the call:t.greet
is no longer a function but a callable table. Boths
andt.greet
point to the same object (of typeluassert.spy
). It would be best if the language server could figure this out.The text was updated successfully, but these errors were encountered: