diff options
-rw-r--r-- | changelog.md | 3 | ||||
-rw-r--r-- | script/vm/infer.lua | 4 | ||||
-rw-r--r-- | test/type_inference/init.lua | 11 |
3 files changed, 17 insertions, 1 deletions
diff --git a/changelog.md b/changelog.md index 49470028..6247c5a8 100644 --- a/changelog.md +++ b/changelog.md @@ -1,5 +1,8 @@ # changelog +## 3.2.4 +* `FIX` hover: can not union `unknown` with other types + ## 3.2.3 `2022-5-16` * `CHG` parse `.luarc.json` as jsonc. In order to please the editor, it also supports `.luarc.jsonc` as the file name. diff --git a/script/vm/infer.lua b/script/vm/infer.lua index fabc9828..dba46ffc 100644 --- a/script/vm/infer.lua +++ b/script/vm/infer.lua @@ -76,7 +76,9 @@ local viewNodeSwitch = util.switch() : case 'global' : call(function (source, infer) if source.cate == 'type' then - infer._hasClass = true + if source.name ~= 'unknown' then + infer._hasClass = true + end if source.name == 'number' then infer._hasNumber = true end diff --git a/test/type_inference/init.lua b/test/type_inference/init.lua index b71cf987..615c13df 100644 --- a/test/type_inference/init.lua +++ b/test/type_inference/init.lua @@ -2297,3 +2297,14 @@ end print(<?t?>) ]] + +TEST 'table|unknown' [[ +local function f() + if x then + return y + end + return {} +end + +local <?z?> = f() +]] |