From a88c6796f2ab2ac3b3ff2419ab1cfdcb5518013f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9C=80=E8=90=8C=E5=B0=8F=E6=B1=90?= Date: Wed, 11 Aug 2021 21:04:00 +0800 Subject: dont show `nil.XXX` --- script/core/infer.lua | 3 ++- test/hover/init.lua | 8 ++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/script/core/infer.lua b/script/core/infer.lua index 5bf8a5f2..8ac585f4 100644 --- a/script/core/infer.lua +++ b/script/core/infer.lua @@ -672,7 +672,8 @@ function m.getClass(source) end end local view = m.viewInfers(infers) - if view == 'any' then + if view == 'any' + or view == 'nil' then return nil end return view diff --git a/test/hover/init.lua b/test/hover/init.lua index 4f339c87..9dc9a9a8 100644 --- a/test/hover/init.lua +++ b/test/hover/init.lua @@ -1671,3 +1671,11 @@ function f1.f2.() end [[ function f1.f2.f3() ]] + +TEST [[ +local t = nil +t.() +]] +[[ +field t.x: any +]] -- cgit v1.2.3