summaryrefslogtreecommitdiff
path: root/script/core
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2022-11-08 20:51:16 +0800
committer最萌小汐 <sumneko@hotmail.com>2022-11-08 20:51:16 +0800
commite7f8bc78843c03c677668a676f124902b2b889a2 (patch)
treeab5fbb692c12713eab2abee9a9464d49b6a77601 /script/core
parent49de63caf1b60807b031bb90d8c8fc7dfd65622a (diff)
downloadlua-language-server-e7f8bc78843c03c677668a676f124902b2b889a2.zip
fix #1676
Diffstat (limited to 'script/core')
-rw-r--r--script/core/diagnostics/param-type-mismatch.lua14
1 files changed, 9 insertions, 5 deletions
diff --git a/script/core/diagnostics/param-type-mismatch.lua b/script/core/diagnostics/param-type-mismatch.lua
index 1fe5fa94..c67eac50 100644
--- a/script/core/diagnostics/param-type-mismatch.lua
+++ b/script/core/diagnostics/param-type-mismatch.lua
@@ -9,10 +9,7 @@ local function expandGenerics(defNode)
local generics = {}
for dn in defNode:eachObject() do
if dn.type == 'doc.generic.name' then
- local limits = dn.generic.extends
- if limits then
- generics[#generics+1] = dn
- end
+ generics[#generics+1] = dn
end
end
@@ -22,7 +19,14 @@ local function expandGenerics(defNode)
for _, generic in ipairs(generics) do
local limits = generic.generic.extends
- defNode:merge(vm.compileNode(limits))
+ if limits then
+ defNode:merge(vm.compileNode(limits))
+ else
+ local unknownType = vm.getGlobal('type', 'unknown')
+ if unknownType then
+ defNode:merge(unknownType)
+ end
+ end
end
end