diff options
Diffstat (limited to 'script-beta/parser/guide.lua')
-rw-r--r-- | script-beta/parser/guide.lua | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/script-beta/parser/guide.lua b/script-beta/parser/guide.lua index b756ff61..31e2b9d8 100644 --- a/script-beta/parser/guide.lua +++ b/script-beta/parser/guide.lua @@ -2042,6 +2042,7 @@ function m.mergeTypes(types) local results = {} local mark = {} local hasAny + -- 这里把 any 去掉 for i = 1, #types do local tp = types[i] if tp == 'any' then @@ -2055,6 +2056,7 @@ function m.mergeTypes(types) if #results == 0 then return 'any' end + -- 只有显性的 nil 与 any 时,取 any if #results == 1 then if results[1] == 'nil' and hasAny then return 'any' @@ -2062,6 +2064,15 @@ function m.mergeTypes(types) return results[1] end end + -- 同时包含 number 与 integer 时,去掉 integer + if mark['number'] and mark['integer'] then + for i = 1, #results do + if results[i] == 'integer' then + tableRemove(results, i) + break + end + end + end tableSort(results, function (a, b) local sa = TypeSort[a] or 100 local sb = TypeSort[b] or 100 |