summaryrefslogtreecommitdiff
path: root/test/diagnostics
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2022-04-23 23:24:23 +0800
committer最萌小汐 <sumneko@hotmail.com>2022-04-23 23:24:23 +0800
commit3f815c836beb054a13f8d250f6f05a54778b72ba (patch)
tree04e39933feecbc34cd8ef36c86f838ea8181c635 /test/diagnostics
parenta7afda10d2ea044a8ea3c83d4656736a6969a101 (diff)
downloadlua-language-server-3f815c836beb054a13f8d250f6f05a54778b72ba.zip
new diagnostic: `need-check-nil`
Diffstat (limited to 'test/diagnostics')
-rw-r--r--test/diagnostics/common.lua34
1 files changed, 34 insertions, 0 deletions
diff --git a/test/diagnostics/common.lua b/test/diagnostics/common.lua
index dca826a1..72b2db6c 100644
--- a/test/diagnostics/common.lua
+++ b/test/diagnostics/common.lua
@@ -1460,3 +1460,37 @@ end
<!T:ff!>()
]]
+
+TEST [[
+---@type string?
+local x
+
+S = <!x!>:upper()
+]]
+
+TEST [[
+---@type string?
+local x
+
+if x then
+ S = x:upper()
+end
+]]
+
+TEST [[
+---@type string?
+local x
+
+if not x then
+ x = ''
+end
+
+S = x:upper()
+]]
+
+TEST [[
+---@type fun()?
+local x
+
+S = <!x!>()
+]]