From c2018e05de0e9eebadbe094357d22883a608fdf5 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, 23 Aug 2023 15:13:51 +0800 Subject: support `---@class (exact)` #1990 --- test/diagnostics/inject-field.lua | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'test/diagnostics') diff --git a/test/diagnostics/inject-field.lua b/test/diagnostics/inject-field.lua index f4d847e9..9bb0f8fc 100644 --- a/test/diagnostics/inject-field.lua +++ b/test/diagnostics/inject-field.lua @@ -62,3 +62,23 @@ local t t.x = 1 -- OK t.y = 2 -- OK ]] + + +TEST [[ +---@class (exact) Class +---@field x number +local m = { + x = 1, -- OK + = 2, -- Warning +} + +m.x = 1 -- OK +m. = 2 -- Warning + +function m:init() -- OK + self.x = 1 -- OK + self. = 2 -- Warning + function self:() -- Warning + end +end +]] -- cgit v1.2.3