From 25cae7df6bff76e6a44adf85dfef06742ebf7193 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, 6 Jul 2022 16:01:05 +0800 Subject: dose not infer as `nil` by `t.field = nil` --- test/diagnostics/type-check.lua | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'test/diagnostics') diff --git a/test/diagnostics/type-check.lua b/test/diagnostics/type-check.lua index cc60a969..082d0b41 100644 --- a/test/diagnostics/type-check.lua +++ b/test/diagnostics/type-check.lua @@ -570,9 +570,9 @@ end ]] TEST [[ +---@class A +---@field x number? local t = {} -t.x = 1 -t.x = nil ---@return number function F() @@ -688,5 +688,11 @@ local t t = a.x ]] +TEST [[ +local mt = {} +mt.x = 1 +mt.x = nil +]] + config.remove(nil, 'Lua.diagnostics.disable', 'unused-local') config.remove(nil, 'Lua.diagnostics.disable', 'undefined-global') -- cgit debian/1.2.3+git2.25.1-1-2-gaceb0