summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2022-06-21 17:05:04 +0800
committer最萌小汐 <sumneko@hotmail.com>2022-06-21 17:05:04 +0800
commitf76cd50992dab57a57c61e8e6f5f788745544da9 (patch)
tree03b49b1b32f8044ca4c7d1dc16d01a068c354166 /test
parent8af599790936f81cddaecb31d36eede70ad3739c (diff)
downloadlua-language-server-f76cd50992dab57a57c61e8e6f5f788745544da9.zip
resolve #1221 generic with optional
Diffstat (limited to 'test')
-rw-r--r--test/type_inference/init.lua36
1 files changed, 36 insertions, 0 deletions
diff --git a/test/type_inference/init.lua b/test/type_inference/init.lua
index 9bd66761..5fa70f5f 100644
--- a/test/type_inference/init.lua
+++ b/test/type_inference/init.lua
@@ -2799,3 +2799,39 @@ m.x = {} --> 4th
print(m.<?x?>)
]]
+
+TEST 'boolean?' [[
+---@generic T
+---@param x T
+---@return T
+local function echo(x) end
+
+---@type boolean?
+local b
+
+local <?x?> = echo(b)
+]]
+
+TEST 'boolean' [[
+---@generic T
+---@param x T?
+---@return T
+local function echo(x) end
+
+---@type boolean?
+local b
+
+local <?x?> = echo(b)
+]]
+
+TEST 'boolean' [[
+---@generic T
+---@param x? T
+---@return T
+local function echo(x) end
+
+---@type boolean?
+local b
+
+local <?x?> = echo(b)
+]]