summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--script-beta/core/hover/label.lua7
-rw-r--r--test-beta/hover/init.lua10
2 files changed, 15 insertions, 2 deletions
diff --git a/script-beta/core/hover/label.lua b/script-beta/core/hover/label.lua
index 21330b17..e4081438 100644
--- a/script-beta/core/hover/label.lua
+++ b/script-beta/core/hover/label.lua
@@ -38,8 +38,11 @@ local function asValue(source, title)
pack[#pack+1] = name .. ':'
pack[#pack+1] = class or type
if literal then
- pack[#pack+1] = '='
- pack[#pack+1] = util.viewLiteral(literal)
+ local literalView = util.viewLiteral(literal)
+ if literalView then
+ pack[#pack+1] = '='
+ pack[#pack+1] = util.viewLiteral(literal)
+ end
end
if cont then
pack[#pack+1] = cont
diff --git a/test-beta/hover/init.lua b/test-beta/hover/init.lua
index ecab266e..3919ca80 100644
--- a/test-beta/hover/init.lua
+++ b/test-beta/hover/init.lua
@@ -624,6 +624,16 @@ function f()
2. nil
]]
+TEST [[
+local function f()
+ return nil
+end
+local <?x?> = f()
+]]
+[[
+local x: nil
+]]
+
--TEST[[
-----@class Class
--local <?x?> = class()