diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2022-04-24 00:05:42 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2022-04-24 00:05:42 +0800 |
commit | 999c5dd79a772d039b384ab856023942935592fb (patch) | |
tree | a2443b479f8663d474eae469ec6eacf796f46011 /test | |
parent | 3cadbfc7419542a8b56f0996bfbfbda146a30ea5 (diff) | |
download | lua-language-server-999c5dd79a772d039b384ab856023942935592fb.zip |
infer by `assert(x)`
Diffstat (limited to 'test')
-rw-r--r-- | test/type_inference/init.lua | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/test/type_inference/init.lua b/test/type_inference/init.lua index a9ea81a7..357dd04b 100644 --- a/test/type_inference/init.lua +++ b/test/type_inference/init.lua @@ -1919,3 +1919,29 @@ local <?x?> = t[1] TEST 'unknown' [[ local <?x?> = y and z ]] + +TEST 'integer' [[ +---@type integer? +local x + +assert(x) + +print(<?x?>) +]] + +TEST 'integer' [[ +---@type integer? +local x + +assert(x ~= nil) + +print(<?x?>) +]] + +TEST 'integer' [[ +local x + +assert(x == 1) + +print(<?x?>) +]] |