From e711f30dbcf840e8adec49a78d734d1a0306934b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9C=80=E8=90=8C=E5=B0=8F=E6=B1=90?= Date: Tue, 5 Jul 2022 16:04:12 +0800 Subject: resolve #1280 --- test/diagnostics/type-check.lua | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) (limited to 'test/diagnostics/type-check.lua') diff --git a/test/diagnostics/type-check.lua b/test/diagnostics/type-check.lua index 32f60f82..f1f14b48 100644 --- a/test/diagnostics/type-check.lua +++ b/test/diagnostics/type-check.lua @@ -631,5 +631,38 @@ n = nb ]] config.set(nil, 'Lua.type.weakNilCheck', false) +TEST [[ +---@class A +local a = {} + +---@class B: A +local = a +]] + +TEST [[ +---@class A +local a = {} +a.__index = a + +---@class B: A +local b = setmetatable({}, a) +]] + +TEST [[ +---@class A +local a = {} + +---@class B: A +local b = setmetatable({}, {__index = a}) +]] + +TEST [[ +---@class A +local a = {} + +---@class B +local = setmetatable({}, {__index = a}) +]] + config.remove(nil, 'Lua.diagnostics.disable', 'unused-local') config.remove(nil, 'Lua.diagnostics.disable', 'undefined-global') -- cgit v1.2.3