diff options
-rw-r--r-- | script/core/infer.lua | 6 | ||||
-rw-r--r-- | test/type_inference/init.lua | 2 |
2 files changed, 7 insertions, 1 deletions
diff --git a/script/core/infer.lua b/script/core/infer.lua index 7ad35643..f6ca6499 100644 --- a/script/core/infer.lua +++ b/script/core/infer.lua @@ -254,6 +254,12 @@ local function cleanInfers(infers) end end infers['any'] = nil + if infers['nil'] then + infers['nil'] = nil + if not next(infers) then + infers['nil'] = true + end + end end ---合并对象的推断类型 diff --git a/test/type_inference/init.lua b/test/type_inference/init.lua index ba3ca304..13efbc59 100644 --- a/test/type_inference/init.lua +++ b/test/type_inference/init.lua @@ -189,7 +189,7 @@ end <?y?> = x() ]] -TEST 'integer|nil' [[ +TEST 'integer' [[ local function x() return 1 return nil |