summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNeOzay <69015205+NeOzay@users.noreply.github.com>2024-07-23 18:05:00 +0200
committerGitHub <noreply@github.com>2024-07-23 18:05:00 +0200
commit69c992d298aab2b0d17695e11fa54816014aed4d (patch)
treea5ebea9028180944bf43f2e8664ef922834d4451
parent7582afd72f6d111f81b9c48caf43bafa80a1887a (diff)
parent7d06e5573c8188e61516e987b0d796a40f718b05 (diff)
downloadlua-language-server-69c992d298aab2b0d17695e11fa54816014aed4d.zip
Merge branch 'master' into inconsistent-behavior-(missing-fields)
-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