summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--changelog.md3
-rw-r--r--script/vm/compiler.lua6
2 files changed, 8 insertions, 1 deletions
diff --git a/changelog.md b/changelog.md
index 8efe3ce1..f91a27f4 100644
--- a/changelog.md
+++ b/changelog.md
@@ -12,8 +12,9 @@
* `NEW` Added lua regular expression support for Lua.doc.\<scope\>Name [#2753](https://github.com/LuaLS/lua-language-server/pull/2753)
* `FIX` Bad triggering of the `inject-field` diagnostic, when the fields are declared at the creation of the object [#2746](https://github.com/LuaLS/lua-language-server/issues/2746)
* `CHG` Change spacing of parameter inlay hints to match other LSPs, like `rust-analyzer`
+* `FIX` Inconsistent type narrow behavior of function call args [#2758](https://github.com/LuaLS/lua-language-server/issues/2758)
* `FIX` Improve the `missing-fields` logic to be able to correctly handle classes defined several times [#22770](https://github.com/LuaLS/lua-language-server/pull/2770)
-
+*
## 3.9.3
`2024-6-11`
* `FIX` Sometimes providing incorrect autocompletion when chaining calls
diff --git a/script/vm/compiler.lua b/script/vm/compiler.lua
index e1b1b43b..f3655123 100644
--- a/script/vm/compiler.lua
+++ b/script/vm/compiler.lua
@@ -575,6 +575,12 @@ local function matchCall(source)
newNode:removeNode(needRemove)
newNode.originNode = myNode
vm.setNode(source, newNode, true)
+ if call.args then
+ -- clear node caches of args to allow recomputation with the type narrowed call
+ for _, arg in ipairs(call.args) do
+ vm.removeNode(arg)
+ end
+ end
end
end