summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--server/src/matcher/library.lua10
-rw-r--r--server/test/hover/init.lua8
2 files changed, 17 insertions, 1 deletions
diff --git a/server/src/matcher/library.lua b/server/src/matcher/library.lua
index 19e3b8e0..f6211431 100644
--- a/server/src/matcher/library.lua
+++ b/server/src/matcher/library.lua
@@ -65,6 +65,14 @@ local function mergeSource(alllibs, name, lib)
end
end
+local function copy(t)
+ local new = {}
+ for k, v in pairs(t) do
+ new[k] = v
+ end
+ return new
+end
+
local function insert(tbl, name, key, value)
if not name or not key then
return
@@ -76,7 +84,7 @@ local function insert(tbl, name, key, value)
child = {},
}
end
- tbl[name].child[key] = value
+ tbl[name].child[key] = copy(value)
end
local function mergeParent(alllibs, name, lib)
diff --git a/server/test/hover/init.lua b/server/test/hover/init.lua
index 31e604f3..a5e11a74 100644
--- a/server/test/hover/init.lua
+++ b/server/test/hover/init.lua
@@ -172,3 +172,11 @@ mode: string
| "t"
| "bt"
]=]
+
+TEST [[
+string.<?lower?>()
+]]
+[[
+function string.lower(string)
+ -> string
+]]