diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2022-11-08 23:33:15 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2022-11-08 23:33:15 +0800 |
commit | 4d73939b6ec2320f72b35e1e193b8bf1fb18f64c (patch) | |
tree | ccd6e90f7ed456b80ea32cfbac562aee475897ba /script/vm | |
parent | e7f8bc78843c03c677668a676f124902b2b889a2 (diff) | |
download | lua-language-server-4d73939b6ec2320f72b35e1e193b8bf1fb18f64c.zip |
fix incorrect type check for generic with nil
Diffstat (limited to 'script/vm')
-rw-r--r-- | script/vm/generic.lua | 11 | ||||
-rw-r--r-- | script/vm/type.lua | 3 |
2 files changed, 9 insertions, 5 deletions
diff --git a/script/vm/generic.lua b/script/vm/generic.lua index e6b47392..4ac7374d 100644 --- a/script/vm/generic.lua +++ b/script/vm/generic.lua @@ -36,11 +36,12 @@ local function cloneObject(source, resolved) end if source.type == 'doc.type' then local newType = { - type = source.type, - start = source.start, - finish = source.finish, - parent = source.parent, - types = {}, + type = source.type, + start = source.start, + finish = source.finish, + parent = source.parent, + optional = source.optional, + types = {}, } for i, typeUnit in ipairs(source.types) do local newObj = cloneObject(typeUnit, resolved) diff --git a/script/vm/type.lua b/script/vm/type.lua index 57a6444f..32b8e50b 100644 --- a/script/vm/type.lua +++ b/script/vm/type.lua @@ -355,6 +355,9 @@ function vm.isSubType(uri, child, parent, mark, errs) return true end end + if n.type == 'doc.generic.name' then + return true + end end if parent:isOptional() then if vm.isSubType(uri, child, 'nil', mark, errs) == true then |